Skip to content

Commit

Permalink
TeX writer: render prime as '.
Browse files Browse the repository at this point in the history
Closes #246.
  • Loading branch information
jgm committed Dec 3, 2024
1 parent 4666e68 commit 0b7bb76
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 12 deletions.
1 change: 1 addition & 0 deletions src/Text/TeXMath/Writers/TeX.hs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ writeExp o@(EMathOperator s) = do
tell [Grouped math]
writeExp (ESymbol Ord (T.unpack -> [c])) -- do not render "invisible operators"
| c `elem` ['\x2061'..'\x2064'] = return () -- see 3.2.5.5 of mathml spec
writeExp (ESymbol Ord "\8242") = tell [Literal "'"] -- render prime as ', #246
writeExp (ESymbol t s) = do
s' <- getTeXMathM s
when (t == Bin || t == Rel) $ tell [Space]
Expand Down
2 changes: 1 addition & 1 deletion test/writer/tex/02000_General_Punctuation.test
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
& \text{200} & \text{201} & \text{202} & \text{203} & \text{204} & \text{205} & \text{206} \\
\text{0} &   & ‐ & \dagger & ‰ & ⁀ & ⁐ & ⁠ \\
\text{1} & \quad & ‑ & \ddagger & ‱ & ⁁ & ⁑ & \\
\text{2} &   & ‒ & \bullet & \prime & ⁂ & ./. & \\
\text{2} &   & ‒ & \bullet & ' & ⁂ & ./. & \\
\text{3} & \quad & – & ‣ & '' & ⁃ & ⁓ & \\
\text{4} & \; & — & ․ & ''' & / & ⁔ & \\
\text{5} & \: & ― & ‥ & \backprime & ⁅ & ⁕ & @ \\
Expand Down
2 changes: 1 addition & 1 deletion test/writer/tex/07.test
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
, EIdentifier "a"
]
>>> tex
u'' + p(x)u\prime + q(x)u = f(x),\quad x > a
u'' + p(x)u' + q(x)u = f(x),\quad x > a
12 changes: 6 additions & 6 deletions test/writer/tex/complex3.test
Original file line number Diff line number Diff line change
Expand Up @@ -7685,8 +7685,8 @@
>>> tex
\begin{matrix}
{2{\sum{ab}}} & \\
x^{\prime 3} & \\
{{{f^{\prime}{(x)}} + {\sin\cos\theta}} = 1} & \\
x^{'3} & \\
{{{f^{'}{(x)}} + {\sin\cos\theta}} = 1} & \\
{{{f{(z)}} = {\sum\limits_{n = 0}^{\infty}{a_{n}z^{n}}}}\text{, }{{|z| < R}\hspace{0pt}{({R \neq 0})}}} & \\
{\left. \int{}_{C}{\left( {\sum\limits_{n = 0}^{\infty}{a_{n}z^{n}}} \right){\mathbb{d}z}} \right. = {\sum\limits_{n = 0}^{\infty}{a_{n}\left. \int{}_{C}{z^{n}{\mathbb{d}z}} \right.}}} & \\
{{\lim\limits_{n\rightarrow\infty}\left| \left. \int{}_{C}{\left\lbrack {{f{(z)}} - {\sum\limits_{k = 0}^{n}{a_{k}z^{k}}}} \right\rbrack{\mathbb{d}z}} \right. \right|} = 0} & \\
Expand Down Expand Up @@ -7782,7 +7782,7 @@ c & d
\begin{array}{r}
{{{\mathbb{D}_{x\hspace{0pt}x}y} - y} = 0} \\
{{y{(0)}} = 1} \\
{{y^{\prime}(0)} = 0}
{{y^{'}(0)} = 0}
\end{array} & \\
{{y(x)} = {{\frac{1}{3}e^{{- \sqrt[3]{({- 1})}}x}} + {\frac{2}{3}e^{\frac{1}{2}\sqrt[3]{({- 1})}x}{\cos{\frac{1}{2}\sqrt{3}\sqrt[3]{\left( {- 1} \right)}x}}}}} & \\
{{y(t)} = {2{\tan\left( {{2t} - {\frac{1}{4}\pi}} \right)}}} & \\
Expand Down Expand Up @@ -7838,8 +7838,8 @@ t & x & y & z \\
{1 = 3}
\end{matrix} & \\
\begin{matrix}
{{A_{1} = {{N_{0}{({\lambda;\Omega^{\prime}})}} - {\varphi{({\lambda;\Omega^{\prime}})}}}}\text{,}} \\
{{A_{2} = {{\varphi{({\lambda;\Omega^{\prime}})}} - {\varphi{({\lambda;\Omega})}}}}\text{,}} \\
{{A_{1} = {{N_{0}{({\lambda;\Omega^{'}})}} - {\varphi{({\lambda;\Omega^{'}})}}}}\text{,}} \\
{{A_{2} = {{\varphi{({\lambda;\Omega^{'}})}} - {\varphi{({\lambda;\Omega})}}}}\text{,}} \\
{{A_{3} = {\mathcal{N}{({\lambda;\omega})}}}\text{.}}
\end{matrix} & \\
\begin{matrix}
Expand Down Expand Up @@ -7936,7 +7936,7 @@ b_{2\hspace{0pt}1} & b_{2\hspace{0pt}2}
{{\int_{a}^{b}{{f{(x)}}{\mathbb{d}x}}} = {\lim\limits_{{\parallel P\parallel}\rightarrow 0}{\sum\limits_{i = 1}^{n}{{f\left( {\overline{x}}_{i} \right)}{\Delta x_{i}}}}}} & \\
{{\int_{a}^{b}{{f{(x)}}{\mathbb{d}x}}} = {\lim\limits_{n\rightarrow\infty}{\frac{b - a}{n}{\sum\limits_{i = 1}^{n}{f\left( {a + {i\frac{b - a}{n}}} \right)}}}}} & \\
{{\int_{0}^{2}{x^{5}\sqrt{x^{3} + 1}{\mathbb{d}x}}} = {\int_{1}^{3}{\frac{2}{3}u\frac{\sqrt{\left( u^{2} \right)}}{\left( {u^{2} - 1} \right)^{\frac{2}{3}}}\left( {{u^{2}\left( {u^{2} - 1} \right)^{\frac{2}{3}}} - \left( {u^{2} - 1} \right)^{\frac{2}{3}}} \right){\mathbb{d}u}}}} & \\
{\left. \int{{f{({g{(x)}})}}{g^{\prime}{(x)}}{\mathbb{d}x}} \right. = \left. \int{{f{(u)}}{\mathbb{d}u}} \right.} & \\
{\left. \int{{f{({g{(x)}})}}{g^{'}{(x)}}{\mathbb{d}x}} \right. = \left. \int{{f{(u)}}{\mathbb{d}u}} \right.} & \\
{x = {2{\sum\limits_{n = 1}^{100}{n{({n - 1})}}}}} & \\
{{\lim\limits_{x\rightarrow 0}{\sin\left( \frac{1}{x} \right)}} = {{- 1}..1}} & \\
{{h{({i,j})}} = {{{({2 - j})}{g{(i)}}} + {{({j - 1})}{f{({g{(i)}})}}}}} & \\
Expand Down
2 changes: 1 addition & 1 deletion test/writer/tex/moAprime16.test
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
, EDelimited "(" ")" [ Right (EIdentifier "x") ]
]
>>> tex
f^{'}(x) = f^{\prime}(x)
f^{'}(x) = f^{'}(x)
2 changes: 1 addition & 1 deletion test/writer/tex/p.test
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
\text{precneqq} & ⪵ \\
\text{precnsim} & \precnsim \\
\text{precsim} & \precsim \\
\text{prime} & \prime \\
\text{prime} & ' \\
\text{Prime} & '' \\
\text{primes} & \mathbb{P} \\
\text{prnap} & \precnapprox \\
Expand Down
2 changes: 1 addition & 1 deletion test/writer/tex/primes1.test
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@
, ESuper (ESymbol Accent "'") (ESymbol Accent "'")
]
>>> tex
x^{2} + 2^{2} + x^{\prime} + x^{'} + x^{\operatorname{''}} + x\prime + {x^{'}}^{'} + {x^{'}}^{2} + x^{' + '} + {x^{'}}^{'} + x^{'^{'}} + '^{'} + '^{'}
x^{2} + 2^{2} + x^{'} + x^{'} + x^{\operatorname{''}} + x\prime + {x^{'}}^{'} + {x^{'}}^{2} + x^{' + '} + {x^{'}}^{'} + x^{'^{'}} + '^{'} + '^{'}
2 changes: 1 addition & 1 deletion test/writer/tex/primes2.test
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@
, ESuper (EIdentifier "H") (ESymbol Accent "\8279")
]
>>> tex
H^{"}H^{'}H^{*}H^{`}H^{ª}H^{{^\circ}}H^{²}H^{³}H^{´}H^{¹}H^{º}H^{‘}H^{’}H^{‚}H^{‛}H^{``}H^{"}H^{„}H^{‟}H^{\prime}H^{''}H^{'''}H^{\backprime}H^{‶}H^{‷}H^{⁗}
H^{"}H^{'}H^{*}H^{`}H^{ª}H^{{^\circ}}H^{²}H^{³}H^{´}H^{¹}H^{º}H^{‘}H^{’}H^{‚}H^{‛}H^{``}H^{"}H^{„}H^{‟}H^{'}H^{''}H^{'''}H^{\backprime}H^{‶}H^{‷}H^{⁗}

0 comments on commit 0b7bb76

Please sign in to comment.