Skip to content

Commit 72dfb40

Browse files
authored
Swap \; for \, in LatexifyExt and matching tests (#810)
1 parent d14ad5b commit 72dfb40

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

ext/LatexifyExt.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ function _transform(q::AbstractQuantity, ::AbstractNumberFormatter)
193193
Expr(
194194
:latexifymerge,
195195
NakedNumber(q.val),
196-
has_unit_spacing(unit(q)) ? "\\;" : nothing,
196+
has_unit_spacing(unit(q)) ? "\\," : nothing,
197197
NakedUnits(unit(q)),
198198
)
199199
end
@@ -243,7 +243,7 @@ end
243243
)
244244
end
245245
env --> :inline
246-
return Expr(:latexifymerge, q.val, "\\;\\mathrm{", unitnames[(:mathrm, unitname)], "}")
246+
return Expr(:latexifymerge, q.val, "\\,\\mathrm{", unitnames[(:mathrm, unitname)], "}")
247247
end
248248

249249
# arrays -------------------------
@@ -253,7 +253,7 @@ end
253253
# Array of quantities with the same unit
254254
env --> :equation
255255
return Expr(
256-
:latexifymerge, ustrip.(a), has_unit_spacing(first(a)) ? "\\;" : "", unit(first(a))
256+
:latexifymerge, ustrip.(a), has_unit_spacing(first(a)) ? "\\," : "", unit(first(a))
257257
)
258258
end
259259

test/runtests.jl

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1793,15 +1793,15 @@ end
17931793
)
17941794
unitfullatexifytest(
17951795
24.7e9u"Gm/s^2",
1796-
raw"$2.47 \cdot 10^{10}\;\mathrm{Gm}\,\mathrm{s}^{-2}$",
1796+
raw"$2.47 \cdot 10^{10}\,\mathrm{Gm}\,\mathrm{s}^{-2}$",
17971797
raw"\qty{2.47e10}{\giga\meter\per\second\tothe{2}}",
17981798
raw"\qty{2.47e10}{Gm.s^{-2}}",
17991799
)
18001800
unitfullatexifytest(
18011801
u"percent", raw"$\mathrm{\%}$", raw"\unit{\percent}", raw"\unit{\%}"
18021802
)
18031803
unitfullatexifytest(
1804-
2u"°C", raw"$2\;\mathrm{^\circ C}$", raw"\qty{2}{\celsius}", raw"\qty{2}{\celsius}"
1804+
2u"°C", raw"$2\,\mathrm{^\circ C}$", raw"\qty{2}{\celsius}", raw"\qty{2}{\celsius}"
18051805
)
18061806
unitfullatexifytest(
18071807
1u"°", raw"$1\mathrm{^{\circ}}$", raw"\qty{1}{\degree}", raw"\qty{1}{\degree}"
@@ -1816,7 +1816,7 @@ end
18161816
2 \\
18171817
3 \\
18181818
\end{array}
1819-
\right]\;\mathrm{m}
1819+
\right]\,\mathrm{m}
18201820
\end{equation}
18211821
""",
18221822
raw"""
@@ -1827,7 +1827,7 @@ end
18271827
\num{2} \\
18281828
\num{3} \\
18291829
\end{array}
1830-
\right]\;\unit{\meter}
1830+
\right]\,\unit{\meter}
18311831
\end{equation}
18321832
""",
18331833
raw"""
@@ -1838,7 +1838,7 @@ end
18381838
\num{2} \\
18391839
\num{3} \\
18401840
\end{array}
1841-
\right]\;\unit{m}
1841+
\right]\,\unit{m}
18421842
\end{equation}
18431843
""",
18441844
)
@@ -1851,15 +1851,15 @@ end
18511851
2 \\
18521852
3 \\
18531853
\end{array}
1854-
\right]\;\mathrm{m}
1854+
\right]\,\mathrm{m}
18551855
\end{equation}
18561856
""",
18571857
raw"\qtylist{1;2;3}{\meter}",
18581858
raw"\qtylist{1;2;3}{m}",
18591859
)
18601860

18611861
@test latexify(24.7e9u"Gm/s^2"; fmt="%.1e") ==
1862-
L"$2.5e+10\;\mathrm{Gm}\,\mathrm{s}^{-2}$"
1862+
L"$2.5e+10\,\mathrm{Gm}\,\mathrm{s}^{-2}$"
18631863
@test latexify(5.9722e24u"kg"; fmt=SiunitxNumberFormatter(version=2)) ==
18641864
raw"\SI{5.9722e24}{\kilo\gram}"
18651865
@test latexify(u"eV"; fmt=SiunitxNumberFormatter(version=2)) == raw"\si{\electronvolt}"
@@ -1868,16 +1868,16 @@ end
18681868
@testset "permode" begin
18691869
p = 5u"m^3*s^2/H/kg^4"
18701870
@test latexify(p) == LaTeXString(
1871-
raw"$5\;\mathrm{m}^{3}\,\mathrm{s}^{2}\,\mathrm{kg}^{-4}\,\mathrm{H}^{-1}$"
1871+
raw"$5\,\mathrm{m}^{3}\,\mathrm{s}^{2}\,\mathrm{kg}^{-4}\,\mathrm{H}^{-1}$"
18721872
)
18731873
@test latexify(p; permode=:power) == LaTeXString(
1874-
raw"$5\;\mathrm{m}^{3}\,\mathrm{s}^{2}\,\mathrm{kg}^{-4}\,\mathrm{H}^{-1}$"
1874+
raw"$5\,\mathrm{m}^{3}\,\mathrm{s}^{2}\,\mathrm{kg}^{-4}\,\mathrm{H}^{-1}$"
18751875
)
18761876
@test latexify(p; permode=:slash) == LaTeXString(
1877-
raw"$5\;\mathrm{m}^{3}\,\mathrm{s}^{2}\,/\,\mathrm{kg}^{4}\,\mathrm{H}$"
1877+
raw"$5\,\mathrm{m}^{3}\,\mathrm{s}^{2}\,/\,\mathrm{kg}^{4}\,\mathrm{H}$"
18781878
)
18791879
@test latexify(p; permode=:frac) == LaTeXString(
1880-
raw"$5\;\frac{\mathrm{m}^{3}\,\mathrm{s}^{2}}{\mathrm{kg}^{4}\,\mathrm{H}}$"
1880+
raw"$5\,\frac{\mathrm{m}^{3}\,\mathrm{s}^{2}}{\mathrm{kg}^{4}\,\mathrm{H}}$"
18811881
)
18821882
@test latexify(p; permode=:frac, fmt=SiunitxNumberFormatter()) ==
18831883
latexify(p; fmt=SiunitxNumberFormatter())
@@ -1899,7 +1899,7 @@ end
18991899

19001900
@testset "Parentheses" begin
19011901
@test @latexify($(3u"mm")^2 - 4 * $(2u"mm^2")) ==
1902-
raw"$\left( 3\;\mathrm{mm} \right)^{2} - 4 \cdot 2\;\mathrm{mm}^{2}$"
1902+
raw"$\left( 3\,\mathrm{mm} \right)^{2} - 4 \cdot 2\,\mathrm{mm}^{2}$"
19031903
end
19041904
end
19051905

0 commit comments

Comments
 (0)