[latex3-commits] [git/LaTeX3-latex3-latex2e] gh257: Use the titletoc package for partial tocs in the separate issues (ef4c3f36)

Johannes Braams texniek at braams.xs4all.nl
Mon Apr 13 16:25:29 CEST 2020


Repository : https://github.com/latex3/latex2e
On branch  : gh257
Link       : https://github.com/latex3/latex2e/commit/ef4c3f36c7215502ef72928f6e11868b923dcda4

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

commit ef4c3f36c7215502ef72928f6e11868b923dcda4
Author: Johannes Braams <texniek at braams.xs4all.nl>
Date:   Mon Apr 13 16:25:29 2020 +0200

    Use the titletoc package for partial tocs in the separate issues


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

ef4c3f36c7215502ef72928f6e11868b923dcda4
 base/doc/ltnews.tex | 36 ++++++++++++++++++++++--------------
 1 file changed, 22 insertions(+), 14 deletions(-)

diff --git a/base/doc/ltnews.tex b/base/doc/ltnews.tex
index c69054aa..1f2ff722 100644
--- a/base/doc/ltnews.tex
+++ b/base/doc/ltnews.tex
@@ -30,11 +30,13 @@
 %  * Fix TOC issue
 % 2020/01/30 v1.4b:
 %  * Fix TOC issue more generally and add page numbers
+% 2020/04/13 v1.4d:
+%  * Use titletoc for partial toc's
 % \fi
 
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesFile{ltnews.tex}%
-  [2020/01/30 v1.4c Master file for ltnews*.tex (LaTeX Project)]
+  [2020/04/13 v1.4d Master file for ltnews*.tex (LaTeX Project)]
 
 \providecommand*{\lastissue}{32}
 
@@ -73,10 +75,11 @@
 \RequirePackage{hologo}
 \RequirePackage{graphicx}
 
-
 \documentclass{ltnews}
 
 \RequirePackage{url,csquotes}
+% 1.4d (JLB) also load the titletoc package
+\RequirePackage{titletoc}
 
 % \small already robust so better not ...
 %\expandafter
@@ -88,6 +91,9 @@
 \RequirePackage{multicol}
 
 \makeatletter
+% 1.4d (JLB) Titletoc thinks \contentsline has three arguments
+%            but it has 4 in our case
+\def\ttl at gobblecontents#1#2#3#4{\ignorespaces}
 
 \newcounter{issue}
 \renewcommand*{\theissue}{%
@@ -178,6 +184,9 @@
 
 \makefirsttitle
 \pdfbookmark[0]{\contentsname}{toc}
+% 1.4d(JLB) Now that titletoc is used we can limit the depth
+%            of the main toc
+\setcounter{tocdepth}{2}
 \tableofcontents
 \clearpage
 
@@ -219,14 +228,16 @@
     \setcounter{footnote}{0}%
     \gobbleopt
   }%
+% 1.4d (JLB) Removed the extra lines that were written to the toc-files
   \newcommand*{\gobbleopt}[1][]{}%
   \let\org at twocolumn\twocolumn
   \renewcommand\NeedsTeXFormat[1]{\NeedsTeXFormatdate}%  ignore that inside
   \newcommand\NeedsTeXFormatdate[1][]{}%              %  inidividual issues
   \renewenvironment{document}{%
     \clearpage
+% 1.4d (JLB) Normally |\ltn at tocend| shoud do nothing
+    \let\ltn at tocend\relax
     \ifnum\@issue=20 %
-      \addtocontents{toc}{\protect\setcounter{tocdepth}{5}}%
       \addtocontents{toc}{%
         \protect\makeatletter
        }%
@@ -243,19 +254,14 @@
       }%
       \def\toclevel at subsection{1}%
       \def\toclevel at subsubsection{2}%
-      \addtocontents{toc}{\protect\setcounter{tocdepth}{4}}%
       \renewcommand*{\tableofcontents}{%
         \section*{\contentsname}%
-        \@starttoc{toc\theissue}%
-      }%
-      \let\saved at addtocontents\addtocontents
-      \renewcommand*{\addtocontents}[2]{%
-        \saved at addtocontents{##1}{##2}%
-        \def\temp at toc{toc}%
-        \def\temp at param{##1}%
-        \ifx\temp at toc\temp at param
-          \saved at addtocontents{toc\theissue}{##2}%
-        \fi
+% 1.4d (JLB) Start the partial contents
+        \startcontents[Issue\theissue]
+% 1.4d (JLB) Show it
+        \printcontents[Issue\theissue]{}{1}[3]{}
+% 1.4d (JLB)and make sure that |\end{document}| stops it again.
+        \gdef\ltn at tocend{\stopcontents[Issue\theissue]}
       }%
       \let\l at subsubsection\l at subsection
       \let\l at subsection\l at section
@@ -278,6 +284,8 @@
       \endgroup
     }%
   }{%
+% 1.4d (JLB) Adde |\ltn at tocend|
+    \ltn at tocend
     \clearpage
   }%
   \makeatother





More information about the latex3-commits mailing list.