Debian Codegraph @

texmf-dist/doc/latex/base/ltnews.tex

raw
1 % \iffalse meta-comment
2 %
3 % Copyright (C) 2006, 2009, 2011, 2014 Heiko Oberdiek
4 % Copyright (C) 2014-2025
5 % The LaTeX Project and any individual authors listed elsewhere
6 % in this file.
7 %
8 % This file is part of the LaTeX base system.
9 % -------------------------------------------
10 %
11 % It may be distributed and/or modified under the
12 % conditions of the LaTeX Project Public License, either version 1.3c
13 % of this license or (at your option) any later version.
14 % The latest version of this license is in
15 % http://www.latex-project.org/lppl.txt
16 % and version 1.3c or later is part of all distributions of LaTeX
17 % version 2008 or later.
18 %
19 % This file has the LPPL maintenance status "maintained".
20 %
21 % 2006/06/02 v1.0: First version.
22 % 2009/09/25 v1.1: \usepackage disabled.
23 % 2011/07/01 v1.2: Fixes.
24 % 2014/02/30 v1.3:
25 % * Update for LaTeX 2014/05/01.
26 % * Fix for anchor positions of issue titles.
27 % 2014/05/15 v1.4:
28 % * Updates for ltnews21.tex.
29 % 2014/11/14 v1.4a:
30 % * LaTeX Project version
31 % 2015/02/16 v1.4b:
32 % * Fix TOC issue
33 % 2020/01/30 v1.4b:
34 % * Fix TOC issue more generally and add page numbers
35 % 2020/04/13 v1.4d:
36 % * Use titletoc for partial toc'sa in the separate issues
37 % \fi
38
39 \NeedsTeXFormat{LaTeX2e}
40 \ProvidesFile{ltnews.tex}%
41 [2022/06/10 v1.4e Master file for ltnews*.tex (LaTeX Project)]
42
43 \providecommand*{\lastissue}{42}
44
45 \InputIfFileExists{ltnews-lastissue.cfg}{}{}
46
47
48 \ifx\pdfoutput\undefined
49 \let\pdfoutput\outputmode
50 \protected\def\pdfinfo{\pdfextension info }
51 \fi
52
53 \RequirePackage{ifpdf}
54 \ifpdf
55 % overwrite nasty stuff of ltnews.cfg
56 % (use of hyperref for this would also support other drivers)
57 \pdfinfo{%
58 /Title(LaTeX News)%
59 /Subject(Issues 1--\lastissue)%
60 /Author(The LaTeX Project)%
61 /Creator(LaTeX)%
62 }
63 \newtoks\pdfinfo
64 \else
65 \AtBeginDocument{%
66 \hypersetup{%
67 pdftitle={LaTeX News},%
68 pdfsubject={Issues 1\textendash\lastissue},%
69 pdfauthor={The LaTeX Project},%
70 pdfcreator={LaTeX}%
71 }%
72 }%
73 \fi
74
75 \RequirePackage{lmodern}
76 \RequirePackage[T1]{fontenc}
77 \RequirePackage{hologo}
78 \RequirePackage{graphicx}
79
80 \documentclass{ltnews}
81
82 \RequirePackage{url,csquotes}
83 % 1.4d (JLB) also load the titletoc package
84 \RequirePackage{titletoc}
85
86 % \small already robust so better not ...
87 %\expandafter
88 %\DeclareRobustCommand\expandafter*\expandafter\small\expandafter{\small}
89
90 \RequirePackage{hyperref}
91 \hypersetup{colorlinks}
92 \RequirePackage{bookmark}
93 \RequirePackage{multicol}
94
95 \makeatletter
96 % 1.4d (JLB) Titletoc thinks \contentsline has three arguments
97 % but it has 4 in our case
98 \def\ttl@gobblecontents#1#2#3#4{\ignorespaces}
99
100 \newcounter{issue}
101 \renewcommand*{\theissue}{%
102 \ifnum\value{issue}<10 0\fi
103 \number\value{issue}%
104 }
105
106
107 % show the page number on first page of issues:
108
109 \renewcommand{\ps@titlepage}{%
110 \renewcommand{\@oddhead}{\hfill}%
111 \renewcommand{\@evenhead}{\hfill}%
112 \renewcommand{\@oddfoot}{\@indiciafont\@indicia\hfill --\thepage}%
113 \renewcommand{\@evenfoot}{\@indiciafont\@indicia\hfill --\thepage}%
114 }
115
116 \newcommand*{\printissue}{%
117 Issue %
118 \texorpdfstring{\number\value{issue}}{\theissue}, %
119 \texorpdfstring{\@month\space\@year\space(\publicationdate)}
120 {\@year/\@julianmonthtonum{\@month}}%
121 }
122 \let\l@part\l@section
123 \let\l@section\l@subsection
124 \let\l@subsection\l@subsubsection
125 \let\l@subsubsection\l@paragraph
126 \let\l@paragraph\l@subparagraph
127
128 \newcommand*{\makefirsttitle}{%
129 \twocolumn[{%
130 \parbox[t][4\baselineskip]{\textwidth}{%
131 \@titlefont\@title, Issues 1--\lastissue
132 }%
133 }]%
134 }
135
136 % table of contents with underlined links
137 \iffalse % disable if option colorlinks is used
138 \@ifpackagelater{hyperref}{2006/06/01}{%
139 \newcommand*{\saved@tableofcontents}{}%
140 \let\saved@tableofcontents\tableofcontents
141 \renewcommand*{\tableofcontents}{%
142 \begingroup
143 \hypersetup{pdfborderstyle={/S/U/W 1}}%
144 \saved@tableofcontents
145 \endgroup
146 }%
147 }{}
148 \fi
149
150 % -- provide command introduced in new release
151 % so this typesets with an old format
152 \DeclareTextCommandDefault\textcommabelow[1]
153 {\hmode@bgroup\ooalign{\null#1\crcr\hidewidth\raise-.31ex
154 \hbox{\check@mathfonts\fontsize\ssf@size\z@
155 \math@fontsfalse\selectfont,}\hidewidth}\egroup}
156 \DeclareTextCommandDefault\textcommaabove[1]{%
157 \hmode@bgroup
158 \ooalign{%
159 \hidewidth
160 \raise.7ex\hbox{%
161 \check@mathfonts\fontsize\ssf@size\z@\math@fontsfalse\selectfont`%
162 }%
163 \hidewidth\crcr
164 \null#1\crcr
165 }%
166 \egroup
167 }
168
169 \ExplSyntaxOn
170 \newcommand \acro [1]
171 { \textsc { \text_lowercase:n {#1} } }
172 \ExplSyntaxOff
173
174 \makeatother
175
176
177 \begin{document}
178
179 %%% Title and Table of Contents
180
181 \makefirsttitle
182 \pdfbookmark[0]{\contentsname}{toc}
183 % 1.4d(JLB) Now that titletoc is used we can limit the depth
184 % of the main toc
185 \setcounter{tocdepth}{2}
186 \tableofcontents
187 \clearpage
188
189 %%% Issues
190
191 \begingroup
192 \makeatletter
193 \renewcommand*{\usepackage}[2][]{%
194 \begingroup
195 \def\x{#1|#2}%
196 \def\y{T1|fontenc}%
197 \ifx\x\y
198 \else
199 \def\y{|lmodern,url}%
200 \ifx\x\y
201 \else
202 \def\y{|lmodern,url,hologo}%
203 \ifx\x\y
204 \else
205 \def\y{|csquotes}%
206 \ifx\x\y
207 \else
208 \def\y{|graphicx}%
209 \ifx\x\y
210 \else
211 \def\y{|multicol}%
212 \ifx\x\y
213 \else
214 \def\y{|color}%
215 \ifx\x\y
216 \else
217 \@latex@error{ltnews.tex: \string\usepackage[#1]{#2} found}\@ehc
218 \fi
219 \fi
220 \fi
221 \fi
222 \fi
223 \fi
224 \fi
225 \endgroup
226 }%
227 \renewcommand*{\documentclass}[2][]{%
228 \setcounter{footnote}{0}%
229 \gobbleopt
230 }%
231 % 1.4d (JLB) Removed the extra lines that were written to the toc-files
232 \newcommand*{\gobbleopt}[1][]{}%
233 \let\org@twocolumn\twocolumn
234 \renewcommand\NeedsTeXFormat[1]{\NeedsTeXFormatdate}% ignore that inside
235 \newcommand\NeedsTeXFormatdate[1][]{}% % individual issues
236 \renewenvironment{document}{%
237 \clearpage
238 % 1.4d (JLB) Normally |\ltn@tocend| should do nothing
239 \let\ltn@tocend\relax
240 \ifnum\@issue=20 %
241 \addtocontents{toc}{%
242 \protect\makeatletter
243 }%
244 \addtocontents{toc}{%
245 \let\protect\saved@l@paragraph\protect\l@paragraph
246 }%
247 \addtocontents{toc}{%
248 \let\protect\l@paragraph\protect\l@subsection
249 }%
250 \fi
251 \ifnum\@issue >20\space
252 \addtocontents{toc}{%
253 \let\protect\l@paragraph\protect\saved@l@paragraph
254 }%
255 \def\toclevel@subsection{1}%
256 \def\toclevel@subsubsection{2}%
257 \renewcommand*{\tableofcontents}{%
258 \section*{\contentsname}%
259 % 1.4d (JLB) Start the partial contents
260 \startcontents[Issue\theissue]
261 % 1.4d (JLB) Show it
262 \printcontents[Issue\theissue]{}{1}[3]{}
263 % 1.4d (JLB)and make sure that |\end{document}| stops it again.
264 \gdef\ltn@tocend{\stopcontents[Issue\theissue]}
265 }%
266 \let\l@subsubsection\l@subsection
267 \let\l@subsection\l@section
268 \let\l@section\l@part
269 \let\l@part\@gobbletwo
270 \fi
271 \def\twocolumn[{%
272 \let\twocolumn\org@twocolumn
273 \org@twocolumn[%
274 {% because of optional argument of \twocolumn
275 \pdfbookmark[0]{\printissue}{issue\theissue}%
276 }%
277 \begingroup
278 \let\WriteBookmarks\relax
279 \@firstofone{% inside opt. arg. of \twocolumn: protect "]"
280 \renewcommand*{\Hy@writebookmark}[5]{}%
281 }%
282 \phantomsection
283 \addcontentsline{toc}{part}{\printissue}%
284 \endgroup
285 }%
286 }{%
287 % 1.4d (JLB) Adde |\ltn@tocend|
288 \ltn@tocend
289 \clearpage
290 }%
291 \makeatother
292 \loop
293 \ifnum\value{issue}<\lastissue
294 \stepcounter{issue}%
295 \publicationday{01}%
296 \input{ltnews\theissue}%
297 \repeat
298 \stepcounter{issue}%
299 \makeatletter
300 \IfFileExists{ltnews\theissue}{%
301 \@latex@error{\jobname.tex is out of date,\MessageBreak
302 there is `ltnews\theissue.tex'%
303 }\@ehc
304 }{}%
305 \makeatother
306 \endgroup
307
308 \end{document}