From 4e2bc5d88938c53a614ca1efafe6680e25d24c76 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 30 Jul 2016 23:12:23 +0000 Subject: parnotes (26jul16) git-svn-id: svn://tug.org/texlive/trunk@41775 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/parnotes/README | 16 - .../texmf-dist/doc/latex/parnotes/README.TEXLIVE | 7 - Master/texmf-dist/doc/latex/parnotes/README.md | 32 ++ Master/texmf-dist/doc/latex/parnotes/parnotes.pdf | Bin 0 -> 118059 bytes Master/texmf-dist/doc/latex/parnotes/parnotes.tex | 358 +++++++++++++++++++++ Master/texmf-dist/tex/latex/parnotes/parnotes.sty | 237 ++++++++++---- Master/tlpkg/libexec/ctan2tds | 1 - 7 files changed, 557 insertions(+), 94 deletions(-) delete mode 100644 Master/texmf-dist/doc/latex/parnotes/README delete mode 100644 Master/texmf-dist/doc/latex/parnotes/README.TEXLIVE create mode 100644 Master/texmf-dist/doc/latex/parnotes/README.md create mode 100644 Master/texmf-dist/doc/latex/parnotes/parnotes.pdf create mode 100644 Master/texmf-dist/doc/latex/parnotes/parnotes.tex diff --git a/Master/texmf-dist/doc/latex/parnotes/README b/Master/texmf-dist/doc/latex/parnotes/README deleted file mode 100644 index 21485007e91..00000000000 --- a/Master/texmf-dist/doc/latex/parnotes/README +++ /dev/null @@ -1,16 +0,0 @@ -The parnotes package adds a new note type, \parnote. Parnotes are set as -normal, running paragraphs and may be placed two ways: (1) Automatically, -at the end of the paragraph (2) Manually, using the \parnotes command. - -To place notes automatically after every paragraph, use the autopn -environment: - \begin{autopn} - Text\parnote{parnote} - - Text - \end{autopn} -If environments are used within autopn, another autopn environment must be -nested within them. To place notes elsewhere, use the \parnotes command. - -This is revision 1, last modified 01/03/12 -See parnotes.sty for copyright and contact details. diff --git a/Master/texmf-dist/doc/latex/parnotes/README.TEXLIVE b/Master/texmf-dist/doc/latex/parnotes/README.TEXLIVE deleted file mode 100644 index 3ee342dbaa2..00000000000 --- a/Master/texmf-dist/doc/latex/parnotes/README.TEXLIVE +++ /dev/null @@ -1,7 +0,0 @@ -The following files have been removed in the TeX Live installation of -the current package, typically due to duplication, lack of space, or -missing source code. You can find these files on CTAN at - http://mirror.ctan.org/macros/latex/contrib/parnotes -If questions or concerns, email tex-live@tug.org. - - PNmanual.pdf diff --git a/Master/texmf-dist/doc/latex/parnotes/README.md b/Master/texmf-dist/doc/latex/parnotes/README.md new file mode 100644 index 00000000000..01fbad502bb --- /dev/null +++ b/Master/texmf-dist/doc/latex/parnotes/README.md @@ -0,0 +1,32 @@ +parnotes +======== + +The parnotes package adds a new note type, `\parnote`. Parnotes are set as normal, running paragraphs and may be placed two ways: (1) automatically, at the end of the paragraph, or (2) manually, using the `\parnotes` command. + +To place parnotes automatically after every paragraph, use the `autopn` environment: + + \begin{autopn} + Text\parnote{parnote} + + Text + \end{autopn} + +If environments are used within `autopn`, another `autopn` environment must be nested within them. To place notes elsewhere, use the `\parnotes` command. + +For more details, read the project documentation in `parnotes.pdf`. + +Bugs and Source +--------------- +The development repository and the bug tracker for this package are hosted at https://github.com/chelh/LaTeX-parnotes + +License +------- +Copyright (c) 2016 Chelsea Hughes + +This work is distributed under the LaTeX Project Public License, version 1.3 or later, available at http://www.latex-project.org/lppl.txt + +I currently maintain this project (comprising `parnotes.sty`, `parnotes.tex`, `README.md`, and the derived file `parnotes.pdf`) and will receive error reports at the project GitHub page (see **Bugs and Source** above). + +This package was started due to a question at the TeX Stack Exchange: http://tex.stackexchange.com/questions/34746/ + +Thanks to Stack Exchange users Ahmed Musa, Bruno Le Floch, and David Carlisle. diff --git a/Master/texmf-dist/doc/latex/parnotes/parnotes.pdf b/Master/texmf-dist/doc/latex/parnotes/parnotes.pdf new file mode 100644 index 00000000000..7ae2b0a0043 Binary files /dev/null and b/Master/texmf-dist/doc/latex/parnotes/parnotes.pdf differ diff --git a/Master/texmf-dist/doc/latex/parnotes/parnotes.tex b/Master/texmf-dist/doc/latex/parnotes/parnotes.tex new file mode 100644 index 00000000000..9617a873d34 --- /dev/null +++ b/Master/texmf-dist/doc/latex/parnotes/parnotes.tex @@ -0,0 +1,358 @@ +\documentclass[10pt]{article} +\usepackage[USenglish,english]{babel} +\selectlanguage{USenglish} +\usepackage[no-math]{fontspec} +\defaultfontfeatures{Ligatures=TeX} +\def\MinionDefaults{% + SizeFeatures = { + {Size = -8.41, OpticalSize = 8, Numbers = Lining}, + {Size = 8.41-13.1, OpticalSize = 11}, + {Size = 13.1-20.0, OpticalSize = 19}, + {Size = 20.0-, OpticalSize = 72}}, + Numbers = {OldStyle,Monospaced}} +\setmainfont[\MinionDefaults, + BoldFont = {Minion Pro Semibold}]{Minion Pro} +\setsansfont[Scale=MatchLowercase, BoldFont = {Myriad Pro Semibold}]{Myriad Pro} +\setmonofont[Scale=MatchLowercase]{Consolas} +\usepackage{amsmath} +\usepackage{parnotes} +\usepackage{xcolor} +\usepackage[colorlinks]{hyperref} +\hypersetup{allcolors=blue} +\usepackage{varwidth} +\usepackage{accsupp} +\DeclareRobustCommand\squelch[1]{% + \BeginAccSupp{method=plain,ActualText={}}#1\EndAccSupp{}} +\def\squelchstyle{% + \BeginAccSupp{method=plain,ActualText={}}% + \aftergroup\aftersquelchstyle} +\def\aftersquelchstyle{\EndAccSupp{}} +\usepackage{fancyhdr} +\fancypagestyle{plain}{% + \fancyhf{}% + \fancyfoot[C]{\squelch{\thepage}}% + \renewcommand{\headrulewidth}{0pt}% + \renewcommand{\footrulewidth}{0pt}% +} +\pagestyle{plain} +\usepackage{listings} +\lstset{numbers=left,basicstyle={\small\ttfamily},numberstyle={\squelchstyle\color{gray}}} +\usepackage{booktabs} + +\title{The \textsf{parnotes} package\parnote{This is rev.~2, last modified 7/26/2016.}} +\author{Chelsea Hughes\parnote{See \texttt{parnotes.sty} for copyright and contact details.}} +\date{July 26, 2016} + +\renewcommand{\parnotefmt}[1]{\centerline{\colorbox{black!10}{\parbox{0.82\textwidth}{\footnotesize\sffamily\noindent #1}}}} + +\begin{document} +\maketitle +\parnotes +The \textsf{parnotes} package adds a new note type, \verb+\parnote+. Parnotes are set as normal, running paragraphs and may be placed two ways: +\begin{itemize} +\item Automatically, at the end of the paragraph +\item Manually, using the \verb+\parnotes+ command +\end{itemize} +This package was inspired by a question on the \TeX\ Stack Exchange\parnote{``Placing footnotes or endnotes at the end of the current paragraph'' at +\url{http://tex.stackexchange.com/questions/34746}} that asked for notes +which are placeable immediately after the paragraph in which they are mentioned, to avoid +the interruption posed by footnotes. + +\parnotes +\bigskip +\section{Usage} +Load parnotes normally: + +\medskip\fbox{\texttt{\textbackslash{}usepackage[}$\langle$\textit{options}$\rangle$\texttt{]\{parnotes\}}} + +\medskip\noindent The package options are described in section 2.1. + +\medskip\fbox{\texttt{\textbackslash{}parnote\{}$\langle$\textit{text}$\rangle$\texttt{\}}} + +\medskip\noindent Place a parnote mark and assign it note $\langle$\textit{text}$\rangle$. This mark is placeable within headings but will not appear in the table of contents. + +\medskip\fbox{\texttt{\textbackslash{}parnote[}$\langle$\textit{mark}$\rangle$\texttt{]\{}$\langle$\textit{text}$\rangle$\texttt{\}}} + +\medskip\noindent As above, but use $\langle$\textit{mark}$\rangle$ instead of the standard auto-incrementing parnote mark. + +\medskip\fbox{\begin{varwidth}{\textwidth}\texttt{\textbackslash{}begin\{autopn\}\\\textbackslash{}end\{autopn\}}\end{varwidth}} + +\medskip\noindent Parnotes within an \texttt{autopn} environment are set automatically at the end of every paragraph. This behavior does not carry into nested environments. To set parnotes inside another environment, nest \texttt{autopn} within it or use \verb+\parnotes+. + +\medskip\fbox{\texttt{\textbackslash{}parnotes}} + +\medskip\noindent Place all parnotes immediately. Use it after every paragraph for \texttt{autopn}-like behavior outside \texttt{autopn} (or where \texttt{autopn} doesn’t apply). + +\medskip\fbox{\texttt{\textbackslash{}parnotereset}} + +\medskip\noindent Reset the parnote number. This maps to \verb+\setcounter{parnotemark}{1}+. + +\medskip\fbox{\texttt{\textbackslash{}parnoteclear}} + +\medskip\noindent Reset the parnote number and also delete any pending parnotes. + +\medskip\fbox{\texttt{\textbackslash{}parnoteref\{$\langle$\textrm{\textit{label}}$\rangle$\}}} + +\medskip\noindent Refer to previous parnote mark $\langle$\textit{label}$\rangle$. Use the standard \LaTeX\ macro \verb+\label+ within a parnote to assign it a label. You may also use the standard \LaTeX\ reference macros \verb+\ref+ and \verb+\pageref+. + +\section{Configuration} +Configure \textsf{parnotes} using package options, or manually using format macros. + +\subsection{Package options} +The following options are provided: + +\noindent\begin{tabbing} +\texttt{restart}\hspace{0.75in}\=Reset the parnote number each time parnotes are placed.\\ +\texttt{roman}\>Use lowercase Roman numerals instead of Arabic numerals for\\ +\>parnote marks. Specify this if you mix parnotes with footnotes.\\ +\texttt{breakwithin}\>Place a line break after every parnote.\\ +\texttt{indentafter}\>Allow indentation in the paragraph following a parnote.\\ +\texttt{narrower}\>Give parnotes an increased margin, like block quotes.\\ +\texttt{nomultiple}\>Disable special behavior for multiple consecutive parnotes.\\[1ex] +The following options change the font used within parnotes:\\[1ex] +\texttt{notesrm}\>Roman. Default.\\ +\texttt{notesit}\>Italic.\\ +\texttt{notessf}\>Sans-serif. +\end{tabbing} + +\subsection{Format macros} +Five internal macros control formatting for parnotes and parnote marks: + +\medskip\fbox{\begin{varwidth}{\textwidth}\texttt{\textbackslash{}parnotefmt\{}$\langle$\textit{text}$\rangle$\texttt{\}\\ +\textbackslash{}theparnotemark\{}$\langle$\textit{counter}$\rangle$\texttt{\}\\ +\textbackslash{}parnotevskip\\ +\textbackslash{}parnoteintercmd\\ +\textbackslash{}parnotecusmarkfmt\{}$\langle$\textit{mark}$\rangle$\texttt{\}}\end{varwidth}} + +\medskip\noindent Parnote text is set using \verb+\parnotefmt+, and parnote marks using \verb+\parnotecusmarkfmt+. +When the optional argument of \verb+\parnote+ is \emph{not} used, \verb+\theparnotemark+ is used to get +the parnote mark for formatting. +At least \verb+\parnotevskip+ vertical space appears before and after the parnote text. The macro +\verb+\parnoteintercmd+ is executed between all consecutive parnotes. + +\textsf{parnotes} rev.~1 had a different macro, \verb+\parnotemarkfmt+, to control parnote marks. +Unfortunately, the definition of this macro is incompatible with the new feature in rev.~2 allowing for manually-specified parnote marks, +so it had to be split into two macros \verb+\parnotecusmarkfmt+ and \verb+\theparnotemark+. This is a breaking change. + +Table~1 shows these macros' default values. Note that the package options \texttt{narrower}, +\texttt{notesrm}, \texttt{notesit}, and \texttt{notessf} modify \verb+\parnotefmt+. +The option \texttt{roman} modifies \verb+\theparnotemark+. +The option \texttt{breakwithin} changes \verb+\parnoteintercmd+ into a line break. + +\begin{table}[t] +\centering +\caption{Default values for format macros.} +\smallskip +\begin{tabular}{ll} +\toprule +Macro & Default value \\ +\midrule +\verb+\parnotefmt+ & \verb+\footnotesize\rmfamily\noindent #1+ \\ +\verb+\theparnotemark+ & \verb+\arabic{parnotemark}+ \\ +\verb+\parnotevskip+ & \verb+\medskipamount+ \\ +\verb+\parnoteintercmd+ & \verb+\hspace{1em plus 0.3em minus 0.2em}+ \\ +\verb+\parnotecusmarkfmt+ & \verb+\textsuperscript{#1}+ \\ +\bottomrule +\end{tabular} +\end{table} + +Redefine these macros using \verb+\renewcommand+ to fine-tune \textsf{parnotes}'s formatting. For +example, to set parnotes in a sans-serif font, load \textsf{parnotes} as follows: +\begin{lstlisting} +\usepackage{parnotes} +\renewcommand{\parnotefmt}[1]{\footnotesize\sffamily\noindent #1} +\end{lstlisting} +This is the same as specifying the \texttt{notessf} package option. + +To have parnotes set as \textit{completely normal text}, but one size smaller than their surroundings (using \verb+\smaller+ from \textsf{relsize}): +\begin{lstlisting} +\usepackage{relsize} +\usepackage[indentafter]{parnotes} +\renewcommand{\parnotefmt}[1]{\smaller #1} +\renewcommand{\parnotevskip}{0pt} +\end{lstlisting} +Or to set parnotes in a block set off by rules, with each parnote separated by a bullet: +\begin{lstlisting} +\usepackage{parnotes} +\renewcommand{\parnotevskip}{0pt} +\renewcommand{\parnotefmt}[1]{\footnotesize\rmfamily + \noindent\rule{\linewidth}{1pt}\\ + \noindent #1\par + \noindent\rule{\linewidth}{1pt} +} +\renewcommand{\parnoteintercmd}{\;$\bullet$\;} +\end{lstlisting} + +Note that since \verb+\parnotefmt+ is redefined, adding the package option \texttt{narrower} to this example will not work; +instead, \verb+\narrower+ must be placed manually within the new definition for \verb+\parnotefmt+. + +\section{Changelog} +{\raggedright +\noindent\textbf{Revision 2, released on Jul 26, 2016} +\begin{itemize} +\item \textbf{Breaking change:} You can no longer redefine \verb+\parnotemarkfmt+. Use \verb+\theparnotemark+ and \verb+\parnotecusmarkfmt+ instead. See section~2.2 for details. +\item Bug fix: \verb+\parnotefmt+ no longer changes the font to \verb+\rmfamily+ by default. +\item \verb+\parnote+ now behaves more like \verb+\footnote+: + \begin{itemize} + \item It respects \verb+\spacefactor+ + \item It no longer inserts \verb+\unskip+ + \end{itemize} +\item The parnote mark counter may be reset using standard LaTeX macros, e.g., \verb+\setcounter{parnotemark}{5}+ +\item \verb+\label+ now works within parnote text; \verb+\ref+ returns the parnote label, \verb+\pageref+ returns the page where the note \emph{text} is set, and \verb+\parnoteref+ returns the parnote label formatted as a mark. +\item Implemented the system for separators between multiple footnotes from \textsf{footmisc} and \textsf{manyfoot} and added package option \texttt{nomultiple} to disable. +\item Internal: The package now uses a single counter (\verb+\c@parnotemark+) for marks. +\end{itemize} +\noindent\textbf{Revision 1, released on Jan 3, 2012} +\begin{itemize} +\item Initial release. +\end{itemize}} + +\section{Example} +The following pages show a typeset example using \textsf{parnotes}, including interactions with lists, +headings, and environments (here, multicolumn text from the \textsf{multicol} package). +\begin{lstlisting} +\documentclass{article} +\usepackage{multicol} % for demonstration +\usepackage{lipsum} % for demonstration +\usepackage[narrower,notessf]{parnotes} + +\begin{document} +\begin{autopn} +\begin{abstract} +\begin{autopn} +Since this is in an environment, \texttt{autopn} must be nested within +it.\parnote{If \texttt{autopn} \emph{weren't} nested, I could've used +\texttt{\textbackslash parnotes} here to set parnotes manually.} +\end{autopn} +\end{abstract} +\tableofcontents +\section{On parnotes\parnote{Parnote marks will display in a heading, +but not within the table of contents. In \texttt{autopn}, parnotes will +display right after the heading.}} + +This is a paragraph with a parnote\parnote{See? And it's long enough +to push the \emph{next} parnote nearer the end of the line.}. Actually, +it has two.\parnote{By default, parnotes are set in a continuous +paragraph with 1~em of space between each note.} This sentence ends +the paragraph, but it doesn't have a parnote. + +This is a normal paragraph. Note that it isn't indented since the +parnotes make it obvious where the paragraph boundaries are. To change +this behavior, use the \texttt{indentafter} option. + +This paragraph's indentation isn't changed. + +Here's an environment with a nested \texttt{autopn}: +\begin{multicols}{2} +\begin{autopn} +Since parnotes are set within the normal paragraph flow, they interact +well with environments\parnote{Like this multicolumn environment from +\textsf{multicols} -- it will break columns and pages along with +the normal text within the environment.}. + +This is just filler text without any parnotes. +\end{autopn} +\end{multicols} +Here's an environment without a nested \texttt{autopn}: +\begin{multicols}{2} +Without a nested \texttt{autopn}, any parnotes\parnote{Like this one.} +will be set after the end of the next paragraph \emph{outside} this +environment. If \texttt{\textbackslash parnotes} is called just before +the environment ends, then the parnotes will be set within that +environment. This is useful for, say, multi-paragraph quotes. + +This environment always specifies that it ends a paragraph, so +parnotes will always be set after it if needed. In some other +circumstances, \texttt{autopn} may not ``see'' that there's a +paragraph break after the environment, so +\texttt{\textbackslash parnotes} will have to be called after the +environment ends. +\end{multicols} + +Here's an extra-long parnote\parnote{\lipsum[1]}, to show that parnotes +can break pages. In fact, \TeX\ should prefer to break the page within +the parnotes rather than between this text and the start of the +parnotes. +\end{autopn} + +In some circumstances, it's best to forego \texttt{autopn} altogether +-- for example, if parnotes\parnote{Like this one.} should only be +set after several paragraphs. Then just call +\texttt{\textbackslash parnotes} wherever the parnotes should be set. + +The same applies if parnotes are to be placed only at the end of a +section, or at a ``scene break.'' +\parnotes + +The only limiting factor is that \texttt{\textbackslash parnotes} must +be executed after the parnotes it refers to. Here's a table with notes +in an adjacent minipage:\\[0.5in] +\hspace*{\fill} +\begin{tabular}{|c|c|} +\hline a & b\parnote{Note 1} \\ \hline c\parnote{Note 2} & d \\ \hline +\end{tabular} +\hspace{1in} +\begin{minipage}{3in} +% locally redefining format macros so the notes are on separate +% lines, with no vertical space +\renewcommand{\parnoteintercmd}{\\} +\renewcommand{\parnotevskip}{0pt} +\textbf{Notes:} +\parnotes +\end{minipage}\\[0.5in] +Now for a list: +\begin{enumerate} +\begin{autopn} +\item This item has no parnote. +\item This one does\parnote{See? But notice that +\texttt{\textbackslash narrower} doesn't work in lists, so +this is set flush with the list's margin}. +\item This one has a parnote\parnote{Would I ever lie to you?} in its +first paragraph\dots + +But not in its second. +\end{autopn} +\end{enumerate} +New features in \textsf{parnotes} rev.~2: Multiple parnote marks% +\parnote{Parnote 1}\parnote{Parnote 2}. +Manually-specified marks\parnote[aaa]{Parnote with special mark% +\label{pn:special}} and references (see~\ref{pn:special}, +p.~\pageref{pn:special}), allowing you to re-use parnote marks% +\parnotemark{\ref{pn:special}}. +\parnotes +\end{document} +\end{lstlisting} +\end{document} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Master/texmf-dist/tex/latex/parnotes/parnotes.sty b/Master/texmf-dist/tex/latex/parnotes/parnotes.sty index 797ca6319f6..5d394b7b92e 100644 --- a/Master/texmf-dist/tex/latex/parnotes/parnotes.sty +++ b/Master/texmf-dist/tex/latex/parnotes/parnotes.sty @@ -1,45 +1,47 @@ % The parnotes package % Notes after every paragraph, or elsewhere -% Copyright 2012, Michael Hughes +% Copyright (c) 2016 Chelsea Hughes % % This work is distributed under the LaTeX Project Public License, -% version 1.3 or later, available at +% version 1.3 or later, available at % http://www.latex-project.org/lppl.txt -% I currently maintain this project and will receive error reports at -% mcrh uw edu +% I currently maintain this project (comprising parnotes.sty, parnotes.tex, +% README.md, and the derived file parnotes.pdf) and will receive error reports at +% https://github.com/chelh/LaTeX-parnotes % % This package was started due to a question at the TeX Stack Exchange: % http://tex.stackexchange.com/questions/34746/ % -% Thanks to Stack Exchange users Ahmed Musa and Bruno Le Floch +% Thanks to Stack Exchange users Ahmed Musa, Bruno Le Floch, and David Carlisle. \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{parnotes}[2012/01/03 rev. 1 Notes after every paragraph, or elsewhere] +\ProvidesPackage{parnotes}[2016/07/26 rev. 2 Notes after every paragraph, or elsewhere] % % These are the user-modifiable format commands % -% Format for parnotes - \PN@notes@shape is \rmfamily by default +% Format for parnotes - \PN@notes@shape is blank (\relax) by default \providecommand{\parnotefmt}[1]{\footnotesize% \PN@notes@shape\PN@narrower@optional\noindent #1} -% Format for parnote marks - \PN@mark@set is \arabic by default -\providecommand{\parnotemarkfmt}[1]{\textsuperscript{\PN@mark@set{#1}}} +% Number format (arabic, roman, etc.) for the parnote mark counter +\providecommand{\theparnotemark}{\arabic{parnotemark}} % Minimum vertical space before and after parnotes \providecommand{\parnotevskip}{\medskipamount} % Full command used between parnotes -\providecommand{\parnoteintercmd}{\hspace{1em}} +\providecommand{\parnoteintercmd}{\hspace{1em plus 0.3em minus 0.2em}} +% Basic formatting for parnote marks +\providecommand{\parnotecusmarkfmt}[1]{\textsuperscript{#1}} % % Internal variables below this line % + % This holds all the parnote text \global\def\PN@text{} -% Counter for parnote marks left by \parnote -\global\newcount\c@PN@t -% Counter for parnote marks *within* parnotes -\global\newcount\c@PN@n +% Counter for parnote marks +\newcounter{parnotemark} % autopn environment name \def\@PN@autopn{autopn} % True if currently setting parnotes @@ -51,15 +53,11 @@ % Optionally reset the counter within \parnotes % \let\PN@reset@optional\relax -\DeclareOption{restart}{\def\PN@reset@optional{% - \global\c@PN@t=\z@ - \global\c@PN@n=\z@ -}} +\DeclareOption{restart}{\def\PN@reset@optional{\parnotereset}} % % Parnote marks are arabic by default, but an option changes them to roman % -\let\PN@mark@set\arabic -\DeclareOption{roman}{\let\PN@mark@set\roman} +\DeclareOption{roman}{\renewcommand\theparnotemark{\roman{parnotemark}}} % breakwithin just changes \parnoteintercmd \DeclareOption{breakwithin}{\renewcommand{\parnoteintercmd}{\\}} % And indentafter just clears \PN@disable@indent @@ -69,66 +67,164 @@ % \let\PN@narrower@optional\relax \DeclareOption{narrower}{\let\PN@narrower@optional\narrower} +% Allow the user to disable separators between multiple parnote marks +\DeclareOption{nomultiple}{\def\FN@mf@prepare{\relax}\def\FN@mf@check{\relax}} % % Font-changing options % -\let\PN@notes@shape\rmfamily +\let\PN@notes@shape\relax \DeclareOption{notesrm}{\let\PN@notes@shape\rmfamily} \DeclareOption{notessf}{\let\PN@notes@shape\sffamily} \DeclareOption{notesit}{\let\PN@notes@shape\itshape} % Finally process the options \ProcessOptions\relax -\long\def\PN@parnote@real#1{% - % Advance the counter used in TEXT immediately - \global\advance\c@PN@t\@ne - % - % Then add the command's argument to a macro to be called at the end - % of the paragraph (or wherever \parnotes gets called) - % - \g@addto@macro\PN@text{% - % Advance the counter used in the parnotes as the parnotes are set - \global\advance\c@PN@n\@ne - \parnotemarkfmt{PN@n}\nolinebreak\thinspace#1% - % - % This way, if the in-text counter equals the in-note counter, we - % know that we're at the final parnote for this batch and - % \parnoteintercmd shouldn't be executed - % - \unless\ifnum\c@PN@n=\c@PN@t - \parnoteintercmd - \fi - }% - \unskip\parnotemarkfmt{PN@t}% -} +% +% Provide a null implementation of \phantomsection in case hyperref +% isn't loaded +% +\providecommand\phantomsection{} +% Later, we'll check to see if this command was redefined +\let\parnotemarkfmt\@gobble + +% +% A wrapper for \PN@parnote@real. Takes an optional (manually-specified) +% mark and mandatory note text, and transforms them into the two mandatory +% arguments (mark and note text) for \PN@parnote@real. If no mark is +% specified, it will increment the counter parnotemark and pass its FULLY +% EXPANDED text value to \PN@parnote@real. That's two cases: +% +% 1: \parnote[MARK]{TEXT} -> \PN@parnote@real{MARK}{TEXT} +% 2: \parnote{TEXT} -> \PN@parnote@real{EXPANDED COUNTER}{TEXT} +% +% \parnote supports behavior like the stable option of the package +% footmisc, by Robin Fairbairns: If encountered in the Table of Contents, +% it will do nothing and expand nothing. That adds two more cases: % -% \parnote calls \PN@parnote@real if in typesetting mode, but does nothing -% elsewhere (i.e., in the table of contents) - this is based on the stable -% option of the footmisc package +% 3: \parnote[MARK]{TEXT} -> {} +% 4: \parnote{TEXT} -> {} % + \long\def\parnote{% +\ifx\@gobble\parnotemarkfmt\else + % Crash if the user has defined \parnotemarkfmt, as this is + % no longer supported + \PackageError{parnotes}{% + Cannot use custom definition of \protect\parnotemarkfmt\MessageBreak + in parnotes rev. 2 or later. Use + \protect\theparnotemark\MessageBreak + and \protect\parnotecusmarkfmt\space instead% + }{% + You've used an option that is no longer supported. + Downgrade back\MessageBreak + to parnotes rev. 1, or redefine \protect\theparnotemark\space + and \protect\parnotecusmarkfmt\MessageBreak + instead of \protect\parnotemarkfmt. See section + 2.2 of the parnotes manual for\MessageBreak + details. + }% +\fi +% This incorporates changes suggested by David Carlisle +\relax\ifx\@footnotetext\TX@trial@ftn\else \ifx\protect\@typeset@protect - \expandafter\PN@parnote@real + \expandafter\expandafter\expandafter\PN@check@args \else - \expandafter\@gobble + \expandafter\expandafter\expandafter\@gobble + \fi +\fi +} +\def\PN@check@args{% + \@ifnextchar [ + \PN@parnote@twoargs% Case 1 + \PN@parnote@onearg% Case 2 +} +\DeclareRobustCommand\PN@gobble@opt{% + \@ifnextchar [ + \PN@gobble@opt@@% Case 3 + \@gobble% Case 4 +} +\def\PN@parnote@twoargs[#1]#2{\PN@parnote@real{#1}{#2}} +\def\PN@parnote@onearg#1{% + % Fully expand the new counter value, as text + \begingroup\edef\@x{\endgroup\noexpand\PN@parnote@real% + {\theparnotemark}}\@x{#1}% + \global\advance\c@parnotemark\@ne +} +\def\PN@gobble@opt@@[#1]#2{} + +% +% Collects tokens into \PN@text, to be set when \parnotes is called. +% Everything added to \PN@text is expanded first. Takes two MANDATORY +% arguments, a mark and some note text. +% +\long\def\PN@parnote@real#1#2{% + \parnotemark{#1}% + % Unless this is the first parnote in \PN@text, add a separator first + \unless\ifx\PN@text\@empty\g@addto@macro\PN@text{\parnoteintercmd}\fi + % Redefine \@currentlabel to the parnote label, so \label works + \g@addto@macro\PN@text{\phantomsection\def\@currentlabel{#1}}% + \g@addto@macro\PN@text{\parnotemark{#1}\nolinebreak\thinspace#2}% +} + +\long\def\PN@parnote@compat#1{% + \parnotemarkfmt{parnotemark} + \unless\ifx\PN@text\@empty\g@addto@macro\PN@text{\parnoteintercmd}\fi + \g@addto@macro\PN@text{\phantomsection\def\@currentlabel{\arabic{parnotemark}}}% + \g@addto@macro\PN@text{\parnotemarkfmt{parnotemark}\nolinebreak\thinspace#1}% +} + +% +% Definitions to get multiple consecutive parnotes/footnotes working, as +% in footmisc and manyfoot; this is cribbed directly from footmisc +% +\providecommand*{\multiplefootnotemarker}{3sp} +\providecommand*{\multfootsep}{,} +\providecommand\FN@mf@prepare{% + \kern-\multiplefootnotemarker + \kern\multiplefootnotemarker\relax +} +\providecommand\FN@mf@check{% + \ifdim\lastkern=\multiplefootnotemarker\relax + \edef\@x@sf{\the\spacefactor}% + \unkern + \textsuperscript{\multfootsep}% + \spacefactor\@x@sf\relax + \fi +} + +% +% Sets the parnote mark (included as a MANDATORY argument) +% +\newcommand\parnotemark[1]{% + \leavevmode + \ifhmode + % Save the spacefactor, like \footnote + \edef\@x@sf{\the\spacefactor}% + \FN@mf@check + \nobreak + \fi + \parnotecusmarkfmt{#1}% + \FN@mf@prepare + \ifhmode\spacefactor\@x@sf\fi + \relax +} + +% +% Calls \PN@parnotes@real, if there are parnotes to set. +% +\newcommand\parnotes{% + \unless\ifx\PN@text\@empty + \expandafter\PN@parnotes@real \fi } \def\PN@parnotes@real{% % We call \par later, so this avoids recursion with \PN@parnotes@auto \PN@inparnotestrue - % - % Get into vmode if we aren't already - % - \unless\ifvmode - \par - \fi + \unless\ifvmode\par\fi % Avoid page breaks between a paragraph and its parnotes \nopagebreak\addvspace{\parnotevskip}% - % \parnotefmt goes in a separate group to avoid having formatting - % commands and local redefinitions of \parnotemarkfmt contaminate the - % following paragraphs {\parnotefmt{\PN@text}\par}% \global\def\PN@text{}% \addvspace{\parnotevskip}% @@ -152,15 +248,6 @@ } {\PN@parnotes@auto} % At the environment's end, set any notes we've missed -% -% If a user calls \parnotes, check that there are parnotes to set -% -\def\parnotes{% - \unless\ifx\PN@text\@empty - \expandafter\PN@parnotes@real - \fi -} - % % If autopn calls parnotes, check for nested environments, and that this % isn't a call to \par from within \PN@parnotes@real, AND that there are @@ -177,9 +264,19 @@ } % -% Reset both mark counters to 0 +% Set parnote counter to 1 % -\def\parnotereset{% - \global\c@PN@t=\z@ - \global\c@PN@n=\z@ +\newcommand\parnotereset{\setcounter{parnotemark}{1}} +% A variant also clears \PN@text +\newcommand\parnoteclear{% + \gdef\PN@text{}% + \parnotereset } + +% +% A wrapper around \ref to provide formatted parnote references +% +\newcommand\parnoteref[1]{\parnotemark{\ref{#1}}} + +% Set parnote mark counter to 1 initially +\parnotereset diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds index e8926ac3eca..694cc386cc6 100755 --- a/Master/tlpkg/libexec/ctan2tds +++ b/Master/tlpkg/libexec/ctan2tds @@ -2914,7 +2914,6 @@ $standardclean = '\.head|\.tmp|\.dvi|\.log|\.out|\.aux|\.toc|\.lof|\.lot' 'latexmk' => '(sweave_|tex4ht-)latexmkrc', # case-folding clash 'numericplots' => '.*\.m', # matlab 'oinuit' => 'cmssbxo10.tfm', # should not be here - 'parnotes' => 'PNmanual.pdf', # no source 'pas-cours' => '\.pdf$', # no source 'pas-tableur' => '\.pdf$', # no source 'piechartmp' => 'piechartmp.pdf', # no source -- cgit v1.2.3