% \iffalse meta-comment
%
% Copyright (C) 2006, 2009, 2011, 2014 Heiko Oberdiek
% Copyright (C) 2014-2026
% The LaTeX Project and any individual authors listed elsewhere
% in this file.
%
% This file is part of the LaTeX base system.
% -------------------------------------------
%
% It may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
% of this license or (at your option) any later version.
% The latest version of this license is in
%    http://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX
% version 2008 or later.
%
% This file has the LPPL maintenance status "maintained".
%
% 2006/06/02 v1.0: First version.
% 2009/09/25 v1.1: \usepackage disabled.
% 2011/07/01 v1.2: Fixes.
% 2014/02/30 v1.3:
%  * Update for LaTeX 2014/05/01.
%  * Fix for anchor positions of issue titles.
% 2014/05/15 v1.4:
%  * Updates for ltnews21.tex.
% 2014/11/14 v1.4a:
%  * LaTeX Project version
% 2015/02/16 v1.4b:
%  * 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
% 2025/12/07 v1.4e:
%  * Add running header for individual issues with more than one page
% 2026/09/14 v1.4f:
%  % switch to lualatex and add tagging support.
% \fi
\DocumentMetadata{tagging=on,pdfstandard=ua-2,tagging-setup={math/setup=mathml-SE}}
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{ltnews.tex}%
  [2026/09/14 v1.4f Master file for ltnews*.tex (LaTeX Project)]

\providecommand*{\lastissue}{44}

\InputIfFileExists{ltnews-lastissue.cfg}{}{}


  \AtBeginDocument{%
    \hypersetup{%
      pdftitle={LaTeX News},%
      pdfsubject={Issues 1\textendash\lastissue},%
      pdfauthor={The LaTeX Project},%
      pdfcreator={LaTeX}%
    }%
  }%

\RequirePackage{hologo}
\RequirePackage{graphicx}

\documentclass{ltnews}
\usepackage{lua-unicode-math}
%\RequirePackage{luacolor} %later perhaps
\RequirePackage{url,csquotes}
% 1.4d (JLB) also load the titletoc package
\RequirePackage{titletoc}

% \small already robust so better not ...
%\expandafter
%\DeclareRobustCommand\expandafter*\expandafter\small\expandafter{\small}

\RequirePackage{hyperref}
\hypersetup{colorlinks}
\RequirePackage{bookmark}
\RequirePackage{multicol}
\RequirePackage{amsmath}

\makeatletter

\newcounter{issue}
\renewcommand*{\theissue}{%
  \ifnum\value{issue}<10 0\fi
  \number\value{issue}%
}


% page style for theindividual issues, activated after the TOC has finished

\newcommand\runningtitle{\@title\ --- \issuename~\@issue,
         \@month~\@year~(\LaTeX\ release \publicationdate)}

\newcommand\ps@issues{%
   \renewcommand{\@oddhead}{\hfill\runningtitle}%
   \renewcommand{\@evenhead}{\hfill\runningtitle}%
   \renewcommand{\@oddfoot}{\@indiciafont\@indicia\hfill --\thepage}%
   \renewcommand{\@evenfoot}{\@indiciafont\@indicia\hfill --\thepage}%
}

% show the page number on first page of issues:

\renewcommand{\ps@titlepage}{%
   \renewcommand{\@oddhead}{\hfill}%
   \renewcommand{\@evenhead}{\hfill}%
   \renewcommand{\@oddfoot}{\@indiciafont\@indicia\hfill --\thepage}%
   \renewcommand{\@evenfoot}{\@indiciafont\@indicia\hfill --\thepage}%
}

\newcommand*{\printissue}{%
  Issue %
  \texorpdfstring{\number\value{issue}}{\theissue}, %
  \texorpdfstring{\@month\space\@year\space(\publicationdate)}
    {\@year/\@julianmonthtonum{\@month}}%
}
\let\l@part\l@section
\let\l@section\l@subsection
\let\l@subsection\l@subsubsection
\let\l@subsubsection\l@paragraph
\let\l@paragraph\l@subparagraph

\newcommand*{\makefirsttitle}{%
  \twocolumn[{%
    \AssignTaggingSocketPlug{parbox/before}{noop}% 
    \AssignTaggingSocketPlug{parbox/after}{noop}%
    \UseTaggingSocket{title}{}{\UseTaggingSocket{para/off}%   
    \parbox[t][4\baselineskip]{\textwidth}{%
      \tagpdfsetup{para/flattened=true}%
      \@titlefont\@title, Issues 1--\lastissue%
    }}%
  }]%
}

% table of contents with underlined links
\iffalse % disable if option colorlinks is used
\@ifpackagelater{hyperref}{2006/06/01}{%
  \newcommand*{\saved@tableofcontents}{}%
  \let\saved@tableofcontents\tableofcontents
  \renewcommand*{\tableofcontents}{%
    \begingroup
      \hypersetup{pdfborderstyle={/S/U/W 1}}%
      \saved@tableofcontents
    \endgroup
  }%
}{}
\fi

% -- provide command introduced in new release
%    so this typesets with an old format
\DeclareTextCommandDefault\textcommabelow[1]
  {\hmode@bgroup\ooalign{\null#1\crcr\hidewidth\raise-.31ex
   \hbox{\check@mathfonts\fontsize\ssf@size\z@
   \math@fontsfalse\selectfont,}\hidewidth}\egroup}
