Skip to content

Commit

Permalink
Merge pull request #616 from latex3/gh614
Browse files Browse the repository at this point in the history
Gh614
  • Loading branch information
FrankMittelbach committed Jul 14, 2021
2 parents 40a557f + 2fed69a commit 15d2bee
Show file tree
Hide file tree
Showing 5 changed files with 137 additions and 3 deletions.
14 changes: 14 additions & 0 deletions base/doc/ltnews34.tex
Expand Up @@ -222,6 +222,20 @@ \subsection{\pkg{varioref}: Improve missing label handling}
\sxissue{603948}


\subsection{\pkg{array}: Cancel \cs{mathsurround} for \env{tabular}}

A \env{tabular} environment is internally typeset as an \env{array}
environment with special settings and therefore in math mode. This
math group should not get any \cs{mathsuround} added as it isn't a
real formula because otherwise the spacing around the \env{tabular}
changes. This bug has been there forever (which means not many people
use \cs{mathsurround} or noticed the difference). Anyhow, this now got
fixed.
%
\githubissue{614}



\subsection{???}

%
Expand Down
8 changes: 5 additions & 3 deletions required/tools/array.dtx
Expand Up @@ -33,7 +33,7 @@
%<+package>\DeclareCurrentRelease{}{2020-10-01}
%<+package>
%<+package>\ProvidesPackage{array}
%<+package> [2021/04/20 v2.5e Tabular extension package (FMi)]
%<+package> [2021/07/12 v2.5f Tabular extension package (FMi)]
%
% \fi
%
Expand Down Expand Up @@ -2489,9 +2489,11 @@
% \begin{macro}{\endtabular*}
% To end a \textsf{tabular} or \textsf{tabular$*$} environment we
% call up =\endarray=, close the math mode and then the surrounding
% =\hbox=.
% =\hbox=. This math mode around the tabular should not be surrounded by
% any =\mathsurround= so we cancel that with =\m@th=.
% \changes{v2.5f}{2021/07/12}{Cancel any outside \cs{mathsurround} (gh/614)}
% \begin{macrocode}
\def\endtabular{\endarray $\egroup}
\def\endtabular{\endarray\m@th $\egroup}
\expandafter\let\csname endtabular*\endcsname=\endtabular
% \end{macrocode}
% \end{macro}
Expand Down
6 changes: 6 additions & 0 deletions required/tools/changes.txt
Expand Up @@ -5,6 +5,12 @@ completeness or accuracy and it contains some references to files that
are not part of the distribution.
=======================================================================

2021-07-12 Frank Mittelbach <Frank.Mittelbach@latex-project.org>

* array.dtx (section{The Environment Definitions}):
Cancel any outside \mathsurround on the outside of tabular which is
internally execuded in math mode (gh/614)

2021-07-07 Frank Mittelbach <Frank.Mittelbach@latex-project.org>

* varioref.dtx (subsubsection{Supporting ranges}):
Expand Down
21 changes: 21 additions & 0 deletions required/tools/testfiles/github-0614.lvt
@@ -0,0 +1,21 @@
% https://tex.stackexchange.com/q/604536/1090

\documentclass{article}

\input{test2e}

\mathsurround=50pt % Exaggerated value to visualize the effect

\usepackage{array}

\showoutput

\begin{document}

\START

Bla bla $x=0$ bla bla.

X\begin{tabular}{|c|}A$x$A\end{tabular}X

\end{document}
91 changes: 91 additions & 0 deletions required/tools/testfiles/github-0614.tlg
@@ -0,0 +1,91 @@
This is a generated file for the LaTeX2e validation system.
Don't change this file in any respect.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <7> on input line ....
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <5> on input line ....
Completed box being shipped out [1]
\vbox(633.0+0.0)x407.0
.\glue 16.0
.\vbox(617.0+0.0)x345.0, shifted 62.0
..\vbox(12.0+0.0)x345.0, glue set 12.0fil
...\glue 0.0 plus 1.0fil
...\hbox(0.0+0.0)x345.0
....\hbox(0.0+0.0)x345.0
..\glue 25.0
..\glue(\lineskip) 0.0
..\vbox(550.0+0.0)x345.0, glue set 527.9436fil
...\write-{}
...\glue(\topskip) 3.05556
...\hbox(6.94444+0.0)x345.0, glue set 134.97911fil
....\hbox(0.0+0.0)x15.0
....\OT1/cmr/m/n/10 B
....\OT1/cmr/m/n/10 l
....\OT1/cmr/m/n/10 a
....\glue 3.33333 plus 1.66666 minus 1.11111
....\OT1/cmr/m/n/10 b
....\OT1/cmr/m/n/10 l
....\OT1/cmr/m/n/10 a
....\glue 3.33333 plus 1.66666 minus 1.11111
....\mathon, surrounded 50.0
....\OML/cmm/m/it/10 x
....\glue(\thickmuskip) 2.77771 plus 2.77771
....\OT1/cmr/m/n/10 =
....\penalty 500
....\glue(\thickmuskip) 2.77771 plus 2.77771
....\OT1/cmr/m/n/10 0
....\mathoff, surrounded 50.0
....\glue 3.33333 plus 1.66666 minus 1.11111
....\OT1/cmr/m/n/10 b
....\OT1/cmr/m/n/10 l
....\OT1/cmr/m/n/10 a
....\glue 3.33333 plus 1.66666 minus 1.11111
....\OT1/cmr/m/n/10 b
....\OT1/cmr/m/n/10 l
....\OT1/cmr/m/n/10 a
....\OT1/cmr/m/n/10 .
....\penalty 10000
....\glue(\parfillskip) 0.0 plus 1.0fil
....\glue(\rightskip) 0.0
...\glue(\parskip) 0.0 plus 1.0
...\glue(\parskip) 0.0
...\glue(\baselineskip) 3.5
...\hbox(8.5+3.5)x345.0, glue set 281.48466fil
....\hbox(0.0+0.0)x15.0
....\OT1/cmr/m/n/10 X
....\hbox(8.5+3.5)x33.5153
.....\mathon
.....\vbox(8.5+3.5)x33.5153
......\hbox(8.39996+3.60004)x33.5153
.......\glue(\tabskip) 0.0
.......\hbox(8.39996+3.60004)x33.5153
........\rule(8.39996+3.60004)x0.0
........\rule(*+*)x0.4
........\glue 6.0
........\glue 0.0 plus 1.0fil
........\glue 0.00002
........\OT1/cmr/m/n/10 A
........\mathon
........\OML/cmm/m/it/10 x
........\mathoff
........\OT1/cmr/m/n/10 A
........\glue 0.0 plus 1.0fil
........\glue 6.0
........\rule(*+*)x0.4
.......\glue(\tabskip) 0.0
.....\mathoff
....\OT1/cmr/m/n/10 X
....\penalty 10000
....\glue(\parfillskip) 0.0 plus 1.0fil
....\glue(\rightskip) 0.0
...\glue -3.5
...\glue 0.0 plus 1.0fil
...\glue 0.0
...\glue 0.0 plus 0.0001fil
..\glue(\baselineskip) 23.55556
..\hbox(6.44444+0.0)x345.0
...\hbox(6.44444+0.0)x345.0, glue set 170.0fil
....\glue 0.0 plus 1.0fil
....\OT1/cmr/m/n/10 1
....\glue 0.0 plus 1.0fil
(github-0614.aux)

0 comments on commit 15d2bee

Please sign in to comment.