Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

latex error with spaces and single character argument after \frac in math mode #50

Closed
xanonid opened this issue May 13, 2016 · 6 comments

Comments

@xanonid
Copy link

xanonid commented May 13, 2016

Spaces seem to be not properly ignored in math mode.

While

\documentclass[]{article}
\begin{document}
$x=\frac {1+2} b $
\end{document}

and

\documentclass[]{article}
\begin{document}
$x=\frac 1 {def}$
\end{document}

are processed by latex properly, their latexdiff shows both wrong. This is probably connected to the
ulem package.

Wrapping the same term into an equation environment:

\documentclass[]{article}
\begin{document}
\begin{equation}
x=\frac {1+2} b
\end{equation}

and

\documentclass[]{article}
\begin{document}
\begin{equation}
x=\frac 1 {def}
\end{equation}
\end{document}

produces with latexdiff:

 ! Undefined control sequence.
l.28 \DIFaddend \MATHBLOCKequation
                                  {
? 

@ftilmann
Copy link
Owner

It's a documented limitation of latexdiff that command arguments should always be surrounded by curly braces and that there should be no space between a command and its arguments or between the arguments (with the option --allow-spaces the second requirement is relaxed). This is necessary because latexdiff would otherwise have to know how many arguments each command it encounters is expecting, quite an impossible task given the number of available packages. Having said this, \frac seems to lead to this type of problems somewhat frequently, so I will consider introducing a special preprocessing in that essentially will convert the frac expressions to a form that latexdiff can digest. I will leave this question open as a feature request but it might not happen very quickly.

@ftilmann ftilmann changed the title latex error with spaces after \frac in math mode latex error with spaces and single character argument after \frac in math mode May 13, 2016
@xanonid
Copy link
Author

xanonid commented May 13, 2016

Thanks for your quick and clarifying answer and all your development efforts!

@ftilmann
Copy link
Owner

I think this should have been fixed with commit e9d2fbc

@julianuu
Copy link
Contributor

julianuu commented Nov 4, 2021

I think it is not fixed, at least inside in an equation environment I still get errors for the cases mentioned by @xanonid. I would be happy to contribute those and other cases to the list in https://github.com/ftilmann/latexdiff/blob/master/latexdiff#L2569, would you want this @ftilmann?

@ftilmann
Copy link
Owner

ftilmann commented Nov 4, 2021

Sure, complete MWE (old and new file) are useful/needed for debugging efforts. As this is supposed to work, this is the only way to make progress. Thanks (will re-open issue once MWE is received)

@ftilmann
Copy link
Owner

Was addressed by @julianuu 's pull request #246. Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants