[latex3-commits] [git/LaTeX3-latex3-latex2e] fixcontentsline: add fourth argument to contentsline (55cdc60a)

Ulrike Fischer fischer at troubleshooting-tex.de
Wed Aug 12 23:15:20 CEST 2020


Repository : https://github.com/latex3/latex2e
On branch  : fixcontentsline
Link       : https://github.com/latex3/latex2e/commit/55cdc60a3d73756eb7968b21634797cf05b2222e

>---------------------------------------------------------------

commit 55cdc60a3d73756eb7968b21634797cf05b2222e
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Tue Jul 28 01:08:25 2020 +0200

    add fourth argument to contentsline


>---------------------------------------------------------------

55cdc60a3d73756eb7968b21634797cf05b2222e
 base/changes.txt      |  4 ++++
 base/doc/ltnews32.tex |  7 +++++++
 base/ltsect.dtx       | 23 ++++++++++++++++++-----
 3 files changed, 29 insertions(+), 5 deletions(-)

diff --git a/base/changes.txt b/base/changes.txt
index 1ef6f2cd..078d1d6e 100644
--- a/base/changes.txt
+++ b/base/changes.txt
@@ -5,6 +5,10 @@ It is provided for convenience only.  It therefore makes no claims to
 completeness or accuracy and it contains some references to files that
 are not part of the distribution.
 ================================================================================
+2020-07-28 Ulrike Fischer <Ulrike.Fischer at latex-project.org>
+
+	* ltsect.dtx:
+	added fourth argument to \contentsline in \addcontentsline
 
 2020-07-16  Frank Mittelbach  <Frank.Mittelbach at latex-project.org>
 
diff --git a/base/doc/ltnews32.tex b/base/doc/ltnews32.tex
index fdea39b6..6d6fa55d 100644
--- a/base/doc/ltnews32.tex
+++ b/base/doc/ltnews32.tex
@@ -594,6 +594,13 @@ protected glyph nodes which is not affected by font shaping.
 %
 \githubissue{165}
 
+\subsection{Added a fourth empty argument to \cs{contentsline}}
+
+\LaTeX's writes with the \cs{\addcontentsline} a \cs{contentsline} 
+command with three arguments to the  toc and similar files. 
+\pkg{hyperref} redefines \cs{addcontentsline} to write 
+a fourth argument. The change unifies the number of arguments. 
+
 
 
 \section{Changes to packages in the \pkg{graphics} category}
diff --git a/base/ltsect.dtx b/base/ltsect.dtx
index 9ccd042f..cbd6be5a 100644
--- a/base/ltsect.dtx
+++ b/base/ltsect.dtx
@@ -31,7 +31,7 @@
 %%% From File: ltsect.dtx
 %<*driver>
 % \fi
-\ProvidesFile{ltsect.dtx}[2019/08/27 v1.1d LaTeX Kernel (Sectioning)]
+\ProvidesFile{ltsect.dtx}[2019/08/27 v1.1e LaTeX Kernel (Sectioning)]
 % \iffalse
 \documentclass{ltxdoc}
 \GetFileInfo{ltsect.dtx}
@@ -776,20 +776,33 @@
 %                \cs{addcontentsline}.  ASAJ.}
 % \changes{v1.1c}{2018/09/26}{Sometimes mask the endline char when
 %    writing to files (github/73)}
+% \changes{v1.1e}{2020/10/01}{add a fourth argument to argument for
+%    hyperref compability}
 %    \begin{macrocode}
 %</2ekernel>
 %<*2ekernel|latexrelease>
+%<latexrelease>\IncludeInRelease{2020/10/01}%
+%<latexrelease>                 {\addcontentsline}{fourth argument}%
+\def\addcontentsline#1#2#3{%
+%    \end{macrocode}
+%    We add an empty brace pair at the end of \cs{contentsline}
+%    so that the number of argument is identical in documents
+%    with and without hyperref.
+%    \begin{macrocode}
+  \addtocontents{#1}{\protect\contentsline{#2}{#3}{\thepage}{}%
+                     \protected at file@percent}}
+%</2ekernel|latexrelease>
+%<latexrelease>\EndIncludeInRelease
 %<latexrelease>\IncludeInRelease{2018/12/01}%
 %<latexrelease>                 {\addcontentsline}{Mask line endings}%
-\def\addcontentsline#1#2#3{%
-  \addtocontents{#1}{\protect\contentsline{#2}{#3}{\thepage}%
+%<latexrelease> \def\addcontentsline#1#2#3{%
+%<latexrelease>  \addtocontents{#1}{\protect\contentsline{#2}{#3}{\thepage}%
 %    \end{macrocode}
 %    We add \cs{protected at file@percent} at the end which is turned inside
 %   \cs{@writefile} into a percent character to mask the newline after
 %   the closing argument brace.
 %    \begin{macrocode}
-                     \protected at file@percent}}
-%</2ekernel|latexrelease>
+%<latexrelease>            \protected at file@percent}}
 %<latexrelease>\EndIncludeInRelease
 %<latexrelease>\IncludeInRelease{0000/00/00}%
 %<latexrelease>                 {\addcontentsline}{Mask line endings}%





More information about the latex3-commits mailing list.