\DeclareTextCommandDefault\textcommaabove[1]{%
    \hmode@bgroup
    \ooalign{%
      \hidewidth
      \raise.7ex\hbox{%
        \check@mathfonts\fontsize\ssf@size\z@\math@fontsfalse\selectfont`%
      }%
     \hidewidth\crcr
     \null#1\crcr
    }%
    \egroup
  }

%2026-09-13 Tagging support for \printcontents: Insert two sockets
\renewcommand\ttl@printlist[6][default]{%
  \begingroup
    \@ifundefined{c@ttl@#2@#1}%
      {\PackageError{titletoc}{No partial #2 named #1}%
          {You must start before a partial toc/list\MessageBreak
          with \string/startcontents/\string\startlist.}}{}%
    \edef\ttl@ptoc{#1@\arabic{ttl@#2@#1}}%
    \def\ttl@toctop{#4}%
    \c@tocdepth=#5\relax
    #6%
    \let\ttl@xcontentsline\contentsline
    \let\contentsline\ttl@gobblecontents
    \def\ttl@contentsline##1{%
      \ttl@providettll{#3}{##1}%
      \@ifundefined{l@#3##1}%
        {\ttl@xcontentsline{##1}}%
        {\ttl@xcontentsline{#3##1}}}%
    \makeatletter
    \UseTaggingSocket{toc/starttoc/before}{#2}%Tagging
    \@input{\jobname.\csname ttl@partial#2\endcsname}%
    \UseTaggingSocket{toc/starttoc/after}{#2}%Tagging
    \makeatother
    \@nobreakfalse
  \endgroup}

\ExplSyntaxOn
\newcommand \acro [1]
  { \textsc { \text_lowercase:n {#1} } }
\ExplSyntaxOff

\makeatother

\tagpdfsetup{role/new-tag=Issue/Art}
\begin{document}

%%% Title and Table of Contents

\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

% activate page style for the individual issues

\pagestyle{issues}

%%% Issues

\begingroup
  \makeatletter
  \renewcommand*{\usepackage}[2][]{%
    \begingroup
      \def\x{#1|#2}%
      \def\y{T1|fontenc}%
      \ifx\x\y
      \else
        \def\y{|url}%
        \ifx\x\y
        \else
          \def\y{|url,hologo}%
          \ifx\x\y
          \else
            \def\y{|csquotes}%
            \ifx\x\y
            \else
              \def\y{|graphicx}%
              \ifx\x\y
              \else
                \def\y{|multicol}%
                \ifx\x\y
                \else
                  \def\y{|color}%
                  \ifx\x\y                  
                  \else
                  \def\y{|amsmath}%
                  \ifx\x\y                  
                    \else
                      \def\y{|lua-unicode-math}%
                      \ifx\x\y    
                      \else              
                        \@latex@error{ltnews.tex: \string\usepackage[#1]{#2} found}\@ehc
                      \fi  
                    \fi
                  \fi
                \fi
              \fi
            \fi
          \fi
        \fi
      \fi
    \endgroup
  }%
  \renewcommand*{\documentclass}[2][]{%
    \setcounter{footnote}{0}%
    \gobbleopt
  }%
  \renewcommand\DocumentMetadata[1]{} %Tagging 2026-09-12
% 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][]{}%              %  individual issues
  \renewenvironment{document}{%
    \clearpage
% 1.4d (JLB) Normally |\ltn@tocend| should do nothing
    \let\ltn@tocend\relax
    \ifnum\@issue=20 %
      \addtocontents{toc}{%
        \protect\makeatletter
       }%
       \addtocontents{toc}{%
         \let\protect\saved@l@paragraph\protect\l@paragraph
       }%
       \addtocontents{toc}{%
         \let\protect\l@paragraph\protect\l@subsection
       }%
    \fi
    \ifnum\@issue >20\space
      \addtocontents{toc}{%
        \let\protect\l@paragraph\protect\saved@l@paragraph
      }%
      \def\toclevel@subsection{1}%
      \def\toclevel@subsubsection{2}%
      \renewcommand*{\tableofcontents}{%
        \section*{\contentsname}%
% 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]}
      }%
      %\renewcommand\tableofcontents{}% Tagging, TODO!!!
      \let\l@subsubsection\l@subsection
      \let\l@subsection\l@section
      \let\l@section\l@part
      \let\l@part\@gobbletwo
    \fi
    \def\twocolumn[{%
      \let\twocolumn\org@twocolumn
      \org@twocolumn[%
      {% because of optional argument of \twocolumn
        \pdfbookmark[0]{\printissue}{issue\theissue}%
      }%
      \begingroup
        \let\WriteBookmarks\relax
        \@firstofone{% inside opt. arg. of \twocolumn: protect "]"
          \renewcommand*{\Hy@writebookmark}[5]{}%
        }%
        \phantomsection
        \addcontentsline{toc}{part}{\printissue}%
      \endgroup
    }%
  }{%
% 1.4d (JLB) Adde |\ltn@tocend|
    \ltn@tocend
    \clearpage
  }%
  \makeatother  
  \loop
  \ifnum\value{issue}< \lastissue
    \stepcounter{issue}%
    \publicationday{01}%
    \UseTaggingSocket{sec/end}{-10}
    \UseTaggingSocket{struct/begin}{tag=Issue,title:e=Issue-\theissue}
    \input{ltnews\theissue}%
    \par % just in case ...    
    \UseTaggingSocket{sec/end}{-10}
    \UseTaggingSocket{struct/end}
  \repeat
  \stepcounter{issue}%
  \makeatletter
  \IfFileExists{ltnews\theissue}{%
    \@latex@error{\jobname.tex is out of date,\MessageBreak
      there is `ltnews\theissue.tex'%
    }\@ehc
  }{}%
  \makeatother
\endgroup

\end{document}
