summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/tugboat/tugboat.dtx
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-07-05 03:01:54 +0000
committerNorbert Preining <norbert@preining.info>2023-07-05 03:01:54 +0000
commit973c785dccc1812d63162178e8362e83e8c263c2 (patch)
treeb2cb12a6b36a0a59e90f1611d32cf7e8d125d575 /macros/latex/contrib/tugboat/tugboat.dtx
parentab7f5e4df027c13f5aef4fbdb032184cf2f3d5c3 (diff)
CTAN sync 202307050301
Diffstat (limited to 'macros/latex/contrib/tugboat/tugboat.dtx')
-rw-r--r--macros/latex/contrib/tugboat/tugboat.dtx191
1 files changed, 134 insertions, 57 deletions
diff --git a/macros/latex/contrib/tugboat/tugboat.dtx b/macros/latex/contrib/tugboat/tugboat.dtx
index ea7f22af77..a4b558b158 100644
--- a/macros/latex/contrib/tugboat/tugboat.dtx
+++ b/macros/latex/contrib/tugboat/tugboat.dtx
@@ -1,5 +1,5 @@
% \iffalse (this is a meta-comment (so they say))
-% $Id: tugboat.dtx 462 2023-03-08 17:26:54Z karl $
+% $Id: tugboat.dtx 490 2023-07-03 22:27:49Z karl $
% tugboat.dtx - main source for LaTeX TUGboat classes.
%
% Copyright 1994-2023 TeX Users Group.
@@ -28,7 +28,7 @@
%<ltugboatsty>\ProvidesPackage{ltugboat}
%<ltugprocsty>\ProvidesPackage{ltugproc}
%<ltugcomn> \ProvidesPackage{ltugcomn}
- [2023-03-08 v2.29
+ [2023-07-03 v2.30
%<ltugboatcls> TUGboat journal class%
%<ltugproccls> TUG conference proceedings class%
%<ltugboatsty|ltugprocsty> TUG compatibility package%
@@ -318,19 +318,13 @@
% Class options: |draft| vs.\ |preprint| vs.\ |final|.
%
% \begin{macrocode}
-\DeclareOption{draft}{%
+\DeclareOption{draft}{% [draft], the default
+ % If the user loads hyperref, avoid passing on the global draft option
+ % (which would remove all links in the pdf).
+ \PassOptionsToPackage{final}{hyperref}
+ %
\AtEndOfClass{%
\setcounter{page}{901}%
- %
- % Put a question mark into the page number in draft mode.
- \let\tuborigthepage = \thepage
- \def\thepage{%
- \ifnum\value{page}>900
- \textsl{?\texorpdfstring{\,}{}\@arabic{\numexpr\the\c@page-900\relax}}%
- \else
- \arabic{page}%
- \fi}%
- %
\BlackBoxes
\def\MakeRegistrationMarks{}%
\PrelimDrafttrue
@@ -338,22 +332,21 @@
}
\newif\ifpreprint
-\def\preprint{\preprinttrue}
+\def\preprint{\preprinttrue} % [preprint], hardly used
\DeclareOption{preprint}{%
\preprinttrue
}
-\newif\iftubfinaloption % [final]
+\newif\iftubfinaloption % [final], manually inserted by us for processing
\DeclareOption{final}{%
\tubfinaloptiontrue
\AtEndOfClass{%
- \let\thepage=\tuborigthepage
- \NoBlackBoxes
% Insert draft date into the header even with [final], if we are not
% doing a production run. (tugboat.dates sets up page numbers
% above 900 in such pseudo-draft mode.) We use [final] in the first
- % place for this case because draft can change page layout, wrt
- % registration marks, etc.
+ % place for this case because draft vs. final can change page
+ % layout, wrt registration marks, etc. (Not good, but too painful to
+ % change at this late date.)
\ifnum\value{page}>900 \PrelimDrafttrue \else \PrelimDraftfalse \fi
\@tubrunningfull
}%
@@ -377,7 +370,7 @@
\pdfstringdefDisableCommands{%
\let\acro\relax
\let\origDash=\Dash \def\Dash{\texorpdfstring{\origDash}{--}}%
- % lots more could be added.
+ % lots more could/should be added.
}%
\fi
}
@@ -480,10 +473,15 @@
% Occasionally, we need to start an article in the second column of a
% page, due to splicing with a previous article. Let's try declaring that.
% Then, before |\maketitle|, we'll force the move to the second column.
+%
+% And sometimes we need to add space at the top of that second column
+% (e.g., |tb136lettre|); there's no way to intervene in the article
+% source, so define a hook |\tubsecondcolstartextra|.
%
% \begin{macrocode}
-\newif\iftubsecondcolstart
+\newif\iftubsecondcolstart
\DeclareOption{secondcolstart}{\tubsecondcolstarttrue}
+\let\tubsecondcolstartextra\relax
% \end{macrocode}
% \end{macro}
%
@@ -683,7 +681,8 @@
%
% Font used for the METAFONT logo, etc.
% \begin{macrocode}
-\DeclareRobustCommand{\AllTeX}{(\La\kern-.075em)\kern-.075em\TeX}
+\DeclareRobustCommand{\AllTeX}{%
+ \texorpdfstring{(\La\kern-.075em)\kern-.075em\TeX}{(La)TeX}}
\def\AMS{American Mathematical Society}
\def\AmS{$\mathcal{A}$\kern-.1667em\lower.5ex\hbox
{$\mathcal{M}$}\kern-.125em$\mathcal{S}$}
@@ -876,7 +875,7 @@
\def\TANGLE{\texttt{TANGLE}\@}
\def\TB{\textsl{The \TeX\-book}}
\def\TIFF{\acro{TIFF}}
-\def\TP{\textsl{\TeX}:\ \textsl{The Program}}
+\def\TP{\textsl{\TeX:\ The Program\/}}
\DeclareRobustCommand{\TeX}{T\kern-.1667em\lower.424ex\hbox{E}\kern-.125emX\@}
\def\TeXhax{\TeX hax}
\def\TeXMaG{\TeX M\kern-.1667em\lower.5ex\hbox{A}%
@@ -927,6 +926,7 @@
\def\VorTeX{V\kern-2.7\p@\lower.5ex\hbox{O\kern-1.4\p@ R}\kern-2.6\p@\TeX}
\def\XeT{X\kern-.125em\lower.424ex\hbox{E}\kern-.1667emT\@}
\def\XML{\acro{XML}}
+\def\XMP{\acro{XMP}}
\def\WEB{\texttt{WEB}\@}
\def\WEAVE{\texttt{WEAVE}\@}
\def\WYSIWYG{\acro{WYSIWYG}}
@@ -1012,11 +1012,12 @@
% ellipsis character (U+2026) a single character's width, typically more
% squashed together than three period characters. This just looks wrong.
% It is too painful to try to redefine in general, but provide the
-% normal definition for \cs{let} in individual papers.
-\DeclareRobustCommand{\tubdots}{%
+% normal definition to reset in individual papers with, e.g.:
+% |\ifx\tubdots\undefined \else \let\dots\tubdots \let\ldots\tubdots \fi|
+\DeclareRobustCommand{\tubdots}{\ifmmode\mathellipsis\else
.\kern\fontdimen3\font
.\kern\fontdimen3\font
- .\kern\fontdimen3\font}
+ .\kern\fontdimen3\font\fi}
%
% \begin{macro}{\allowhyphens}
% Hyphen control: first, we save (via \cs{edef}) the hyphenpenalties in
@@ -1216,7 +1217,7 @@
%
% \subsection{Assorted user-level markup}
%
-% \LaTeXe{} defines a robust \cs{,}, but that we provide a new definition
+% \LaTeXe{} defines a robust \cs{,} we provide a new definition
% of |~| by redefining \cs{\nobreakspace} (\cs{DeclareRobustCommand}
% doesn't mind redefinition, fortunately). This is based on the version
% in AMS-\TeX---the \LaTeXe{} version (|ltspace.dtx|) has \cs{leavevmode}
@@ -2281,8 +2282,7 @@
% more full columns,
% above the top of an article to leave space to paste up a previous
% article that has finished on the same page. This is a fall back to
-% accommodate the fact that multiple articles cannot yet be run together
-% easily with \LaTeXe.
+% accommodate the fact that multiple articles cannot be run together % easily.
%
% In addition, if the |secondcolstart| option was specified, do
% |\null\newpage| to move over. This is separate from |\PreTitleDrop|,
@@ -2295,16 +2295,16 @@
{\@articletitletrue\@r@maketitle}%
}
\def\@r@maketitle{\par
+ \iftubsecondcolstart \null\newpage\tubsecondcolstartextra \fi
\ifdim\PreTitleDrop > \z@
\loop
\ifdim \PreTitleDrop > \textheight
\vbox{}\vfil\eject
\advance\PreTitleDrop by -\textheight
\repeat
- \vbox to \PreTitleDrop{}
+ \vbox to \PreTitleDrop{\vfil}%
\global\PreTitleDrop=\z@
\fi
- \iftubsecondcolstart \null\newpage\fi
\begingroup
\setcounter{footnote}{0}
\global\@topnum\z@ % disallow floats above the title
@@ -2738,15 +2738,46 @@
% \end{macrocode}
%
% \begin{macrocode}
-\def\l@section#1#2{\addpenalty{\@secpenalty}%
+% |#1| is both the section number and title; |#2| is the page number.
+% Per Ulrike, the hook calls are for tagging, introduced with the
+% June 2023 \LaTeX.
+\def\l@section#1#2{%
+ \addpenalty{\@secpenalty}%
\addvspace{\TBtocsectionspace}%
\@tempdima 1.5em
\begingroup
- \parindent\z@ \rightskip\z@ % article style makes \rightskip > 0
+ \parindent\z@
+ \rightskip\z@ % article style makes \rightskip > 0
\parfillskip\z@
\TBtocsectionfont
- \leavevmode\advance\leftskip\@tempdima\hskip-\leftskip#1\nobreak\hfil
- \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
+ \leavevmode
+ \advance\leftskip\@tempdima
+ \hskip-\leftskip
+ \ifx\UseHookWithArguments\undefined\else
+ \UseHookWithArguments{contentsline/text/before}{4}
+ {\toclevel@part}{#1}{#2}{\@contentsline@destination}%
+ \fi
+ % don't worry if this cs is not defined, hence the \csname.
+ \csname contentsline@text@1@format\endcsname{#1}% number and title
+ \ifx\UseHookWithArguments\undefined\else
+ \UseHookWithArguments{contentsline/text/after}{4}
+ {\toclevel@part}{#1}{#2}{\@contentsline@destination}%
+ \fi
+ \nobreak
+ \hfil
+ \nobreak
+ % page number
+ \hb@xt@\@pnumwidth{\hss
+ \ifx\UseHookWithArguments\undefined\else
+ \UseHookWithArguments{contentsline/page/before}{4}
+ {\toclevel@part}{#1}{#2}{\@contentsline@destination}%
+ \fi
+ #2%
+ \ifx\UseHookWithArguments\undefined\else
+ \UseHookWithArguments{contentsline/page/after}{4}
+ {\toclevel@part}{#1}{#2}{\@contentsline@destination}%
+ \fi
+ }\par
\endgroup}
% \end{macrocode}
%
@@ -2844,7 +2875,13 @@
% The name label comes from the moveable bit of the section argument;
% we subvert the \cs{@sect} and \cs{@ssect} commands (the latter
% deals with starred section commands) to grab the relevant argument.
+%
+% As of the June 2023 \LaTeX\ (or somewhat earlier, but this is good
+% enough), there are hooks that allow us to avoid redefinig
+% \cs{@sect} and \cs{@ssect}.
+%
% \begin{macrocode}
+\@ifl@t@r\fmtversion{2023-06-01}{}{%
\let\TB@@sect\@sect
\let\TB@@ssect\@ssect
\def\@sect#1#2#3#4#5#6[#7]#8{%
@@ -2855,6 +2892,7 @@
\def\@currentlabelname{#5}%
\TB@@ssect{#1}{#2}{#3}{#4}{#5}%
}
+} % LaTeX earlier than June 2023
% \end{macrocode}
%
% We output the name label as a second \cs{newlabel} command
@@ -2863,26 +2901,28 @@
% So we redefine \cs{label} to first call the standard \LaTeX\
% \cs{label} and then write our named label as |nr<label>|.
%
-% \begin{macrocode}
-\let\@savelatexlabel=\label % so save original LaTeX command
-%
-\def\label#1{% de
- \@savelatexlabel{#1}%
- \@bsphack
- \if@filesw
- \protected@write\@auxout{}%
- {\string\newlabel{nr@#1}{{\@currentlabel}{\@currentlabelname}}}%
- \fi
- \@esphack
+% Similarly, we only need this with pre-June 2023 \LaTeX.
+% With more recent LaTeX, define \@currentlabelname via hooks.
+% \begin{macrocode}
+\@ifl@t@r\fmtversion{2023-06-01}{%
+ \AddToHookWithArguments{cmd/@sect/before}{\def\@currentlabelname{#7}}%
+ \AddToHookWithArguments{cmd/@ssect/before}{\def\@currentlabelname{#5}}%
+}{%
+ \let\@savelatexlabel=\label % so save original LaTeX command
+ %
+ \def\label#1{%
+ \@savelatexlabel{#1}%
+ \@bsphack
+ \if@filesw
+ \protected@write\@auxout{}%
+ {\string\newlabel{nr@#1}{{\@currentlabel}{\@currentlabelname}}}%
+ \fi
+ \@esphack}
+ % in case there are no sectioning commands:
+ \let\@currentlabelname\@empty
}
% \end{macrocode}
%
-% Of course, in the case of a sufficiently mad author, there will be
-% no sectioning commands, so we need to
-% \begin{macrocode}
-\let\@currentlabelname\@empty
-% \end{macrocode}
-%
% Getting named references is then just like getting page references in
% the \LaTeX\ kernel (see |ltxref.dtx|).
%
@@ -2899,9 +2939,18 @@
%
% \begin{macrocode}
\AtBeginDocument{%
- \providecommand\nameref[1]{%
- \expandafter\@setref
- \csname r@nr@#1\endcsname\@secondoftwo{#1}%
+ \@ifl@t@r\fmtversion{2023-06-01}%
+ { % after June 2023, LaTeX stores the label name; use that.
+ \long\def\@thirdoffive#1#2#3#4#5{#3}
+ \providecommand\nameref[1]{%
+ \expandafter\@setref
+ \csname r@#1\endcsname\@thirdoffive{#1}}%
+ }
+ { % for earlier versions, still avoid overwriting \nameref per above.
+ % but if not otherwise defined, use the "nr" label defined by our \label.
+ \providecommand\nameref[1]{%
+ \expandafter\@setref
+ \csname r@nr@#1\endcsname\@secondoftwo{#1}}%
}%
}
% \end{macrocode}
@@ -3488,11 +3537,38 @@
\def\@oddhead{\MakeRegistrationMarks
\frenchspacing
\normalsize\csname normalshape\endcsname\rm \tubheadhook
- \rtitlex\qquad \midrtitle\hfil \rtitlenexttopage\quad \thepage}
+ \rtitlex\qquad \midrtitle\hfil \rtitlenexttopage\quad\thepage}
\def\@evenhead{\MakeRegistrationMarks
\frenchspacing
\normalsize\csname normalshape\endcsname\rm \tubheadhook
- \thepage \quad\rtitlenexttopage \hfil\midrtitle \qquad\rtitlex}
+ \thepage\quad\rtitlenexttopage \hfil\midrtitle \qquad\rtitlex}
+
+% Put a ? into the page number in all but a final run, so people
+% aren't tempted to cite it.
+%
+% We redefine |\thepage| so that the ? will also be used in page
+% references (in the text) and the toc. This is what's recommended by
+% the LaTeX developers: https://tex.stackexchange.com/questions/687258.
+% (Ulrike's example does this after loading hyperref, but doesn't seem
+% to matter?)
+\renewcommand\thepage{%
+ \ifnum\value{page}>900
+ % in CM, numerals are exactly .5em.
+ %
+ % The \texorpdfstring avoids the usual hyperref warning:
+ % Token not allowed in a PDF string ... removing `\@ifnextchar'
+ \texorpdfstring{\makebox[.5em][l]{\small ?}}{?}%
+ %
+ \textsl{\@arabic{\numexpr\value{page}-900\relax}}% e-tex
+ \else
+ \@arabic{\value{page}}%
+ \fi
+}
+% This custom page number format will break makeindex, etc., so we have
+% to tell about the format. Per Ulrike:
+% \usepackage{index}
+% \newcommand\specialthepage{\inteval{\value{page}-900}}
+% \newindex[specialthepage]*{default}{idx}{ind}{Index}
% can be used to reset the font, e.g., tb98kuester.
\def\tubheadhook{}
@@ -3745,6 +3821,7 @@
\def\thefootnote{}%
% no period, please, also no fnmark.
\def\@makefntext##1{##1}%
+ \def\Hy@Warning##1{}%
\footnotetext{\noindent #1#2}%
\endgroup
}