summaryrefslogtreecommitdiff
path: root/macros/latex/base/ltmiscen.dtx
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-11-07 03:01:39 +0000
committerNorbert Preining <norbert@preining.info>2019-11-07 03:01:39 +0000
commit2e1d63b8ed8c6b7c6d206bfe9e2712797108e8bd (patch)
tree7ea198b043998590117b2730e9dec10327ef3da3 /macros/latex/base/ltmiscen.dtx
parent590fd8b560523cdaea19c59aea61e781138e87f8 (diff)
CTAN sync 201911070301
Diffstat (limited to 'macros/latex/base/ltmiscen.dtx')
-rw-r--r--macros/latex/base/ltmiscen.dtx42
1 files changed, 27 insertions, 15 deletions
diff --git a/macros/latex/base/ltmiscen.dtx b/macros/latex/base/ltmiscen.dtx
index 8cd6120751..2a88438dee 100644
--- a/macros/latex/base/ltmiscen.dtx
+++ b/macros/latex/base/ltmiscen.dtx
@@ -32,7 +32,7 @@
%<*driver>
% \fi
\ProvidesFile{ltmiscen.dtx}
- [2019/08/29 v1.1p LaTeX Kernel (Misc. Environments)]
+ [2019/10/25 v1.1q LaTeX Kernel (Misc. Environments)]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{ltmiscen.dtx}
@@ -370,17 +370,7 @@
% percent. The result is saved in \cs{@temptokena} for later use.
% \changes{v1.1n}{2018/09/26}{Sometimes mask the endline char when
% writing to files (github/73)}
-% \begin{macrocode}
-\begingroup
-\catcode`\%=12
-% \end{macrocode}
-% \texttt{latexrelease} will read this code in high-speed
-% mode in certain situations. During that it will only look for
-% \cs{if} tests but not actually execute the \cs{catcode} change
-% above. As a result it will drop anything after the |%| character
-% in the definition. Therefore the |\fi| needs to be on the next
-% line and we need locally another comment character to avoid
-% getting spaces into the definition---a weird problem :-)
+%
% \begin{macrocode}
\catcode`\^^A=9
\long\gdef\add@percent@to@temptokena
@@ -390,13 +380,33 @@
% the beginning, so that in case the tokenlist consists of a single brace
% group the braces aren't stripped. The |\expandafter| then expands
% this extra token away again.
+% \changes{v1.1q}{2019/10/25}{Allow unbalanced conditionals in \texttt{\#1} (gh/202)}
% \begin{macrocode}
- {\ifx!#2!\@temptokena\expandafter{#1}\else
- \@temptokena\expandafter{#1%^^A
+ {\ifx!#2!\expandafter\dont@add@percent@to@temptokena\else
+ \expandafter\do@add@percent@to@temptokena\fi{#1}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\long\def\dont@add@percent@to@temptokena#1{%
+ \@temptokena\expandafter{#1}}
+% \end{macrocode}
+% \texttt{latexrelease} will read this code in high-speed
+% mode in certain situations. During that it will only look for
+% \cs{if} tests but not actually execute the \cs{catcode} change
+% above. As a result it will drop anything after the |%| character
+% in the definition. Therefore the |\fi| needs to be on the next
+% line and we need locally another comment character to avoid
+% getting spaces into the definition---a weird problem :-)
+%
+% \begin{macrocode}
+\begingroup
+\catcode`\%=12
+\long\gdef\do@add@percent@to@temptokena#1{%
+ \@temptokena\expandafter{#1%^^A
% \end{macrocode}
% Can't be on the same line as the |%| --- see above.
% \begin{macrocode}
- }\fi}
+ }}
\endgroup
% \end{macrocode}
% \end{macro}
@@ -432,6 +442,8 @@
%<latexrelease> {\protected@file@percent}{Mask line endings}%
%<latexrelease>\let\protected@file@percent\@undefined
%<latexrelease>\let\add@percent@to@temptokena\@undefined
+%<latexrelease>\let\do@add@percent@to@temptokena\@undefined
+%<latexrelease>\let\dont@add@percent@to@temptokena\@undefined
%<latexrelease>\long\def\@writefile#1#2{%
%<latexrelease> \@ifundefined{tf@#1}\relax
%<latexrelease> {\@temptokena{#2}%