diff options
Diffstat (limited to 'macros/latex')
-rw-r--r-- | macros/latex/contrib/sidenotesplus/README.txt | 18 | ||||
-rw-r--r-- | macros/latex/contrib/sidenotesplus/sidenotesplus.dtx | 1341 | ||||
-rw-r--r-- | macros/latex/contrib/sidenotesplus/sidenotesplus.ins | 64 | ||||
-rw-r--r-- | macros/latex/contrib/sidenotesplus/sidenotesplus.pdf | bin | 0 -> 212629 bytes | |||
-rw-r--r-- | macros/latex/contrib/sidenotesplus/tests-sidenoteplus.pdf | bin | 0 -> 218699 bytes | |||
-rw-r--r-- | macros/latex/contrib/sidenotesplus/tests-sidenoteplus.tex | 371 | ||||
-rw-r--r-- | macros/latex/contrib/tugboat/NEWS | 25 | ||||
-rw-r--r-- | macros/latex/contrib/tugboat/ltubguid.ltx | 27 | ||||
-rw-r--r-- | macros/latex/contrib/tugboat/ltubguid.pdf | bin | 362482 -> 362388 bytes | |||
-rw-r--r-- | macros/latex/contrib/tugboat/tugboat.bst | 8 | ||||
-rw-r--r-- | macros/latex/contrib/tugboat/tugboat.dtx | 87 | ||||
-rw-r--r-- | macros/latex/contrib/tugboat/tugboat.pdf | bin | 493932 -> 494598 bytes |
12 files changed, 1905 insertions, 36 deletions
diff --git a/macros/latex/contrib/sidenotesplus/README.txt b/macros/latex/contrib/sidenotesplus/README.txt new file mode 100644 index 0000000000..da9f6a4532 --- /dev/null +++ b/macros/latex/contrib/sidenotesplus/README.txt @@ -0,0 +1,18 @@ +LaTeX package sidenotesplus +Copyright (c) Anton Vrba, 2022 +------------------------------------------------------------------- +Version: + 2022/05/20 1.00 Initial release +Licence: + This work may be distributed and/or modified under the conditions + of the LaTeX Project Public License, version 1.3c of the license. + 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-05-04 or later. +Abstract: + A package to manage margin notes, figures, tables and captions. + Also body text can be extended into the margin for wide figures, + tables and equation. Twoside symmetry is preserved. + For biblatex users, routines for side references are provided. +-------------------------------------------------------------------
\ No newline at end of file diff --git a/macros/latex/contrib/sidenotesplus/sidenotesplus.dtx b/macros/latex/contrib/sidenotesplus/sidenotesplus.dtx new file mode 100644 index 0000000000..bc84aa424f --- /dev/null +++ b/macros/latex/contrib/sidenotesplus/sidenotesplus.dtx @@ -0,0 +1,1341 @@ +% \iffalse meta-comment +% +% Copyright (C) 2022 by Anton Vrba +% +% Home Page: https://github.com/anton-vrba/sidenotesplus +% Issues: https://github.com/anton-vrba/sidenotesplus/issues +% +% +% LaTeX Package: sidenotesplus +% +% +% This work 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-05-04 or later. +% +% This work was inspired by: https://ctan.org/pkg/sidenotes by: Andy Thomas +% +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Anton Vrba. +% +% This work consists of the files sidenotesplus.dtx and sidenotesplus.ins +% and the derived filebase sidenotesplus.sty. +% +% \fi +% +% \iffalse +%<*driver> +\ProvidesFile{sidenotesplus.dtx} +%</driver> +%<package>\NeedsTeXFormat{LaTeX2e}[2020/10/01] +%<package>\ProvidesPackage{sidenotesplus} +%<*package> + [2022/05/20 1.00 rich text marginal notes, tables and figures ] +%</package> +%<package>\RequirePackage{marginnote} % provides an offset option for the marginals instead of a float +%<package>\RequirePackage{caption} % handles the captions (in the margin) +%<package>\RequirePackage{xparse} % new LaTeX3 syntax to define macros and environments +%<package>\RequirePackage{calc} +%<package>\RequirePackage{etoolbox} % provides \patchcmd +%<package>\RequirePackage{l3keys2e} +%<package>\RequirePackage{ifoddpage} +%<package>\RequirePackage{mparhack} % get marginpar right +%<package>\RequirePackage{xspace} +%<package>\RequirePackage[strict]{changepage} +%<*driver> +\documentclass{ltxdoc} +\usepackage{tabularx} +\usepackage{xspace} +\setlength{\textheight}{9.25in} +\setlength{\headsep}{-0.25in} +\EnableCrossrefs +%\CodelineIndex +\RecordChanges +\begin{document} + \DocInput{sidenotesplus.dtx} +% \PrintIndex + \PrintChanges +\end{document} +%</driver> +% \fi +% +% +% \CharacterTable +% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +% Digits \0\1\2\3\4\5\6\7\8\9 +% Exclamation \! Double quote \" Hash (number) \# +% Dollar \$ Percent \% Ampersand \& +% Acute accent \' Left paren \( Right paren \) +% Asterisk \* Plus \+ Comma \, +% Minus \- Point \. Solidus \/ +% Colon \: Semicolon \; Less than \< +% Equals \= Greater than \> Question mark \? +% Commercial at \@ Left bracket \[ Backslash \\ +% Right bracket \] Circumflex \^ Underscore \_ +% Grave accent \` Left brace \{ Vertical bar \| +% Right brace \} Tilde \~} +% +% +% +% +% \GetFileInfo{sidenotesplus.dtx} +% \title{The \textsf{sidenotesplus} package} +% \author{Anton Vrba\\\small% +% Home Page: \url{https://github.com/anton-vrba/sidenotesplus} \\\small +% Issues: \url{https://github.com/anton-vrba/sidenotesplus/issues }} +% \date{Version \fileversion\xspace from \filedate} +% +% \maketitle +% +% \changes{1.0}{2022/05/15}{Initial Release} +% +% \begin{abstract} +% \noindent A package to manage the margin notes, figures, tables and captions. +% Also body text can be extended into the margin for wide figures, tables and equation. +% Twoside symmetry is preserved. For biblatex users, routines for side references are +% included. +% \end{abstract} +% +% \paragraph*{Note:} Margin notes, figures and tables placements require up to +% three compilations to be as intended. +%% +% \paragraph*{Note:} This package is inspired by the package |sidenotes| authored by +% Andy Thomas and has many features in common. But, compatibility is +% not maintained between the two. +% +% \section{Usage} +% \subsection{Package options} +% Below the options that can be passed to the package |sidenotesplus| +% with the package defaults listed first. +% +% ~ +% +% \begin{tabularx}{\textwidth}{ r X } +% |mark=| & |alph, Alph, arabic, roman, Roman, fnsymbol| \\ +% |font=| & |rm, sf|\\ +% |size=| & |footnote, normal, small, script| \\ +% |shape=| & | up, it, sl|\\ +% |ragged| & switches to ragged outer margins\\ +% |classic| & switches to a classic look\\ +% |sepdiff=| & |1em|, or a valid length within reason \\ +% |alerton| & switches on the rendering of the margin alerts \\ +% \end{tabularx} +% +% ~ +% +% The normal page style is that margin notes are left-right justified with the +% last line ragged to the outer edge. The option |ragged| changes this +% style to ragged-outer, that is the left page's marginal notes are |\raggedleft| +% and the right page's are |\raggedright|. +% +% The marginal note's reference number or mark is placed in the margin separator, +% that is on the left page the mark is on the right hand side of the note. +% The option |classic| always places the mark to the left of the marginal note. +% This requires that the margin separator on the left page is slightly reduced if not +% enough space is availabe to the page outer edge. +% +% \subsection{Modified \LaTeX\xspace commands} +% +% \DescribeMacro{\marginpar} +% The LaTex command |marginpar{abc}| with only one +% parameter it is modified to +% |\marginpar[left styled abc]{right styled abc}| +% maintaining page symmetry. +% If called with two parameters nothing is changed +% +% \subsection{Marginal note commands} +% +% All marginal note commands have five options followed by the side note text +% enclosed in braces. Each option has its own enclosing symbols. The option +% sequence is fixed but not used options are omitted entirely, including their +% enclosing sequence. The option sequence is \verb"*, ||, <>, (), !!" plus |{}|. +% +% ~ +% +% % \begin{tabularx}{\textwidth}{ r X } +% |*| & margin note reference labels is omitted \\ +% \verb+|float offset|+ & floating offset, negative is towards page top\\ +% |<fixed offsett>| & fixed offset, negative is towards page top \\ +% |(custom mark)| & any custom mark\\ +% |!colour!|& any valid colour\\ +% |{content}|& margin note content +% \end{tabularx} +% +% ~ +% +% \noindent Note: All marginals placed with a fixed offset, that is with the |<fixed offset>| +% option can be overwritten by the marginals that float. +% +% ~ +% +% +% \DescribeMacro{\sidenote} +% The |\sidenote| has five options +% \verb+*|offset|<offsett>(custom mark)!colour!+ +% all preceding the note |{content}|. +% The options are defined by their enclosures \verb+*||,<>,(),!!+ +% and must be in the order listed above. +% +% Example: \verb"\sitenote|10pt|($\bigstar$){text}" is valid +% +% but \verb"\sitenote($\bigstar$)|10pt|{text}" will give an error +% +% ~ +% +% \DescribeMacro{\sidenotetext} +% \DescribeMacro{\sidenotemark} +% \DescribeMacro{\sidenotetextbefore} Similar to |\footnotemark| +% and |\footnotetext| the macros |\sidenotemark|, |\sidenotetext| +% and |\sidenotetextbefore| are provided, the latter two have the same +% options as |\sidenote|. This is useful in placing margin notes in +% environments where the |\sidenote| is not permitted. +% The margin note is not positioned by the |\sidenotemark|, but rather it +% is positioned relative to |\sidenotetext| or |\sidenotetextbefore| +% +%% ~ +% +% \DescribeMacro{\sidealert} +% These are temporary margin notes rendered in red +% or by the user's defined |!colour!|. The package option |alerton| needs to be +% specified in the document preamble. The alert mark has zero width so it does not +% alter the main text layout and is also rendered in colour. The alert mark is +% either numeric arabic (default), or alphabetic if the side note mark is set to +% arabic +% +% +% ~ +% +% \DescribeMacro{\sidepar} Starts a new paragraph in the side note, +% whereas |\\| begins a new line without indentation. +% +% ~ +% +%\DescribeMacro{\sidecaption} +% The \verb"\sidecaption*<offset>[short form]{long form}" +% macro can be used from within figure or table environment and +% the caption is placed in the margin adjacent to the figure or table +% The float \verb+||+ is not an option here. Therefore, the caption might +% overlap with other marginals. Then, these marginals have to be adjusted with +% offset parameters. The formatting of the caption is done by the \emph{caption} +% package by defining a \emph{sidecaption} style. Please refer to the +% documentation of the caption package for information on styles. The macro can +% be starred, which is analog to the regular starred caption (no numbering, no +% tof entry). Use |\raggedinner| within the figure, or table, environment +% to place these near the caption. +% +% ~ +% +% \DescribeMacro{\raggedinner} +% \DescribeMacro{\raggedouter} Are raggedleft or raggedright modes depending if +% document is one or two sided and if the page is even or odd. +% +% ~ +% +% \DescribeEnv{marginfigure} +% The |marginfigure| environment puts a figure and its caption in the margin. +% Instead of |\begin{figure}[htbp]| use \verb"\begin{marginfigure}|offset|<offset>". +% Again, using an offset value switches the behaviour from float to fixed +% position. The marginfigure has its own caption style named \emph{marginfigure}. +% +% ~ +% +% \DescribeEnv{margintable} +% The |margintable| environment works similar to marginfigure, but with table +% environments. Use \verb"\begin{marginfigure}|offset|<offset>" instead of +% |\begin{table}[htbp]|, its caption style is named \emph{margintable}. +% +% ~ +% +% \DescribeMacro{\margincaption} +% The |\margincaption| macro is used only in the two above environments +% (|marginfigure| and |marginfigure|) and it is not to be confused with |\sidecaption|. +% It as the same options as |\caption| +% +% ~ +% +% \DescribeEnv{figure*} +% The |figure*| environment is used to position figures across the full +% page, i.e. the text width plus the margin. The algorithm has to distinguish +% between recto and verso (left and right) pages and might need up to three +% \LaTeX{} runs to provide the desired result. The corresponding caption style +% is called \emph{widefigure}. +% \DescribeEnv{table*} +% The sister environment for tables is |table*|. Use \emph{widetable} to +% change its caption style. +% +% +% \DescribeEnv{text*} +% The |text*| environment is used to render text across up to +% the full page width. Page breaks are not permitted within this environment. +% This environment is useful when extra width for equations is required. +% The environment |\begin{text*}[0.5]| extends the text width by +% |0.5*(\marginparwidth+\marginparsep)|, omitting the option is equivalent +% to specifying the option |[1]|, +% +% +% \DescribeMacro{\sidecite} +% \DescribeMacro{\sidecitet} +% \DescribeMacro{\sidecitet*} +% The |\sidecite|, |\sidecitet| and |\sidecitet*| provide citing +% references in the margin and uses the package |biblatex| which has to be setup +% outside the |sitenotesplus| package. +% Example settings in the document preamble: +% +% ~~~~|\usepackage[english]{babel}| +% +% ~~~~|\usepackage[backend=biber,style=nature]{biblatex}| +% +% ~~~~|\addbibresource{mybibfile.bib}| +% \\The above three cite-commands use the same options as sidenote followed by the two +% options of the |biblatex|'s |\fullcite| command. Margin citations are always with marks, +% hence the |*| takes new meaning here. +% The command |\sidecite{BibReference}| and |\sidecite*{BibReference}| are +% equivalent, and both place a side note mark +% and the citation reference in the side margin. |\sidecitet{BibReference}| +% renders: Author\textsuperscript{a}, where 'a' is side note mark, whereas |\sidecitet*{BibReference}| +% is the possessive version and renders: Author's\textsuperscript{a}. +% +% +% \subsection{Packages loaded} +% +% \begin{description} +% \item[marginnote] +% supports an alternative to \verb+\marginpar+ and creates non floating +% notes in the margin. +% \item[mparhack] to get \verb+\marginpar+ right +% \item[caption] +% allows to set figure and table captions in the margin and allows +% easier formatting of these captions. Please refer to the +% \emph{caption} manual for details on styles. +% \item[xparse] is used to take advantage of the improved \LaTeX3 syntax. +% All macros and environments are defined using this package. +% \item[l3keys2e] provides a key/value mechanism +% \item[xspace] provides the command |\xspace| +% \item[changepage] is used to correctly shift figure* and table*. It has +% to use the option [strict] to work properly. This might lead to an +% option clash, if the same package is loaded without this option. +% \item[ifoddpage] provides the command |\ifoddpage| +% \item[etoolbox] provides the command |\patchcmd| +% \item[calc] provides calculation such as adding lengths +% +% \end{description}% + +% +% \StopEventually{} +% +% \section{Implementation} +% +% \iffalse +%<*package> +% \fi +% +% \begin{macrocode} +\newcommand \snptest {{\upshape Figure \thefigure:} And some text\xspace} + +\ExplSyntaxOn +\DeclareExpandableDocumentCommand{\IfNoValueOrEmptyTF}{ m m m } +{ + \IfNoValueTF{#1} + {#2} + {\tl_if_empty:nTF {#1} {#2} {#3}} +} +\setcounter{topnumber}{4} +\setcounter{bottomnumber}{4} +\setcounter{totalnumber}{8} +% \end{macrocode} +% +% \begin{macro}{\snp@sidenoteformat} +% -- +% +% \begin{macrocode} +\NewDocumentCommand \snp@sidenoteformat {} {% + \snp@size\snp@shape\snp@font\leavevmode% + \lineskip=0pt \lineskiplimit=0pt % + \tolerance=2000 \hyphenpenalty=300 \exhyphenpenalty=300% + \doublehyphendemerits=100000% + \finalhyphendemerits=\doublehyphendemerits + } +\NewDocumentCommand \snp@sideformat {} {} +\NewDocumentCommand \snp@sidecolor {} {} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{-} +% -- +% \begin{macrocode} +\NewDocumentCommand \snp@symbol {} {\alph} +\NewDocumentCommand \snp@alertsymbol {} {\arabic} +\NewDocumentCommand \snp@font {} {} +\NewDocumentCommand \snp@shape{} {\itshape} +\NewDocumentCommand \snp@size {} {\footnotesize} +\NewDocumentCommand \snp@leftmarginstyle{} {} +\NewDocumentCommand \snp@rightmarginstyle{} {} +% +% +\bool_new:N \l@snp@margincaption +\bool_new:N \l@snp@alerton +\bool_new:N \l@snp@alertmarkon +\bool_new:N \l@snp@ragged +\bool_new:N \l@snp@symmetric +\bool_new:N \l@snp@page + +\bool_set_false:N \l@snp@margincaption +\bool_set_false:N \l@snp@alerton +\bool_set_false:N \l@snp@alertmarkon +\bool_set_false:N \l@snp@ragged +\bool_set_true:N \l@snp@symmetric + + +% +\newlength{\snp@marginsepdiff} +\setlength{\snp@marginsepdiff}{1ex} +% \end{macrocode} +%\end{macro} + +% \begin{macrocode} +\keys_define:nn { sidenoteplus } +{ + mark .code:n = \str_case:nn {#1}% + { {fnsymbol}{\RenewDocumentCommand \snp@symbol {}{\fnsymbol}}% + {Alph}{\RenewDocumentCommand \snp@symbol {}{\Alph}}% + {arabic}{\RenewDocumentCommand \snp@symbol {}{\arabic} + \RenewDocumentCommand \snp@alertsymbol {} {\alph}}% + {Roman}{\RenewDocumentCommand \snp@symbol {}{\Roman}}% + {roman}{\RenewDocumentCommand \snp@symbol {}{\roman}}% + {Other}{} }, + font .code:n = \str_case:nn {#1}% + { {sf}{\RenewDocumentCommand \snp@font {}{\sffamily}}% + {Other}{} }, + size .code:n = \str_case:nn {#1}% + { {small}{\RenewDocumentCommand \snp@size {}{\small}}% + {script}{\RenewDocumentCommand \snp@size {}{\scriptsize}}% + {normal}{\RenewDocumentCommand \snp@size {}{\normalsize}}% + {Other}{} }, + shape .code:n = \str_case:nn {#1}% + { {sl}{\RenewDocumentCommand \snp@shape{}{\slshape}}% + {up}{\RenewDocumentCommand \snp@shape{}{\upshape}}% + {it}{\RenewDocumentCommand \snp@shape{}{\itshape}}% + {Other}{} }, + sepdiff .code:n = \setlength{\snp@marginsepdiff}{#1}, + classic .code:n = \bool_set_false:N \l@snp@symmetric, + ragged .code:n = { \RenewDocumentCommand \snp@leftmarginstyle {}{\raggedleft} + \RenewDocumentCommand \snp@rightmarginstyle {}{\raggedright} + \bool_set_true:N \l@snp@ragged }, + alerton .code:n = {\bool_set_true:N \l@snp@alerton}, +} +\ProcessKeysOptions { sidenoteplus } +\bool_if:NTF \l@snp@ragged + {\setlength{\snp@marginsepdiff}{0pt} \bool_set_false:N \l@snp@symmetric} + {\relax} +\bool_if:NTF \l@snp@symmetric {\setlength{\snp@marginsepdiff}{0pt}}{\relax} + \newcounter{sidenote}[page] % make a counter +\setcounter{sidenote}{0} % init the counter + \newcounter{sidealert}[page] % make a counter +\setcounter{sidealert}{0} % init the counter +% \end{macrocode} +% +% \begin{macro}{\snp@putmarkintext} +% -- +% +% \begin{macrocode} +\NewDocumentCommand \snp@putmarkintext { m } +{ + \leavevmode + \ifhmode + \edef \x@sf {\the \spacefactor } + \nobreak + \fi + \bool_if:NTF \l@snp@alertmarkon + {\makebox[0pt]{\raisebox{0.3ex}{\textsuperscript {\normalfont \bf ---~{#1}~---\kern-0.6ex }}}} + {\hbox {\textsuperscript {\normalfont #1 }}} + \ifhmode + \spacefactor \x@sf + \fi + \relax +} +% \end{macrocode} +% \end{macro} +% +% +% +% \begin{macro}{\snp@multisign} +% -- +% +% \begin{macrocode} +\NewDocumentCommand \snp@multisign { } {3sp} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\snp@multimarker} +% -- +% +% \begin{macrocode} +\NewDocumentCommand \snp@multimarker { } +{ + \kern-\snp@multisign + \kern\snp@multisign\relax +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\snp@multichecker} +% -- +% +% \begin{macrocode} +\NewDocumentCommand \snp@multichecker { } +{ + \dim_compare:nNnTF \lastkern = \snp@multisign + {\snp@putmarkintext{,}} + {} +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{environment}{@snp@llr} +% -- +% +% \begin{macrocode} +\NewDocumentEnvironment{@snp@llr} {}% +{ + \setlength{\parindent}{0pt} + \setlength{\leftskip}{0pt plus 1fil} + \setlength{\rightskip}{0pt plus -1fil} +}{\par} +% \end{macrocode} +% \end{environment} +% +% +% \begin{macro}{\marginpar} +% \begin{macrocode} +\let\oldmarginpar\marginpar +\renewcommand{\marginpar}[2][]{ + \if\relax\detokenize{#1}\relax + \oldmarginpar[\snp@leftmarginstyle\snp@sidenoteformat{#2}]% + {\snp@rightmarginstyle\snp@sidenoteformat{#2}}% + \else%two parameters, let them use their styling + \oldmarginpar[{#1}]{#2}% + \fi% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\snp@placemarginal} +% -- +% +% \begin{macrocode} +\renewcommand*{\raggedleftmarginnote}{} +\renewcommand*{\raggedrightmarginnote}{} +\renewcommand*{\marginfont}{} + +\NewDocumentCommand \snp@placemarginal {d!! m m } +{ + \IfNoValueOrEmptyTF{#1} + { + \if@twoside + \snp@isoddpage + { + \IfNoValueOrEmptyTF{#2} + {\marginpar{ #3 }} + {\marginnote{\snp@sidenoteformat #3}[#2]} + } + { + \bool_if:NTF \l@snp@symmetric + { + \IfNoValueOrEmptyTF{#2} + {\marginpar{\begin{@snp@llr} #3\end{@snp@llr}}} + {\marginnote{\begin{@snp@llr}\snp@sidenoteformat #3\end{@snp@llr}}[#2]} + } + + { + \IfNoValueOrEmptyTF{#2} + {\marginpar{ #3}} + {\marginnote{\snp@sidenoteformat #3}[#2]} + } + } + \else + \IfNoValueOrEmptyTF{#2} + {\marginpar{ #3}} + {\marginnote{\snp@sidenoteformat #3}[#2]} + \fi + } + { + \if@twoside + \snp@isoddpage + { + \IfNoValueOrEmptyTF{#2} + {\marginpar{ \textcolor{#1}{#3} }} + {\marginnote{\snp@sidenoteformat \textcolor{#1}{#3}}[#2]} + } + { + \bool_if:NTF \l@snp@symmetric + { + \IfNoValueOrEmptyTF{#2} + {\marginpar{\begin{@snp@llr} \textcolor{#1}{#3}\end{@snp@llr}}} + {\marginnote{\begin{@snp@llr}\snp@sidenoteformat \textcolor{#1}{#3}\end{@snp@llr}}[#2]} + } + { + \IfNoValueOrEmptyTF{#2} + {\marginpar{\textcolor{#1}{#3}}} + {\marginnote{ \snp@sidenoteformat \textcolor{#1}{#3}}[#2]} + } + } + \else + \IfNoValueOrEmptyTF{#2} + {\marginpar{ \textcolor{#1}{#3}}} + {\marginnote{ \snp@sidenoteformat \textcolor{#1}{#3}}[#2]} + \fi + } +} +% \end{macrocode} +% \end{macro} +% +% +% +% \begin{macro}{\sidepar} +% -- +% \begin{macrocode} +\NewDocumentCommand \sidepar {} +{ + \\\makebox[1em]{} +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\sidenote} +% -- +% +% \begin{macrocode} +\NewDocumentCommand \sidenote {s d|| d<> d() d!! m } +{ + \IfBooleanTF{#1} + { % starred + \snp@sidenotemark*(#4) + \snp@sidenotetext[*]|#2|<#3>(#4)!#5!{#6} + }{ % unstarred +\IfNoValueOrEmptyTF{#5} { + \snp@sidenotemark(#4) + \snp@sidenotetext[]|#2|<#3>(#4)!#5!{#6} + \snp@multimarker } + { + \snp@sidenotemark(#4)!#5! + \snp@sidenotetext[]|#2|<#3>(#4)!#5!{#6} + \snp@multimarker } + + } +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\sidealert} +% -- +% +% \begin{macrocode} +\NewDocumentCommand \sidealert {s d|| d<> d() d!! m } +{ + \bool_if:NTF \l@snp@alerton + { + \bool_set_true:N \l@snp@alertmarkon + \IfNoValueOrEmptyTF{#5} + { + \IfBooleanTF{#1} + { % starred + \snp@sidenotemark*(#4) + \snp@sidenotetext[*]|#2|<#3>(#4)!Red!{#6} + }{ % unstarred + \snp@sidenotemark(#4)!Red!{} + \snp@sidenotetext[]|#2|<#3>(#4)!Red!{#6} + \snp@multimarker + } + }{ \IfBooleanTF{#1} + { % starred + \snp@sidenotemark*(#4) + \snp@sidenotetext[*]|#2|<#3>(#4)!#5!{#6} + }{ % unstarred + \snp@sidenotemark(#4)!#5!{} + \snp@sidenotetext[]|#2|<#3>(#4)!#5!{#6} + \snp@multimarker + } + } + } + {\relax} + \bool_set_false:N \l@snp@alertmarkon +} +% \end{macrocode} +% \end{macro} +% +% +% +% +% \begin{macro}{\sidenotemark} +% -- +% +% \begin{macrocode} +\NewDocumentCommand \sidenotemark {s d() d!! m } +{ + \IfBooleanTF{#1} + { % starred + \relax} + {% unstarred + \IfNoValueOrEmptyT{#3} + {\snp@sidenotemark (#2)} + {\snp@sidenotemark !#3!( #2)} + } + \xspace +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\snp@sidenotemark} +% -- +% +% \begin{macrocode} +\NewDocumentCommand \snp@symbolnoteoralert {}{} +\NewDocumentCommand \snp@sidenotemark {s d() d!! } +{ + \IfBooleanTF{#1} + { % starred + \relax} + {% unstarred + \snp@multichecker + \bool_if:NTF \l@snp@alertmarkon + { \refstepcounter{sidealert} + \RenewDocumentCommand \snp@symbolnoteoralert {}{\snp@alertsymbol{sidealert}} } + { \refstepcounter{sidenote} + \RenewDocumentCommand \snp@symbolnoteoralert {}{\snp@symbol{sidenote}} } + \IfNoValueOrEmptyTF{#3} + { + \IfNoValueOrEmptyTF{#2} + { \snp@putmarkintext{\snp@symbolnoteoralert } } + { \snp@putmarkintext{#2} } + }{ + \IfNoValueOrEmptyTF{#2} + { \textcolor{#3} {\snp@putmarkintext{\snp@symbolnoteoralert}} } + { \textcolor{#3} {\snp@putmarkintext{#2}} } + } + \snp@multimarker + } +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\snp@onelineup} +% -- +% +% \begin{macrocode} +\NewDocumentCommand{\snp@onelineup}{} + {\par \vspace*{-1\baselineskip}} +\NewDocumentCommand{\snp@onexlineup}{} + {\par \vspace*{-1.5\baselineskip}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\snp@leftnotelabel} +% -- +% +% \begin{macrocode} +\NewDocumentCommand{\snp@leftnotelabel}{ m } + {\makebox[0em][l]{\hspace*{0.9ex}#1}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\snp@rightnotelabel} +% -- +% +% \begin{macrocode} +\NewDocumentCommand{\snp@rightnotelabel}{ m } + {\makebox[0em][r]{#1\hspace*{0.9ex}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\snp@justifiedleftnotelabel} +% -- +% +% \begin{macrocode} +\NewDocumentCommand{\snp@justifiedleftnotelabel}{ m } + {\makebox[0em][l]{\hspace*{\marginparwidth+0.9ex}#1}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\sidenotetext} +% -- +% +% \begin{macrocode} +\NewDocumentCommand \sidenotetext {s d|| d<> d() d!! m } { + \IfBooleanTF{#1} + { \snp@sidenotetext[*]|#2|<#3>(#4)!#5!{#6} } + { \snp@sidenotetext[]|#2|<#3>(#4)!#5!{#6} } +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\sidenotetextbefore} +% -- +% +% \begin{macrocode} +\NewDocumentCommand \sidenotetextbefore {s d|| d<> d() d!! m } { + \refstepcounter{sidenote} + \IfBooleanTF{#1} + { \snp@sidenotetext[*]|#2|<#3>(#4)!#5!{#6} } + { \snp@sidenotetext[]|#2|<#3>(#4)!#5!{#6} } + \addtocounter{sidenote}{-1} +} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\DeclareExpandableDocumentCommand{\IfsTF}{ m m m } +{ + \IfNoValueTF{#1} + {#2} + {\tl_if_empty:nTF {#1} {#2} {#3}} +} +% \end{macrocode} +% -- +% +% \begin{macrocode} + \newlength{\d@snp@offset} +% \end{macrocode} +% +% \begin{macro}{\snp@sidenotetext} +% -- +% +% \begin{macrocode} +\NewDocumentCommand \snp@sidenotesymbol {}{} +\NewDocumentCommand \snp@sidenotetext {o d|| d<> d() d!! m } { + \bool_if:NTF \l@snp@alertmarkon + { + \IfNoValueOrEmptyTF{#4} + {\RenewDocumentCommand \snp@sidenotesymbol {}{-~\snp@alertsymbol{sidealert}~-}} + {\RenewDocumentCommand \snp@sidenotesymbol {}{-~#4~-}} + } + { + \IfNoValueOrEmptyTF{#4} + {\RenewDocumentCommand \snp@sidenotesymbol {}{\snp@symbol{sidenote}}} + {\RenewDocumentCommand \snp@sidenotesymbol {}{#4}} + } + \IfNoValueOrEmptyTF{#2} + {\relax} + {\setlength{\d@snp@offset}{#2} \vspace*{ \d@snp@offset }} + \bool_if:NTF \l@snp@ragged + { + \if@twoside + \snp@isoddpage + {%odd page + { \snp@placemarginal!#5!{#3}%-- + {\snp@rightnotelabel{% + \normalfont\IfsTF{#1}{\snp@sidenotesymbol}{\relax}}#6} + } + } + {%even page + {\snp@placemarginal!#5!{#3}%-- + {\snp@justifiedleftnotelabel{\normalfont% + \IfsTF{#1}{\snp@sidenotesymbol}{\relax}} + \hspace*{\marginparwidth} \snp@onelineup#6} + } + } + \else %not twoside + {\snp@placemarginal!#5!{#3}%-- + {\snp@rightnotelabel{\normalfont% + \IfsTF{#1}{\snp@sidenotesymbol}{\relax}}#6} + } + \fi % ends if@twoside + } + { + \if@twoside + \snp@isoddpage + {%odd page + {\snp@placemarginal!#5!{#3}%-- + {\snp@rightnotelabel{ + \normalfont\IfsTF{#1}{\snp@sidenotesymbol}{\relax}}#6} + } + } + {%even page + \bool_if:NTF \l@snp@symmetric + { + {\snp@placemarginal!#5!{#3}%-- + {\snp@justifiedleftnotelabel{ + \normalfont\IfsTF{#1}{\snp@sidenotesymbol}{\relax} } + \hspace*{\marginparwidth}\snp@onelineup#6 + } + } + } + { + { \snp@placemarginal!#5!{#3}%-- + {\snp@rightnotelabel{ + \normalfont\IfsTF{#1}{\snp@sidenotesymbol}{\relax}}#6 } + } + } + } + \else + { \snp@placemarginal!#5!{#3}%-- + {\snp@rightnotelabel{ + \normalfont\IfsTF{#1}{\snp@sidenotesymbol}{\relax}}#6} + } + \fi + } + \IfNoValueOrEmptyTF{#2} + {\relax} + { \setlength{\d@snp@offset}{#2 *(-1)} \vspace*{{\d@snp@offset}}} +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\snp@raggedcaption} +% -- +% \begin{macrocode} + +\NewDocumentCommand \snp@raggedcaption {m } +{ + \if@twoside + \snp@isoddpage {#1} + {\bool_if:NTF \l@snp@symmetric {\begin{@snp@llr}#1\end{@snp@llr}} {#1}} + \else #1 \fi +} +% \end{macrocode} +% \end{macro} +% +% +% +% \begin{macrocode} +\DeclareCaptionStyle{sidecaption}{font=footnotesize} +% \end{macrocode} +% +% \begin{macro}{\sidecaption} +% -- +% +% \begin{macrocode} +\NewDocumentCommand \snp@entrycap {} {} +\NewDocumentCommand \snp@offsetcap {} {} +\NewDocumentCommand \sidecaption {s d|| d<> d!! o m} { + \captionsetup{style=sidecaption} + \IfBooleanTF{#1} + { %starred + \marginnote{\caption*{\snp@raggedcaption{#6}}} + [\IfNoValueOrEmptyTF{#3} {0pt} {#3}] + } + { %unstarred + \marginnote{\caption[\IfNoValueOrEmptyTF{#5} {#6} {#5}] + {\snp@raggedcaption{#6}}} + [\IfNoValueOrEmptyTF{#3} {0pt} {#3}] + } +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\istwosided} +% -- +% +% \begin{macrocode} +\NewDocumentCommand \istwosided {m m} { +\if@twoside #1 \else #2 \raggedleft \fi +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\raggedinner} +% -- +% +% \begin{macrocode} +\NewDocumentCommand \raggedinner {} { +\if@twoside + \snp@isoddpage {\raggedleft}{\raggedright} +\else + \raggedleft +\fi +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\raggedouter} +% -- +% +% \begin{macrocode} +\NewDocumentCommand \raggedouter {} { +\if@twoside + \snp@isoddpage {\raggedright}{\raggedleft} +\else + \raggedleft +\fi +} +% \end{macrocode} +% \end{macro} +% + +% \begin{macro}{\margincaption} +% -- +% \begin{macrocode} +\newlength \l@snp@belowcaption +\NewDocumentCommand \margincaption {s o m } +{ +\setlength \l@snp@belowcaption \belowcaptionskip +\setlength{\belowcaptionskip}{1ex plus 0.3ex minus -0.1ex} + \IfBooleanTF{#1} + { %starred + \if@twoside + \snp@isoddpage + { + \IfNoValueOrEmptyTF{#2} {\caption*{#3}} {\caption*[#2]{#3}} + } + { + \bool_if:NTF \l@snp@symmetric + { + \IfNoValueOrEmptyTF{#2} + {\caption*[#3]{\begin{@snp@llr}#3\end{@snp@llr}}} + {\caption*[#2]{\begin{@snp@llr}#3\end{@snp@llr}}} + } + { + \IfNoValueOrEmptyTF{#2} {\caption*{#3}} {\caption*[#2]{#3}} + } + } + \else + \IfNoValueOrEmptyTF{#2} {\caption*{#3}} {\caption*[#2]{#3}} + \fi + } + { %unstarred + \if@twoside + \snp@isoddpage + { + \IfNoValueOrEmptyTF{#2} {\caption{#3}} {\caption[#2]{#3}} + } + { + \bool_if:NTF \l@snp@symmetric + { + \IfNoValueOrEmptyTF{#2} + {\caption[#3]{\begin{@snp@llr}#3\end{@snp@llr}}} + {\caption[#2]{\begin{@snp@llr}#3\end{@snp@llr}}} + } + { + \IfNoValueOrEmptyTF{#2} {\caption{#3}} {\caption[#2]{#3}} + } + } + \else + \IfNoValueOrEmptyTF{#2} {\caption{#3}} {\caption[#2]{#3}} + \fi + } +\setlength \belowcaptionskip \l@snp@belowcaption +} +% \end{macrocode} +% \end{macro} + +% \begin{macrocode} + \newsavebox{\b@snp@marginfigurebox} +\DeclareCaptionStyle{marginfigure}{font=footnotesize,skip=1ex} +% \end{macrocode} +% +% \begin{environment}{marginfigure} +% -- +% +% \begin{macrocode} +\NewDocumentEnvironment{marginfigure} { d|| d<> } +{ % begin{} part + \begin{lrbox}{\b@snp@marginfigurebox} + \begin{minipage}{\marginparwidth} + \captionsetup{type=figure,style=marginfigure} +} +% \end{macrocode} +% \end{environment} +% +% \begin{macrocode} +{ % end{} part + \end{minipage}% + \end{lrbox}% + + \IfNoValueOrEmptyTF{#1} + {\relax} + {\setlength{\d@snp@offset}{#1} \vspace*{ \d@snp@offset }} + \snp@placemarginal{#2}{\usebox{\b@snp@marginfigurebox} } + %~\snp@onexlineup \snptest } + \IfNoValueOrEmptyTF{#1} + {\relax} + { \setlength{\d@snp@offset}{#1 *(-1)} \vspace*{{\d@snp@offset}}} +} +% \end{macrocode} +% -- +% +% \upshape Figure \begin{macrocode} +\newsavebox{\b@snp@margintablebox} +\DeclareCaptionStyle{margintable}{font=footnotesize} +% \end{macrocode} +% +% \begin{environment}{margintable} +% -- +% +% \begin{macrocode} +\NewDocumentEnvironment{margintable} { d|| d<> d() } +{ % begin part + \begin{lrbox}{\b@snp@margintablebox} + \snp@sidenoteformat + \begin{minipage}{\marginparwidth} + \captionsetup{type=table,style=margintable} +} +% \end{macrocode} +% \end{environment} +% +% \begin{macrocode} +{ % end part + \end{minipage} + \end{lrbox} + \IfNoValueOrEmptyTF{#1} + {\relax} + {\setlength{\d@snp@offset}{#1} \vspace*{ \d@snp@offset }} + \snp@placemarginal{#2}{\usebox{\b@snp@margintablebox} } + \IfNoValueOrEmptyTF{#1} + {\relax} + {\setlength{\d@snp@offset}{#1 *(-1)} \vspace*{{\d@snp@offset}}} +% + +% +} +% \end{macrocode} +% -- +% +% \begin{macrocode} +\AtBeginDocument{% +\newlength{\d@snp@extrawidth} +\setlength{\d@snp@extrawidth}{\marginparwidth} +\addtolength{\d@snp@extrawidth}{\marginparsep} } +% \end{macrocode} +% +% \begin{macro}{\snp@isoddpage} +% -- +% +% \begin{macrocode} +\NewDocumentCommand \snp@isoddpage {m m} + { \checkoddpage\ifoddpage #1 \else #2 \fi } +% \end{macrocode} +% \end{macro} +% +% \begin{environment}{@snp@autoadjustwidth} +% -- +% +% \begin{macrocode} +\NewDocumentEnvironment{@snp@autoadjustwidth}{ m m }% +{ % begin part +\begin{adjustwidth}{0pt}{0pt} + \if@twoside + \snp@isoddpage{\begin{adjustwidth}{#1}{-#2}}% + {\begin{adjustwidth}{-#2}{#1}} + \else + \begin{adjustwidth}{#1}{-#2} + \fi +} +% \end{macrocode} +% \end{environment} +% +% \begin{macrocode} +{ % end part + \end{adjustwidth}\end{adjustwidth} +} +% \end{macrocode} +% +% \begin{environment}{text*} +% -- +% +% \begin{macrocode} +\NewDocumentEnvironment{text*}{ o }% +{ % begin part + \begin{adjustwidth}{0pt}{0pt} + \IfNoValueOrEmptyTF{#1} + { + \if@twoside + \snp@isoddpage{\begin{adjustwidth}{0pt}{-\d@snp@extrawidth}}% + {\begin{adjustwidth}{-\d@snp@extrawidth*}{0pt}} + \else + \begin{adjustwidth}{0pt}{-\d@snp@extrawidth*} + \fi + } + { + \if@twoside + \snp@isoddpage{\begin{adjustwidth}{0pt}{-\d@snp@extrawidth*#1}}% + {\begin{adjustwidth}{-\d@snp@extrawidth*#1}{0pt}} + \else + \begin{adjustwidth}{0pt}{-\d@snp@extrawidth*#1} + \fi + } +} +% \end{macrocode} +% \end{environment} +% +% \begin{macrocode} +{ % end part +\end{adjustwidth}\end{adjustwidth} \snp@placemarginal{}{} +} +% \end{macrocode} +% +% \begin{environment}{figure*} +% \begin{macrocode} +\RenewDocumentEnvironment{figure*}{ O{htbp} } +{ + \begin{figure}[#1] + \begin{@snp@autoadjustwidth}{}{\d@snp@extrawidth} + \begin{minipage}[c]{\linewidth} + \centering + \captionsetup{ margin={\d@snp@extrawidth/2,\d@snp@extrawidth/2}} +}{ % end part + \end{minipage} + \end{@snp@autoadjustwidth} + \end{figure} + \snp@placemarginal{}{} + } +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{table*} +% \begin{macrocode} +\RenewDocumentEnvironment{table*}{O{htbp} } +{ + \begin{table}[#1] + \begin{@snp@autoadjustwidth}{}{\d@snp@extrawidth} + \if@twoside + \snp@isoddpage{\raggedright}{\raggedleft} + \snp@isoddpage + {\captionsetup{margin={0pt,0pt}} } + {\captionsetup{margin={-\d@snp@extrawidth,\d@snp@extrawidth}} } + \else + \raggedright \captionsetup{margin={0pt,0pt}} + \fi +} +{ % end part + \end{@snp@autoadjustwidth} + \end{table} +} +% \end{macrocode} +% \end{environment} +% +% \begin{macro}{\sidecite} +% -- +% +% \begin{macrocode} +\NewDocumentCommand \snp@before {} {} +\NewDocumentCommand \snp@after {} {} +\NewDocumentCommand \sidecite {s d|| d<> d() d!! o o m } +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +{ \IfNoValueOrEmptyTF{#6} + {\RenewDocumentCommand \snp@before {} {}} + {\RenewDocumentCommand \snp@before {} {#6}} + \IfNoValueOrEmptyTF{#7} + {\RenewDocumentCommand \snp@after {} {}} + {\RenewDocumentCommand \snp@after {} {#7}} + \sidenote|#2|<#3>(#4)!#5!{\kern-2.3pt\upshape\fullcite[\snp@before][\snp@after]{#8}} +} +% \end{macrocode} +% +% \begin{macro}{\sidecitet} +% -- +% +% \begin{macrocode} +\NewDocumentCommand \sidecitet {s d|| d<> d() d!! o o m } +{ \IfNoValueOrEmptyTF{#6} + {\RenewDocumentCommand \snp@before {} {}} + {\RenewDocumentCommand \snp@before {} {#6}} + \IfNoValueOrEmptyTF{#7} + {\RenewDocumentCommand \snp@after {} {}} + {\RenewDocumentCommand \snp@after {} {#7}} + \IfBooleanTF{#1} + { + \citeauthor{#8}'s\sidenote|#2|<#3>(#4)!#5! + {\kern-2.3pt\upshape\fullcite[\snp@before][\snp@after]{#8}} + } + { + \citeauthor{#8}\sidenote|#2|<#3>(#4)!#5! + {\kern-2.3pt\upshape\fullcite[\snp@before][\snp@after]{#8}} + } +} +% \end{macrocode} +% \end{macro} +% +\ExplSyntaxOff +% +%% +% \begin{macrocode} +\newlength\marginparsepodd +\newlength\marginparsepeven + +\setlength{\marginparsepodd}{\marginparsep} +\setlength{\marginparsepeven}{\marginparsep-\snp@marginsepdiff} + +\makeatletter +% First we patch \@addmarginpar +% The \patchcmd command does a search and replace. +\patchcmd{\@addmarginpar} % In this command + {\mph@orig@addmarginpar} % ... replace this... + {\if@twoside\ifodd\c@page\relax % ... with this + \marginparsep=\marginparsepodd % Page is odd + \else + \marginparsep=\marginparsepeven % Page is even + \fi + \else + \marginparsep=\marginparsepodd + \fi + \mph@orig@addmarginpar} + {} % success + {\message{Error! Couldn't hook into command % failure + `\string\@addmarginpar'}} + +% Now we patch \@mn@@@marginnote +{%% Group to keep patching commands local + % + % Here we use a little trick to repeatedly patch the \@mn@@@marginnote + % command, replacing all instances of \kern\marginparsep with a + % conditional. We call \patch recursively each time on success, and stop + % when the patch fails (because all instances have been replaced). If the + % patch fails the first time, we show an error message. + \def\patcherr{% + \message{Error! Couldn't hook into command `\string\@mn@@@marginnote'}} + \def\patchok{% + \let\patcherr\relax % Only display error if first patch fails + \patch % Now patch again. + } + \def\patch{ + \patchcmd{\@mn@@@marginnote} % In this command + {\kern\marginparsep} % ... replace this... + {\ifx\@mn@currpage\relax\else % ... with this + \if@twoside\ifodd\@mn@currpage\relax + \kern\marginparsepodd + \else + \kern\marginparsepeven + \fi + \else + \kern\marginparsepodd + \fi + \fi} + {\message{Patched!}\patchok} % success (recurse) + {\patcherr} % fail + } + \message{Patching `\string\@mn@@@marginnote`!} + \patch + \global\let\@mn@@@marginnote\@mn@@@marginnote % Make patch global +} +\makeatother +\endinput +% \end{macrocode} + + +% +% \iffalse +%</package> +% \fi +% +% \Finale +\endinput diff --git a/macros/latex/contrib/sidenotesplus/sidenotesplus.ins b/macros/latex/contrib/sidenotesplus/sidenotesplus.ins new file mode 100644 index 0000000000..33697cfce2 --- /dev/null +++ b/macros/latex/contrib/sidenotesplus/sidenotesplus.ins @@ -0,0 +1,64 @@ +%% Copyright (C) 2022 by Anton Vrba +%% +%% Home Page: https://github.com/anton-vrba/sidenotesplus +%% Issues: https://github.com/anton-vrba/sidenotesplus/issues +%% -------------------------------------------------------------------------- +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% 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.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Anton Vrba. +%% +%% This work consists of the files sidenotesplus.dtx and sidenotesplus.ins +%% and the derived filebase sidenotesplus.sty. +%% + +\input docstrip.tex +\keepsilent + + +\preamble + + Copyright (C) 2022 by Anton Vrba + -------------------------------- + + This work may be distributed and/or modified under the + conditions of the LaTeX Project Public License, either version 1.3 + 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-05-04 or later. + + + This work has the LPPL maintenance status `maintained'. + + The Current Maintainer of this work is Anton Vrba. + + +\endpreamble + +\generate{\file{sidenotesplus.sty}{\from{sidenotesplus.dtx}{package}}} + +\obeyspaces +\Msg{*************************************************************} +\Msg{* *} +\Msg{* To finish the installation you have to move the following *} +\Msg{* file into a directory searched by TeX: *} +\Msg{* *} +\Msg{* sidenotesplus.sty *} +\Msg{* *} +\Msg{* To produce the documentation run the file sidenotesplus.dtx *} +\Msg{* through LaTeX. *} +\Msg{* *} +\Msg{* Happy TeXing! *} +\Msg{* *} +\Msg{*************************************************************} + +\endbatchfile diff --git a/macros/latex/contrib/sidenotesplus/sidenotesplus.pdf b/macros/latex/contrib/sidenotesplus/sidenotesplus.pdf Binary files differnew file mode 100644 index 0000000000..b51643d66e --- /dev/null +++ b/macros/latex/contrib/sidenotesplus/sidenotesplus.pdf diff --git a/macros/latex/contrib/sidenotesplus/tests-sidenoteplus.pdf b/macros/latex/contrib/sidenotesplus/tests-sidenoteplus.pdf Binary files differnew file mode 100644 index 0000000000..e9cf85133f --- /dev/null +++ b/macros/latex/contrib/sidenotesplus/tests-sidenoteplus.pdf diff --git a/macros/latex/contrib/sidenotesplus/tests-sidenoteplus.tex b/macros/latex/contrib/sidenotesplus/tests-sidenoteplus.tex new file mode 100644 index 0000000000..41eccf6e4a --- /dev/null +++ b/macros/latex/contrib/sidenotesplus/tests-sidenoteplus.tex @@ -0,0 +1,371 @@ + +\documentclass[twoside,10pt,ragged]{article} +\PassOptionsToPackage{% + a4paper,% landscape,% + bindingoffset=3mm,% + left=20mm,% + textwidth=110mm,% + marginparsep=10mm,% + marginparwidth=55mm,% + top=20mm,% + bottom=20mm,% + headsep=1\baselineskip,% + footskip = 2\baselineskip,% + includeall} {geometry}% +\usepackage {geometry} +\RequirePackage[utf8]{inputenc}\usepackage[T1]{fontenc} +\usepackage[alerton]{sidenotesplus} + +\RequirePackage[svgnames,dvipsnames]{xcolor} +\usepackage{lipsum} +\usepackage{xcolor} +%\setlipsum{% +% par-before = \begingroup\color{gray}, +% par-after = \endgroup, +% sentence-before = \begingroup\color{gray}, +% sentence-after = \endgroup +%} + +%auto generate the bib file +\usepackage{filecontents} +% +\begin{filecontents}{\jobname.bib} +@book{Tufte1990, + author = {Edward R. Tufte}, + title = {Envisioning Information}, + publisher = {Graphics Press}, + year = {1990}, + isbn = {0-9613921-1-8} +} + +@book{Tufte2006, + author = {Edward R. Tufte}, + title = {Beautiful Evidence}, + year = {2006}, + publisher = {Graphics Press, {LLC}}, + isbn = {0-9613921-7-7} +} + +@BOOK{bringhurst:2002, + title = {{T}he {E}lements of {T}ypographic {S}tyle}, + publisher = {Hartley \& Marks Publishers}, + year = {2013}, + author = {Robert Bringhurst}, + series = {Version 4.0: 20th Anniversary Edition}, + address = {Point Roberts, WA, USA} + } + +@Article{Einstein_1905e, + author = {A. Einstein}, + journal = {Annalen der Physik}, + title = {Ist die Trägheit eines Körpers von seinem Energieinhalt abhängig?}, + year = {1905}, + number = {13}, + pages = {639--641}, + volume = {323}, + doi = {10.1002/andp.19053231314}, + file = {:Articles/Einstein_1905e - Does the Inertia of a Body Depend upon its + Energy-Content_.pdf:PDF;:Articles/Einstein_1905e - Ist Die Trägheit Eines Körpers Von Seinem + Energieinhalt Abhängig_.pdf:PDF}, + groups = {Relativity}, + publisher = {Wiley}, +} + +\end{filecontents} +\usepackage{mwe} +% -- language: English -- +% +\usepackage[english]{babel} +% -- biblatex -- +\usepackage[backend=biber,style=nature]{biblatex} % xxx +% the .bib file with the references +\addbibresource{\jobname.bib} + + +\usepackage{listings} +\lstset{ +basicstyle=\sffamily, + lineskip=0pt, + aboveskip= 3pt, + belowskip= 0pt, +} + +\usepackage{tabularx} +\usepackage{amsmath} +\usepackage{mathabx} +\usepackage{tikz} +\usetikzlibrary{calc} +\usepackage{xspace} + +\captionsetup{font=small} % Requires Package{caption} loaded in sidenoteplus + + + + +% Author info +\title{\textbf{\textsf{sidenotesplus}} Example Pages} +\author{Anton Vrba} + +\date{ \today} + + \PassOptionsToPackage{osf,sc}{mathpazo}% + \RequirePackage{mathpazo} + \linespread{1.05} % a bit more for Palatino + +\let\OldTexttt\texttt +\renewcommand{\texttt}[1]{\OldTexttt{\color{MidnightBlue}{#1}}} + + +\newcommand{\someimage}[3]{% Width, height, label +\begin{tikzpicture}[x=1pt,y=1pt]% 4x3 + \path [fill=black!25] (0,0) rectangle (#1,#2); + \draw [thick,black!40] + (0,0) -- (#1,#2) + (#1,0) -- (0,#2) + (0.5*#1,0) -- (0.5*#1,#2) + (0,0.5*#2) -- (#1,0.5*#2) + ; + \path [draw,very thick] (0,0) rectangle (#1,#2); + \node at (0.5*#1,0.5*#2) {\sffamily\Huge #3} + ; +\end{tikzpicture}% +} +\newcommand \describe \paragraph + + +\begin{document} + + + \maketitle + + \begin{abstract} + \noindent Here we demonstrate the features of \textsf{sidenotesplus}, + a \LaTeX\xspace package to manage the margin notes, figures, tables and captions. + Also body text can be extended into the margin for wide figures, tables and equation. + Twoside symmetry is preserved. For biblatex users, routines for side references are + provided. + \end{abstract} + + +Please first read \textsf{sidenotesplus.pdf} for the descriptions and usage of this package. +This document served as a test platform while developing the package, and uses the standard +\verb"article" \LaTeX\xspace class. The above right margin note list the first view +lines\sidenote|-200pt|{% +\ttfamily\upshape\textbackslash documentclass[twoside,10pt]\textbraceleft +article\textbraceright\\ +\textbackslash PassOptionsToPackage\textbraceleft\\ +\makebox[2ex]{} a4paper,\\ +\makebox[2ex]{} bindingoffset=3mm,\\ +\makebox[2ex]{} left=20mm,\\ +\makebox[2ex]{} textwidth=110mm,\\ +\makebox[2ex]{} marginparsep=10mm,\\ +\makebox[2ex]{} marginparwidth=55mm,\\ +\makebox[2ex]{} top=20mm, bottom=20mm,\\ +\makebox[2ex]{} headsep=1\textbackslash baselineskip,\\ +\makebox[2ex]{} footskip = 2\textbackslash baselineskip,\\ +\makebox[2ex]{} includeall\textbraceright \textbraceleft geometry\textbraceright\\ +\textbackslash usepackage \textbraceleft geometry\textbraceright\\ +\textbackslash usepackage[alerton]\textbraceleft sidenotesplus\textbraceright\\ +} of the document preamble. + +Here we have three \sidenote<-15pt>{\textsf{\upshape\textbackslash sidenote<-15pt>} Test up}% +\sidenote!Blue!{\textsf{\upshape\textbackslash sidenote!Blue!} Test colour}% +\sidenote|-12mm|{\textsf{\upshape\textbackslash sidenote|-12mm|} but cannot float past \textsuperscript d above} + and the commas are inserted automatically between the text markers. But, if a line break + is between the two \verb"\sidenote " commands, then that requires a \% sign before the line + break. + +In many environments the floating option fails thus the fixed option is used. Example, a side +note used in an equation: + +\begin{equation} \label{eq:123} + a=b\quad \text{see\sidenote<0pt>{test} } +\end{equation} +an was coded \verb+a=b\quad\text{see\sidenote<0pt>{test}}+. in \eqref{eq:123} Important here is +the option \verb/<0pt>/ with any valid length. + + +Side notes can be placed without \sidenotetext*|-20.pt|{A sidenotetext without a mark. Also +testing if the command \emph{sidepar} works. +\sidepar And here we have a new paragraph. And here we have a new paragraph. And here we have a +new paragraph} references by using the \verb"\sidenote*" option + + + +Similar to \verb"\footnotemark" and \verb"\footnotetext" the package provides macros +\verb"\sidenotemark", \verb"\sidenotetext" and \verb"\sidenotetextbefore" with the same option +set. In usage \verb"\sidenotemark" is followed by \verb"\sidenotetext", whereas +\verb"\sidenotetextbefore" is followed by \verb"\sidenotemark". The side not is placed relative +to the \verb"\sidenotetext" commands. + + \sidecitet*{bringhurst:2002} expertise is in typography, and the famous expression $E=mc^2$ was + first presented in this paper\sidecite{Einstein_1905e}. + +~ + +\noindent The above paragraph was coded: + \begin{verbatim} + \sidecitet*{bringhurst:2002} expertise is in typography, + and the famous expression $E=mc^2$ was first presented + in this paper\sidecite{Einstein_1905e}. + \end{verbatim} + + + + +The command \verb"\sidealert" provides a temporary margin notes rendered in red or +by the user’s defined \verb"!colour!". The alert mark\sidealert{This paragraph needs to be +expanded} has zero width so it does not alter the main text layout +and is also rendered in colour The package option \verb"alerton" needs to +be specified in the document preamble, if omitted the alerts are not printed. + +\newpage + +\subsection*{Figure demonstration page A} +\begin{figure}[h] +\centering + \someimage{0.75*\textwidth}{70pt}{A}% + \caption{A: Short caption} + \label{imageA} +\end{figure} + +\lipsum[3][4-8] + +\begin{figure}[h] +\centering + \someimage{0.75*\textwidth}{70pt}{B}% + \caption[A: Long caption] {A: \emph{Long caption} \lipsum[3][1-3]} + \label{imageB} +\end{figure} +% +% +\begin{marginfigure}|-500pt|% + \someimage{\marginparwidth}{70pt}{C}%% + \margincaption {A: small rectangle in the margin.\label{rectangle1}}% +\end{marginfigure}% +% +% +\begin{margintable}|-500pt| +\upshape +\begin{tabularx}{\marginparwidth}{c X} + \hline + \multicolumn{2}{c}{Long Table Heading}\\ + Item&Description\\ + \hline + one& The width of this column depends on the + width of the table.\\ + \hline + \end{tabularx} + \vskip-1.8ex + \margincaption{A: Some description \label{mtable1}} +\end{margintable} +% +% +\begin{marginfigure}|-500pt|% + \someimage{\marginparwidth}{70pt}{D}%% + \margincaption[A: Second margin]{A: Second margin figure with a very long label to take many + lines.\label{rectangle2}}% +\end{marginfigure}% +% +% +\sidenote*|-40pt|{The gaps between the above floats can be increase by setting the length of {\upshape \textbackslash +\textsf{marginparpush} }, e.g {\upshape 15pt}. The effect is visible on next page} +\setlength{\marginparpush}{15pt} +% +% +\begin{figure}[h] +\raggedinner + \sidecaption[A: Side caption]{A: \emph{Side caption} with raggedinner command in figure + ennvironment with a lengthy text \lipsum[7][4-5] } + \label{imageD} + \someimage{0.75*\textwidth}{70pt}{E}% +\end{figure} +% +% +\begin{figure*}[h] +\centering + \someimage{\linewidth}{100pt}{Full width figure}% + \caption[A: Full width] {\emph{Full width} \lipsum[12][1-5]} + \label{imagefw} +\end{figure*} +\lipsum[3][4-6]\sidenote<-10pt>{\lipsum[3][1-2]}\par\lipsum[7][4-9] +\newpage + +\subsection*{Figure demonstration page B} +\begin{figure}[h] +\centering + \someimage{0.75*\textwidth}{70pt}{A}% + \caption{B: Short caption} + \label{imageA} +\end{figure} + +\lipsum[3][4-8] + +\begin{figure}[h] +\centering + \someimage{0.75*\textwidth}{70pt}{B}% + \caption[B: Long caption] {B: \emph{Long caption} \lipsum[3][1-3]} + \label{imageB} +\end{figure} +% +% +\begin{marginfigure}|-500pt|% + \someimage{\marginparwidth}{70pt}{C}%% + \margincaption {B: small rectangle in the margin.\label{rectangle1}}% +\end{marginfigure}% +% +% +\begin{margintable}|-500pt| +\upshape +\begin{tabularx}{\marginparwidth}{c X} + \hline + \multicolumn{2}{c}{Long Table Heading}\\ + Item&Description\\ + \hline + one& The width of this column depends on the + width of the table.\\ + \hline + \end{tabularx} + \vskip-1.8ex + \margincaption{B: Some description \label{mtable1}} +\end{margintable} +% +% +\begin{marginfigure}|-500pt|% + \someimage{\marginparwidth}{70pt}{D}%% + \margincaption[B: Second margin]{B: Second margin figure with a very long label to take many + lines.\label{rectangle2}}% +\end{marginfigure}% +% +% +\sidenote*|-40pt|{Note the larger gaps between the above floats as {\upshape \textbackslash +\textsf{marginparpush} } was set to {\upshape 15pt}.} +% +% +\begin{figure}[h] +\raggedinner + \sidecaption[B: Side caption]{B: \emph{Side caption} with raggedinner command in figure + ennvironment \lipsum[7][4-5]} + \label{imageD} + \someimage{0.75*\textwidth}{70pt}{E}% +\end{figure} +% +% +\begin{figure*}[h] +\centering + \someimage{\linewidth}{100pt}{Full width figure}% + \caption[B: Full width] {\emph{Full width} \lipsum[12][1-5]} + \label{imagefw} +\end{figure*} +\lipsum[3][4-6]\sidenote<-10pt>{\lipsum[3][1-2]}\par\lipsum[7][4-9] +\newpage + + +\newpage +And a final check +\listoffigures +\listoftables + + + +\end{document} diff --git a/macros/latex/contrib/tugboat/NEWS b/macros/latex/contrib/tugboat/NEWS index 01259306ea..6290fafdc2 100644 --- a/macros/latex/contrib/tugboat/NEWS +++ b/macros/latex/contrib/tugboat/NEWS @@ -1,6 +1,27 @@ -$Id: NEWS 376 2021-06-27 16:27:44Z karl $ +$Id: NEWS 424 2022-05-19 22:45:08Z karl $ This file records noteworthy changes. This file is public domain. +ltugboat.cls: +- \tbsurlfootnote, \tbhurlfootnote: typeset urls in ragged-right + footnotes of their own. +- \tubsentencespace: force a sentence-ending space, e.g., after a + post-sentence \cite. +- \tubjustifiedpar: undo ragged-right or other, restoring normal + paragraph settings. +- \eTeX: use \boldsymbol if available. + +----------------- +2.26 (2021-10-12): +ltugboat.cls: +- strip a leading http(s) from \tbsurl and \tbhurl. +- \Xe:increase negative kern. + +tugboat.bst: +- allow editor field as well as author for @misc entries. +- make @software another alias for @misc. +- improve doi urls. + +----------------- 2.25 (2021-06-27): ltugboat.cls: - new abbrevations: \RIT, \tbUTF. @@ -13,7 +34,7 @@ tugboat.bst: - new entry type @ctan, following ctanbib (https://ctan.org/pkg/ctanbib). - use \emph{...} instead of {\em ...}, so we get italic corrections. ----- +----------------- 2.24 (2020-11-14): ltugboat.cls: - new hyphenation exceptions: Ja-pa-nese, Pak-i-stan. diff --git a/macros/latex/contrib/tugboat/ltubguid.ltx b/macros/latex/contrib/tugboat/ltubguid.ltx index da93ceac25..1c017124e8 100644 --- a/macros/latex/contrib/tugboat/ltubguid.ltx +++ b/macros/latex/contrib/tugboat/ltubguid.ltx @@ -1,7 +1,7 @@ -% $Id: ltubguid.ltx 386 2021-09-28 22:25:51Z karl $ +% $Id: ltubguid.ltx 424 2022-05-19 22:45:08Z karl $ % ltubguid.ltx - documentation for ltugboat classes. % -% Copyright 1994-2021 TeX Users Group. +% Copyright 1994-2022 TeX Users Group. % % This file is part of the tugboat package. % @@ -614,7 +614,7 @@ and of course the class sources are the ultimate reference. \verb|\ConTeXt| & \ConTeXt \\ \verb|\Cplusplus| & \Cplusplus \\ \verb|\CTAN| & \CTAN \\ - \verb|\eTeX| & \eTeX \\ + \verb|\eTeX| & \eTeX\\ \verb|\FAQ| & \FAQ \\ \verb|\HTML| & \HTML \\ \verb|\ISBN| & \ISBN \\ @@ -648,9 +648,8 @@ paper. \subsection{Assorted other markup} -A small list of special typesetting commands follows: a large set of -such commands is defined in the classes, but the list covers most of -the `everyday' ones. +A small list of special typesetting commands follows; a larger set of +such commands is defined in the classes. \begin{cmdlist}\raggedright \item[\Dash] Typeset an em-dash, ignoring preceding and following space, surrounded by thin spaces, only breakable \emph{after} the dash; this @@ -668,7 +667,6 @@ the `everyday' ones. %\item[\sfrac{num}{denom}] Typeset a fraction to match running text; % for example \verb|\sfrac{3}{4}| is set as \sfrac{3}{4}\,. \end{cmdlist} - For commands to typeset urls, see section~\ref{sec:urls}. \section{Use of packages} @@ -684,12 +682,9 @@ zip or other archive. In general, packages currently on \CTAN, and known to work with \emph{current} \LaTeX{} are likely to be fine. In particular, the team is happy to accept papers using packages that are supported by -members of the \LaTeX\ team,\footnote{% +members of the \LaTeX\ team.\footnote{% Those in the \LaTeX{} base distribution, or one of those in the - \CTANref{packages} sub-tree on \CTAN.} subject to the warning already -mentioned (section~\ref{sec:verbatim}): that use of the standard -\pkgname{verbatim} package eliminates the special \envname{verbatim} -facilities provided by the \TUB\ classes. + \CTANref{packages} sub-tree on \CTAN.} \tug{} has a policy that macro packages described in \TUB{} should be available for readers to use. Since typing macros from printed sources @@ -712,7 +707,6 @@ Although not necessarily recommended in all cases, many additional packages are commonly used. To mention a few: \begin{description} \item[microtype] can help reduce overfull boxes and improve appearance; -\item[lmodern] use the Latin Modern fonts, sometimes preferable; \item[hyperref] supports live and internal hyperlinks, outlines, and many other features. \end{description} @@ -754,6 +748,12 @@ protocol not be included; if live links are not being produced in the output, the printed url without the protocol suffices. (When a user copies/pastes url text into a browser, it will normally work.) +Two shortcut macros: \cs{tbsfootnoteurl} and \cs{tbhfootnoteurl} make a +ragged-right footnote with the respective \cs{tbXurl} command. We +recognize that sometimes the best option is to put urls in footnotes. +However, when it's sensible, writing them as either parentheticals in +the main text or in bibliography entries is preferred, to ease page breaking. + For \texttt{ftp}, \texttt{rsync}, and other protocols, it is best to always include them explicitly and use \cs{url}:\\ \verb|\url{ftp://tug.org}|,\\ \verb|\url{rsync://tug.org}|, etc. @@ -960,7 +960,6 @@ different (as discussed in section~\ref{sec:syntax}); arguments are (almost always) enclosed in braces instead of the various forms provided by the `plain' macros. -\newpage \SetBibJustification{\raggedright} \bibliographystyle{tugboat} \bibliography{tubguide} diff --git a/macros/latex/contrib/tugboat/ltubguid.pdf b/macros/latex/contrib/tugboat/ltubguid.pdf Binary files differindex 02091c20d9..70062833ef 100644 --- a/macros/latex/contrib/tugboat/ltubguid.pdf +++ b/macros/latex/contrib/tugboat/ltubguid.pdf diff --git a/macros/latex/contrib/tugboat/tugboat.bst b/macros/latex/contrib/tugboat/tugboat.bst index 806a63ad57..1e28f2d8dd 100644 --- a/macros/latex/contrib/tugboat/tugboat.bst +++ b/macros/latex/contrib/tugboat/tugboat.bst @@ -1,4 +1,4 @@ -%%% $Id: tugboat.bst 379 2021-08-29 17:31:15Z karl $ +%%% $Id: tugboat.bst 410 2021-11-24 17:46:03Z karl $ %%% TUGboat changes are public domain. %%% %%% Modified for TUGboat from abbrvurl.bst: @@ -437,7 +437,7 @@ FUNCTION {emphasize} %%% from trunc-auth.bst: %%% There are two constants that allow for the truncation of a list of author %%% (or editor) names -- max.names and trunc.num. And here's how they work: -%%% If there are max.names of fewer in the list, there is no truncation; but +%%% If there are max.names or fewer in the list, there is no truncation; but %%% if there are more than max.names, the list is truncated at the trunc.num %%% name, which is replaced by trunc.string (such as "et~al.", and names later %%% in the list are omitted). There's also a sanity check, making sure that: @@ -610,7 +610,6 @@ FUNCTION {format.date.direct} if$ } - FUNCTION {format.btitle} { title emphasize } @@ -939,8 +938,6 @@ FUNCTION {format.version} if$ } - - FUNCTION {format.eprint} { eprint empty$ { "" } @@ -1080,7 +1077,6 @@ FUNCTION {webpage} } % ...urlbst to here - FUNCTION {article} { output.bibitem format.authors "author" output.check diff --git a/macros/latex/contrib/tugboat/tugboat.dtx b/macros/latex/contrib/tugboat/tugboat.dtx index a37201087c..ffb09d15f3 100644 --- a/macros/latex/contrib/tugboat/tugboat.dtx +++ b/macros/latex/contrib/tugboat/tugboat.dtx @@ -1,8 +1,8 @@ % \iffalse (this is a meta-comment (so they say)) -% $Id: tugboat.dtx 392 2021-10-12 21:31:32Z karl $ +% $Id: tugboat.dtx 424 2022-05-19 22:45:08Z karl $ % tugboat.dtx - main source for LaTeX TUGboat classes. % -% Copyright 1994-2021 TeX Users Group. +% Copyright 1994-2022 TeX Users Group. % % This file is part of the tugboat package. % @@ -28,7 +28,7 @@ %<ltugboatsty>\ProvidesPackage{ltugboat} %<ltugprocsty>\ProvidesPackage{ltugproc} %<ltugcomn> \ProvidesPackage{ltugcomn} - [2021-10-12 v2.26 + [2022-05-19 v2.27 %<ltugboatcls> TUGboat journal class% %<ltugproccls> TUG conference proceedings class% %<ltugboatsty|ltugprocsty> TUG compatibility package% @@ -347,7 +347,9 @@ % \texttt{draft} option above. If \texttt{hyperref} is not loaded, % define our own trivial fallback to expand to the \TeX\ (first) argument. % -% Similarly, disable \acro if we have hyperref, commonly used in sections. +% Similarly, disable \acro and more if we have \texttt{hyperref}, +% so section titles using them don't cause useless warnings. +% % \begin{macrocode} \AtBeginDocument{% \ifx\undefined\texorpdfstring @@ -357,6 +359,7 @@ \ifx\undefined\pdfstringdefDisableCommands\else \pdfstringdefDisableCommands{% \let\acro\relax + \let\origDash=\Dash \def\Dash{\texorpdfstring{\origDash}{--}}% % lots more could be added. }% \fi @@ -706,8 +709,19 @@ \def\DVItoVDU{DVIto\kern-.12em VDU} \def\ECMA{\acro{ECMA}} \def\EPS{\acro{EPS}} -% no line break at this hyphen please -\DeclareRobustCommand{\eTeX}{\ensuremath{\varepsilon}\mbox{-}\kern-.125em\TeX} +% no line break at this hyphen please, and try to get a bold \varepsilon. +\def\TUBdefaulteTeX{\ensuremath{\varepsilon}\mbox{-}\kern-.125em\TeX}% +\DeclareRobustCommand{\eTeX}{% + \ifx\f@series\bfseries@rm + \ifx\boldsymbol\undefined % \boldsymbol is from amsmath; also support bm? + \TUBdefaulteTeX + \else + \ensuremath{\boldsymbol{\varepsilon}}\mbox{-}\kern-.125em\TeX + \fi + \else + \TUBdefaulteTeX + \fi +} \DeclareRobustCommand{\ExTeX}{% \ensuremath{\textstyle\varepsilon_{\kern-0.15em\cal{X}}}\kern-.2em\TeX} \def\FAQ{\acro{FAQ}} @@ -729,7 +743,7 @@ \def\JTeX{\leavevmode\hbox{\lower.5ex\hbox{J}\kern-.18em\TeX}} \def\JoT{\textsl{The Joy of \TeX}} \DeclareRobustCommand{\KOMAScript}{\textsf{K\kern.05em O\kern.05em% - M\kern.05em A\kern.1em-\kern.1em Script}} + M\kern.05em A\kern.1em\hyph\kern.1em Script}} \def\LAMSTeX{L\raise.42ex\hbox{\kern-.3em $\m@th$\fontsize\sf@size\z@\selectfont $\m@th\mathcal{A}$}% @@ -937,7 +951,24 @@ \def\newline{\hskip\z@\@plus\pagewd\break} % \end{macrocode} % -% Hyphen control: first, we save the hyphenpenalties in +% \begin{macro}{\tubsentencespace} +% +% Occasionally, notably after citations that need to come after a +% sentence-ending period, we want to tell \TeX\ that it's still at the +% end of a sentence. As in: +% |... whatever. \cite{foo}\tubsentencespace| +% This happens when, e.g., the reference applies to more than the final +% sentence. Also can be needed when \cs{@} cannot be used because the +% sentence-ending punctuation itself occurs inside a control sequence +% that prevents it. +% +% \begin{macrocode} +\def\tubsentencespace{\spacefactor=3000{}\space\ignorespaces} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\allowhyphens} +% Hyphen control: first, we save (via \cs{edef}) the hyphenpenalties in % \cs{allowhyphens}. This allows us to permit hyphens temporarily in % things like \cs{netaddress}es, which typically occur when % \cs{raggedright} is set, but which need to be allowed to break at @@ -948,6 +979,7 @@ \noexpand\exhyphenpenalty\the\exhyphenpenalty\relax} \def\nohyphens{\hyphenpenalty\@M\exhyphenpenalty\@M} % \end{macrocode} +% \end{macro} % % \subsection{Utility registers and definitions} % @@ -1118,6 +1150,14 @@ % \end{macro} % \end{macro} % +% \begin{macro}{\tubjustifiedpar} +% Undo the \cs{raggedright} (or other such) settings, restoring normality. +% \begin{macrocode} +\def\tubjustifiedpar{\rightskip=0pt \parfillskip=0pt plus1fil + \allowhyphens \normalspaces} +% \end{macrocode} +% \end{macro} +% % \subsection{Assorted user-level markup} % % \LaTeXe{} defines a robust \cs{,}, but that we provide a new definition @@ -1218,8 +1258,8 @@ % turn on expl syntax for the main definitions of \tb[sh]url. We want % to auto-remove an explicit protocol in case it % was given. Only the correct protocol is removed, the incorrect -% protocol (\tbsurl{http://}) generates an invalid link. That's ok -% because the link wouldn't be correct anyway. +% protocol (\verb|\tbsurl{http://}|) generates an invalid link. That's ok +% because the link wouldn't work anyway. \ExplSyntaxOn \def\tbsurl@#1 % https { @@ -1228,7 +1268,6 @@ \expandafter\hyper@linkurl\expandafter{\expandafter\Hurl\expandafter {\l_tmpa_str}}{https://\l_tmpa_str} } - \def\tbhurl@#1 % http { \str_set:Nn\l_tmpa_str{#1} @@ -1238,6 +1277,11 @@ } \ExplSyntaxOff % +% Now let's use those macros for putting a url into a simple +% ragged-right footnote. +\def\tbsurlfootnote#1{\footnote{\raggedright\tbsurl{#1}}} +\def\tbhurlfootnote#1{\footnote{\raggedright\tbhurl{#1}}} +% % Make \! work in text mode. \DeclareRobustCommand{\!}{\ifmmode\mskip-\thinmuskip \else\kern-0.16667em \fi} % @@ -2748,9 +2792,24 @@ % Getting named references is then just like getting page references in % the \LaTeX\ kernel (see |ltxref.dtx|). % +% The above was written by RobinF decades ago; the macros in \TUB\ were +% never changed. Meanwhile, the \cs{nameref} in \texttt{hyperref} has +% changed many times, and we want to use its version if available. So we +% provide our \cs{nameref} \cs{AtBeginDocument}, so as not to overwrite +% any previous version. Until May 2022, \texttt{hyperref} silently +% overwrote an existing definition, that is, \TUB's. But now it is no +% longer silent. +% +% It seems that all the internal definitions above do not cause +% problems, so just let them alone. +% % \begin{macrocode} -\DeclareRobustCommand{\nameref}[1]{\expandafter\@setref - \csname r@nr@#1\endcsname\@secondoftwo{#1}} +\AtBeginDocument{% + \providecommand\nameref[1]{% + \expandafter\@setref + \csname r@nr@#1\endcsname\@secondoftwo{#1}% + }% +} % \end{macrocode} % % \subsection{Float captions} @@ -3504,7 +3563,7 @@ %</common> % \end{macrocode} % -% \subsection{Miscellaneous definitions} +% \subsection{Editor's notes and other footnotes} % % \cs{EdNote} allows the editor to enter notes in the text of a paper. % If the command is given something that appears like an optional diff --git a/macros/latex/contrib/tugboat/tugboat.pdf b/macros/latex/contrib/tugboat/tugboat.pdf Binary files differindex 97c1f134f8..a3a9959c7e 100644 --- a/macros/latex/contrib/tugboat/tugboat.pdf +++ b/macros/latex/contrib/tugboat/tugboat.pdf |