Skip to content

Indentation change when double dollar display math occurs inside itemize environment #795

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

Open
alexanderperlis opened this issue Feb 4, 2025 · 6 comments
Labels
analyse something that needs further checking and perhaps code changes area: lists area: math unsupport usage/syntax works as designed something that was designed this way (though it might get enhancements)

Comments

@alexanderperlis
Copy link

[This report concerns LaTeX2e <2025-06-01> pre-release-1 (develop 2025-2-4 branch) L3 programming layer <2025-01-18>. The indentation change reported here occurs with both pdflatex-dev and lualatex-dev.]

I came across the following type of situation in a document:

%\DocumentMetadata{testphase=latest}
\documentclass{article}

\begin{document}

This is a long paragraph spanning multiple lines to
show indentation, followed by an itemize:

\begin{itemize}

\item First item with double-dollar display math $$x=y$$ to consider.

\item Second item should remain aligned with the first.

\end{itemize}

This is a long paragraph spanning multiple lines to
again show indentation, this time following the itemize.

\end{document}

Without testphase=latest, the bullets are aligned as expected.

Image

With testphase=latest, all itemize material after the display loses its indentation.

Image

The workaround for authors is simple: use \[...\] instead of $$...$$. Reporting here in case there is interest in the possibility of preserving the ability for authors to use $$...$$ for unlabeled displays inside itemize.

@FrankMittelbach
Copy link
Member

FrankMittelbach commented Feb 4, 2025

In contrast to single dollar syntax which is offically supportedd by LaTeX, the plain TeX $$ ... $$ was never supported in LaTeX and in fact has a number of failure cases not just with the new tagging code but also in other situations (for example when fleqn option is used).

I know that a lot of people use it, it but it is not supported and we are quite vocal on that for ages. Tagging is just another nail to it, because you have little control over its behavior.

Given that it is used, despite us saying don't do that, we try to support it on a best effort basis, but I doubt that we will be able to spend time on trying to fix its behavior when you are in a nesting situation.

@FrankMittelbach FrankMittelbach added wontfix This will not be worked on works as designed something that was designed this way (though it might get enhancements) unsupport usage/syntax labels Feb 4, 2025
@alexanderperlis
Copy link
Author

I suspect people use $$ simply because nothing stops them (no error) and the output in many situations seems acceptable. The switchover to LaTeX2e+tagging, or to LaTeX3, could be an opportunity to actually ban use of $$ in the sense of changing the policy from “we try to support it on a best effort basis” to “we intentionally stop with an error as soon as we see it”. I imagine there is some subtle impossibility to catching $$ while still allowing $; otherwise, the same technique that could catch $$ to emit an error could presumably instead be used to make $$ just do whatever \[ does.

@davidcarlisle
Copy link
Member

I imagine there is some subtle impossibility to catching $$ while still allowing $; otherwise, the same technique that could catch $$ to emit an error could presumably instead be used to make $$ just do whatever [ does

yes basically redefining $$ at all is challenging in classic TeX. As you correctly observe, if it was easy to redefine it, rather than make an error, it would be possible to make it work in a supported way, but it is what it is.

@u-fischer
Copy link
Member

Hm, the problem is that \__math_tag_dollardollar_display_end: issues a \para_raw_end:. Shouldn't that be in a group so that it doesn't affect the list settings?

@FrankMittelbach
Copy link
Member

from “we try to support it on a best effort basis” to “we intentionally stop with an error as soon as we see it”.

The issue with that is that we like to try support for making existing documents accessible as painless as possible. Given that $$ is out there a lot, this would mean that rerunning, say arXiv.org documents automatically would fail a lot of them. In that case it would be better to accept some layout issues rather than failing them unconditionally. Of course, in the end we might be able to offer some compatibility switch so that all you have to do is setting that to make the run rough ... guess we have to see.

@FrankMittelbach
Copy link
Member

Hm, the problem is that \__math_tag_dollardollar_display_end: issues a \para_raw_end:. Shouldn't that be in a group so that it doesn't affect the list settings?

I think that warrants some further analysis, it might be as simple as that to cover even this situation. I'll therefore keep this open.

@FrankMittelbach FrankMittelbach added analyse something that needs further checking and perhaps code changes area: math area: lists and removed wontfix This will not be worked on labels Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyse something that needs further checking and perhaps code changes area: lists area: math unsupport usage/syntax works as designed something that was designed this way (though it might get enhancements)
Projects
None yet
Development

No branches or pull requests

4 participants