latex3 / latex2e

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

\dots within \xrightarrow #263

Open tmelorc opened 4 years ago

tmelorc commented 4 years ago

Brief outline of the bug

It would be good to have \dots vertically aligned when surrounded by two \xrightarrow(s) like \to does.

Minimal example showing the bug

\RequirePackage{latexbug}       % <--should be always the first line (see CONTRIBUTING)!
\documentclass[11pt,a4paper]{report}
\usepackage{amsmath}
\begin{document}
\[ a\to \dots \to b \] \[ a\xrightarrow{f} \dots \xrightarrow{g} b \]
\end{document}

Log file (required) and possibly PDF file

This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019) (preloaded format=pdflatex 2020.2.4) 4 FEB 2020 11:17 entering extended mode restricted \write18 enabled. %&-line parsing enabled. **fastex-temp.tex (./fastex-temp.tex LaTeX2e <2020-02-02> L3 programming layer <2020-01-31> (/usr/local/texlive/2019/texmf-dist/tex/latex/latexbug/latexbug.sty Package: latexbug 2019/10/15 v1.0g Bug-classification ) (/usr/local/texlive/2019/texmf-dist/tex/latex/base/report.cls Document Class: report 2019/12/20 v1.4l Standard LaTeX document class (/usr/local/texlive/2019/texmf-dist/tex/latex/base/size11.clo File: size11.clo 2019/12/20 v1.4l Standard LaTeX file (size option) ) \c@part=\count167 \c@chapter=\count168 \c@section=\count169 \c@subsection=\count170 \c@subsubsection=\count171 \c@paragraph=\count172 \c@subparagraph=\count173 \c@figure=\count174 \c@table=\count175 \abovecaptionskip=\skip47 \belowcaptionskip=\skip48 \bibindent=\dimen134 ) (/usr/local/texlive/2019/texmf-dist/tex/latex/amsmath/amsmath.sty Package: amsmath 2020/01/20 v2.17e AMS math features \@mathmargin=\skip49

For additional information on amsmath, use the `?' option. (/usr/local/texlive/2019/texmf-dist/tex/latex/amsmath/amstext.sty Package: amstext 2000/06/29 v2.01 AMS text

(/usr/local/texlive/2019/texmf-dist/tex/latex/amsmath/amsgen.sty File: amsgen.sty 1999/11/30 v2.0 generic functions \@emptytoks=\toks14 \ex@=\dimen135 )) (/usr/local/texlive/2019/texmf-dist/tex/latex/amsmath/amsbsy.sty Package: amsbsy 1999/11/29 v1.2d Bold Symbols \pmbraise@=\dimen136 ) (/usr/local/texlive/2019/texmf-dist/tex/latex/amsmath/amsopn.sty Package: amsopn 2016/03/08 v2.02 operator names ) \inf@bad=\count176 LaTeX Info: Redefining \frac on input line 227. \uproot@=\count177 \leftroot@=\count178 LaTeX Info: Redefining \overline on input line 389. \classnum@=\count179 \DOTSCASE@=\count180 LaTeX Info: Redefining \ldots on input line 486. LaTeX Info: Redefining \dots on input line 489. LaTeX Info: Redefining \cdots on input line 610. \Mathstrutbox@=\box45 \strutbox@=\box46 \big@size=\dimen137 LaTeX Font Info: Redeclaring font encoding OML on input line 733. LaTeX Font Info: Redeclaring font encoding OMS on input line 734. \macc@depth=\count181 \c@MaxMatrixCols=\count182 \dotsspace@=\muskip16 \c@parentequation=\count183 \dspbrk@lvl=\count184 \tag@help=\toks15 \row@=\count185 \column@=\count186 \maxfields@=\count187 \andhelp@=\toks16 \eqnshift@=\dimen138 \alignsep@=\dimen139 \tagshift@=\dimen140 \tagwidth@=\dimen141 \totwidth@=\dimen142 \lineht@=\dimen143 \@envbody=\toks17 \multlinegap=\skip50 \multlinetaggap=\skip51 \mathdisplay@stack=\toks18 LaTeX Info: Redefining [ on input line 2859. LaTeX Info: Redefining ] on input line 2860. ) (/usr/local/texlive/2019/texmf-dist/tex/latex/l3backend/l3backend-pdfmode.def File: l3backend-pdfmode.def 2019-04-06 L3 backend support: PDF mode \l__kernel_color_stack_int=\count188 \l__pdf_internal_box=\box47 ) (./fastex-temp.aux) \openout1 = `fastex-temp.aux'.

LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 7. LaTeX Font Info: ... okay on input line 7. LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 7. LaTeX Font Info: ... okay on input line 7. LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 7. LaTeX Font Info: ... okay on input line 7. LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 7. LaTeX Font Info: ... okay on input line 7. LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 7. LaTeX Font Info: ... okay on input line 7. LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 7. LaTeX Font Info: ... okay on input line 7. LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 7. LaTeX Font Info: ... okay on input line 7. [1

{/usr/local/texlive/2019/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (./fast ex-temp.aux) ) Here is how much of TeX's memory you used: 1535 strings out of 481266 24130 string characters out of 5918959 253303 words of memory out of 5000000 16839 multiletter control sequences out of 15000+600000 535751 words of font info for 36 fonts, out of 8000000 for 9000 1141 hyphenation exceptions out of 8191 30i,11n,25p,223b,495s stack positions out of 5000i,500n,10000p,200000b,80000s </usr/local/texlive/2019/texmf-dist/fonts/type1/public/amsfonts/c m/cmmi10.pfb></usr/local/texlive/2019/texmf-dist/fonts/type1/public/amsfonts/cm /cmmi8.pfb></usr/local/texlive/2019/texmf-dist/fonts/type1/public/amsfonts/cm/c mr10.pfb></usr/local/texlive/2019/texmf-dist/fonts/type1/public/amsfonts/cm/cms y10.pfb> Output written on fastex-temp.pdf (1 page, 30696 bytes). PDF statistics: 24 PDF objects out of 1000 (max. 8388607) 16 compressed objects within 1 object stream 0 named destinations out of 1000 (max. 500000) 1 words of extra memory for PDF output out of 10000 (max. 10000000)

fastex-temp.pdf

FrankMittelbach commented 4 years ago

The amsmath manual says

For most situations, the undifferentiated \dots can be used, and amsmath will output the most suitable form based on the immediate context; if an inappropriate form results, it can be corrected after examining the output.

In other words for simple combinations it knows which kind of dots to use but there are simply too many possibilities to make that universally work. For that reason it offers \dotsb, \dotsc etc to help it along if the choice is not suitable. I'll mark this as a possible enhancement but in all honesty I doubt that we are going to make changes to that part of the amsmath code (any time soon).

tmelorc commented 4 years ago

Thanks for attention. What I have used is \cdots (which I believe is the same as \dotsc, at least visually).

FrankMittelbach commented 4 years ago

@tmelorc \cdots gives you "centered dots" ie a physical description while \dotsc gives you "comma dots = dots between commas" a logical description. So they are normally not identical. The amsmath idea is that the different logical types can have different house styles in journals so they can change their behavior:

For preferred placement of ellipsis dots (raised or on-line) in various contexts there is no general consensus. It may therefore be considered a matter of taste. By using the semantically oriented commands

• \dotsc for “dots with commas”

• \dotsb for “dots with binary operators/relations”

• \dotsm for “multiplication dots”

• \dotsi for “dots with integrals”

• \dotso for “other dots” (none of the above)

tmelorc commented 4 years ago

• \dotsc for “dots with commas”

Oh, c for 'commas', not 'center'. So I was completely wrong. Thanks again.

FrankMittelbach commented 4 years ago

as a general advice: texdoc <packagename> is usually a great resource

stale[bot] commented 4 years ago

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

eg9 commented 4 years ago

It could make sense to do

\edef\xrightarrow{\DOTSB\unexpanded\expandafter{\xrightarrow}}

after the definition of \xrightarrow. This would make the command to react to \dots just like all other relation symbols, but has the defect of making the macro “nonstandard” with respect to how macros with one optional argument are defined.

Passing the modified \xrightarrow to \protected@edef would produce

\DOTSB\protect\xrightarrow

which is not much different from what one gets when passing \sum, for instance, that produces

\DOTSB\sum@\slimits@
stale[bot] commented 4 years ago

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