Skip to content

Commit

Permalink
fix for #49 and #50
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankMittelbach committed Oct 9, 2018
1 parent 69dea57 commit 3c0d614
Show file tree
Hide file tree
Showing 6 changed files with 3,144 additions and 3 deletions.
55 changes: 52 additions & 3 deletions required/amsmath/amsmath.dtx
Expand Up @@ -2,7 +2,7 @@
% \iffalse meta-comment
%
% Copyright 1995, 2000, 2013 American Mathematical Society.
% Copyright 2016-2017 LaTeX3 Project and American Mathematical Society.
% Copyright 2016-2018 LaTeX3 Project and American Mathematical Society.
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
Expand Down Expand Up @@ -74,7 +74,19 @@ Bug reports can be opened (category \texttt{#1}) at\\%
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}% LaTeX 2.09 can't be used (nor non-LaTeX)
[1994/12/01]% LaTeX date must be December 1994 or later
\ProvidesPackage{amsmath}[2017/09/02 v2.17a AMS math features]
% \end{macrocode}
%
% Not yet used but for the future \ldots
% \begin{macrocode}
%\providecommand\DeclareRelease[3]{}
%\providecommand\DeclareCurrentRelease[2]{}
%
%\DeclareRelease{}{2017-09-02}{amsmath-2017-09-02.sty}
%\DeclareCurrentRelease{}{2018-12-01}
% \end{macrocode}
%
% \begin{macrocode}
\ProvidesPackage{amsmath}[2018/12/01 v2.17b AMS math features]
% \end{macrocode}
%
% \section{Catcode defenses}
Expand Down Expand Up @@ -405,9 +417,18 @@ For additional information on amsmath, use the \lq ?\rq\space option.%
% mathstyle, and the result is left in the box named by the first
% arg. It is assumed that we are already in math mode, so we can turn
% off |\everymath| (in particular, |\check@mathfonts|).
%
% As of 2018/12 release we don't turn off |\evermath| as this
% optimization can be harmful.
% \changes{v2.17b}{2018/12/01}{Don't drop \cs{frozen@everymath}}
% \begin{macrocode}
\ifx\leavevmode@ifvmode\@undefined % kernel is < 2018/12
\def\@mathmeasure#1#2#3{\setbox#1\hbox{\frozen@everymath\@emptytoks
\m@th$#2#3$}}
\else
\def\@mathmeasure#1#2#3{\setbox#1\hbox{%
\m@th$#2#3$}}
\fi
% \end{macrocode}
% \end{macro}
%
Expand Down Expand Up @@ -440,9 +461,16 @@ For additional information on amsmath, use the \lq ?\rq\space option.%
% them. The standard \cs{relax} before the \cs{ifmmode} is not
% necessary because of the \cs{protect} added by
% \cs{DeclareRobustCommand}.
% \changes{v2.17b}{2018/12/01}{Start LR-mode for \cs{thinspace} and
% friends if necessary (github/49)}
% \begin{macrocode}
\ifx\leavevmode@ifvmode\@undefined
\DeclareRobustCommand{\tmspace}[3]{%
\ifmmode\mskip#1#2\else\kern#1#3\fi\relax}
\else
\DeclareRobustCommand{\tmspace}[3]{%
\ifmmode\mskip#1#2\else\leavevmode@ifvmode\kern#1#3\fi\relax}
\fi
\renewcommand{\,}{\tmspace+\thinmuskip{.1667em}}
\let\thinspace\,
\renewcommand{\!}{\tmspace-\thinmuskip{.1667em}}
Expand Down Expand Up @@ -1538,7 +1566,10 @@ Foreign command \@backslashchar#1;\MessageBreak
% \begin{macro}{\bBigg@}
% Now we tackle the macro which has to do the real work. It
% actually has two arguments, the factor and the wanted delimiter.
% \changes{v2.17b}{2018/12/01}{Start LR-mode for \cs{bigl} and
% friends if necessary (github/49)}
% \begin{macrocode}
\ifx\leavevmode@ifvmode\@undefined
\def\bBigg@#1#2{%
% \end{macrocode}
% We start with an extra set of braces because we want
Expand All @@ -1548,6 +1579,12 @@ Foreign command \@backslashchar#1;\MessageBreak
{\@mathmeasure\z@{\nulldelimiterspace\z@}%
{\left#2\vcenter to#1\big@size{}\right.}%
\box\z@}}
\else
\def\bBigg@#1#2{\leavevmode@ifvmode
{\@mathmeasure\z@{\nulldelimiterspace\z@}%
{\left#2\vcenter to#1\big@size{}\right.}%
\box\z@}}
\fi
% \end{macrocode}
% \end{macro}
%
Expand Down Expand Up @@ -2072,14 +2109,26 @@ Foreign command \@backslashchar#1;\MessageBreak
% \begin{macro}{\smash}
% We add to the \cn{smash} command an optional argument
% denoting the part of the formula to be smashed.
% \changes{v2.17b}{2018/12/01}{Start LR-mode for \cs{smash}
% if necessary (github/49)}
% \begin{macrocode}
\ifx\leavevmode@ifvmode\@undefined
\renewcommand{\smash}[1][tb]{%
\def\mb@t{\ht}\def\mb@b{\dp}\def\mb@tb{\ht\z@\z@\dp}%
\edef\finsm@sh{\csname mb@#1\endcsname\z@\z@ \box\z@}%
\edef\finsm@sh{\csname mb@#1\endcsname\z@\z@\box\z@}%
\ifmmode \@xp\mathpalette\@xp\mathsm@sh
\else \@xp\makesm@sh
\fi
}
\else
\renewcommand{\smash}[1][tb]{%
\def\mb@t{\ht}\def\mb@b{\dp}\def\mb@tb{\ht\z@\z@\dp}%
\edef\finsm@sh{\csname mb@#1\endcsname\z@\z@ \leavevmode@ifvmode\box\z@}%
\ifmmode \@xp\mathpalette\@xp\mathsm@sh
\else \@xp\makesm@sh
\fi
}
\fi
% \end{macrocode}
% \end{macro}
%
Expand Down
8 changes: 8 additions & 0 deletions required/amsmath/changes.txt
@@ -1,3 +1,11 @@
2018-10-09 Frank Mittelbach <Frank.Mittelbach@latex-project.org>

* amsmath.dtx
Don't drop \frozen@everymath
Start LR-mode for \thinspace and friends if necessary (github/49)
Start LR-mode for \bigl and friends if necessary (github/49)
Start LR-mode for \smash if necessary (github/49)

2017-09-02 David Carlisle <latex-bugs@latex-project.org>

* amsmath.dtx: ensure that overfull alignments give warnings in more cases
Expand Down
116 changes: 116 additions & 0 deletions required/amsmath/testfiles/github-amsmath-0049.lvt
@@ -0,0 +1,116 @@
% test for git #49

\documentclass{article}

\usepackage{amsmath}

\input{test2e}

\showoutput

\begin{document}

\START

\section{smash}

A test sentence.

\smash{A smash}

Another test sentence.

\smash{A second smash} at the start and \smash{in the middle} of a paragraph.


\section{phantom}

A test sentence.

\phantom{A phantom}

Another test sentence.

\phantom{A second phantom} at the start and \phantom{in the middle} of a paragraph.


\section{hphantom}

A test sentence.

\hphantom{A hphantom}

Another test sentence.

\hphantom{A second hphantom} at the start and \hphantom{in the middle} of a paragraph.


\section{vphantom}

A test sentence.

\vphantom{A vphantom}

Another test sentence.

\vphantom{A second vphantom} at the start and \vphantom{in the middle} of a paragraph.

\section{big(}

A test sentence.


\big(

Another test sentence.

\big(A big ( at the start and \big) in the middle of a paragraph.

And $\big( a\big) \neq (a)$ in math.

And also $x^\big)$

\newpage

\section{thinspace}

A test sentence.

\,\,\,\,\,

Another test sentence.

\,\,\,\,\,A few at the start and \,\,\,\,\, in the middle of a paragraph.


\section{negthinspace}

A test sentence.

\negthinspace\negthinspace\negthinspace\negthinspace\negthinspace

Another test sentence.

\negthinspace\negthinspace\negthinspace\negthinspace\negthinspace A few at the start and \negthinspace\negthinspace\negthinspace\negthinspace\negthinspace in the middle of a paragraph.

\section{enspace and the like}

A test sentence.

\enspace

Another test sentence.

\enspace A few at the start and \enspace in the middle of a paragraph.

Now the same with a quad:

\quad

Another test sentence.

\quad A few at the start and \quad in the middle of a paragraph.


\end{document}

0 comments on commit 3c0d614

Please sign in to comment.