latex3 / latex2e

The LaTeX2e kernel
https://www.latex-project.org/
LaTeX Project Public License v1.3c
1.93k stars 266 forks source link

\overrightarrow and \overleftarrow paragraph start + documentation #1342

Closed kberry closed 1 week ago

kberry commented 6 months ago

\overrightarrow and \overleftarrow are defined in fontdef.dtx starting with \vbox. Should they start with your equivalent of \leavevmode so that \overrightarrow{x} \overleftarrow{y} doesn't come out on two separate lines?

Alternatively, maybe they should start with {\mathop... like \overbrace and \underbrace? That would also have the advantage of giving an error when not used in math mode, like {over,under}brace and {over,under}line.

Also, I don't see \over{right,left}arrow in the documentation. I just grepped for over.*arrow in doc/latex/base/, so maybe that's not enough.

Trivial doc with all these commands for comparison follows. Thanks.

\documentclass{article}
\begin{document}\thispagestyle{empty}
\overrightarrow{e^\pi} \overleftarrow{x\pm2} % comes out as two paragraphs

$\overline{\sqrt{2}}$ $\underline{x\pm2}$

$\overbrace{\sqrt{2}}$ $\underbrace{x\pm2}$
\end{document}
car222222 commented 5 months ago

Yes, so it seems that this, and a few similar such “dangerous box” leftovers (from plain) do need some action: either fixing, or perhaps removing from “basic LaTeX math”?

But note that these two “over arrow constructs” are not dangerous in amsmath — The continued presence of such problematic constructs from plain is one of the many reasons why we have moved to recommending firmly that: if you require anything beyond the most trivial mathmode stuff, then use amsmath!

Thanks for pointing this out to us, and apologies for the delayed response.

FrankMittelbach commented 4 months ago

Looking at this again, I think there is nothing really that should be changed or improved. As far as I can tell the macros have been supposed to work outside of math, they just happen to do to a certain extend in the plain TeX version, but with the caveat that they do not start a paragraph and also with an odd syntax as the argument is processed as math.

With amsmath, however, they are required to be inside math (as they should) and generate an error.

Now we could force the amsmath behavior but all that would do now is to break old documents that misused the "feature", or we could add \leavevmodebut that would look as if we endorse the usage in text, and I really do think we do, given that one day a form of amsmath may just be autoloaded into the kernel.

So m conclusion is to do nothing and leave it for the time being as a slight oddity.

FrankMittelbach commented 4 months ago

As far as I can tell the macros have been supposed to work outside of math

a negation missing ... have not been supposed ... is what I wanted to write

kberry commented 4 months ago

ok. how about at least documenting their existence in base latex?

FrankMittelbach commented 4 months ago

documenting what Karl? point is eventually the usage in text will break, i.e., the moment amsmath is loaded or the moment accessibility comes into play, so I could now write, don't do this, but who is going to read this in the sources?

kberry commented 4 months ago

their existence for math. not text.

FrankMittelbach commented 4 months ago

I'm a bit lost, why those and not all the others? None of these kind of math constructions are documented in sourc2e other than by their definition (section 6-4-10) and nobody would look for them there I would think. The are documented in the LaTeX Companion though (3rd ed on page II-183, but also in earlier editions). Maybe also in Lamport already, but I'm too lazy to run upstairs now to check.

kberry commented 4 months ago

I was thinking usrguide, on the premise that all public macros should be mentioned in the public documentation. But, looking for various other macros, I guess that is not a goal. Closing.

github-actions[bot] commented 2 months ago

This issue has been automatically marked as stale because it has not had recent activity.