From 745892fbddea56040139108277e728b53fd8fc11 Mon Sep 17 00:00:00 2001
From: Norbert Preining <norbert@preining.info>
Date: Thu, 28 May 2020 03:03:21 +0000
Subject: CTAN sync 202005280303

---
 macros/latex-dev/base/ltnews.tex | 36 ++++++++++++++++++++++--------------
 1 file changed, 22 insertions(+), 14 deletions(-)

(limited to 'macros/latex-dev/base/ltnews.tex')

diff --git a/macros/latex-dev/base/ltnews.tex b/macros/latex-dev/base/ltnews.tex
index c69054aa82..ffc34da26c 100644
--- a/macros/latex-dev/base/ltnews.tex
+++ b/macros/latex-dev/base/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'sa in the separate issues
 % \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@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@twocolumn\twocolumn
   \renewcommand\NeedsTeXFormat[1]{\NeedsTeXFormatdate}%  ignore that inside
   \newcommand\NeedsTeXFormatdate[1][]{}%              %  inidividual issues
   \renewenvironment{document}{%
     \clearpage
+% 1.4d (JLB) Normally |\ltn@tocend| shoud do nothing
+    \let\ltn@tocend\relax
     \ifnum\@issue=20 %
-      \addtocontents{toc}{\protect\setcounter{tocdepth}{5}}%
       \addtocontents{toc}{%
         \protect\makeatletter
        }%
@@ -243,19 +254,14 @@
       }%
       \def\toclevel@subsection{1}%
       \def\toclevel@subsubsection{2}%
-      \addtocontents{toc}{\protect\setcounter{tocdepth}{4}}%
       \renewcommand*{\tableofcontents}{%
         \section*{\contentsname}%
-        \@starttoc{toc\theissue}%
-      }%
-      \let\saved@addtocontents\addtocontents
-      \renewcommand*{\addtocontents}[2]{%
-        \saved@addtocontents{##1}{##2}%
-        \def\temp@toc{toc}%
-        \def\temp@param{##1}%
-        \ifx\temp@toc\temp@param
-          \saved@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@tocend{\stopcontents[Issue\theissue]}
       }%
       \let\l@subsubsection\l@subsection
       \let\l@subsection\l@section
@@ -278,6 +284,8 @@
       \endgroup
     }%
   }{%
+% 1.4d (JLB) Adde |\ltn@tocend|
+    \ltn@tocend
     \clearpage
   }%
   \makeatother
-- 
cgit v1.2.3

