diff options
author | Karl Berry <karl@freefriends.org> | 2020-12-15 22:21:35 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-12-15 22:21:35 +0000 |
commit | 31df9fd674e93a1c37a88762ce9eb25a31468db4 (patch) | |
tree | cc32a02bcb79c678f3c6db693dedfebca6c7d765 /Master | |
parent | 595a4e906e4a0ebe6b92b8747479bc4c0bfc6dd7 (diff) |
snotez (14dec20)
git-svn-id: svn://tug.org/texlive/trunk@57147 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/snotez/README | 12 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/snotez/snotez_en.pdf | bin | 457084 -> 446647 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/snotez/snotez_en.tex | 631 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/snotez/snotez.sty | 297 |
4 files changed, 462 insertions, 478 deletions
diff --git a/Master/texmf-dist/doc/latex/snotez/README b/Master/texmf-dist/doc/latex/snotez/README index 7e380fb034c..75671c058b3 100644 --- a/Master/texmf-dist/doc/latex/snotez/README +++ b/Master/texmf-dist/doc/latex/snotez/README @@ -1,5 +1,5 @@ -------------------------------------------------------------------------- -the SNOTEZ package v0.3 2013/04/21 +the SNOTEZ package v0.5a 2020/12/14 Sidenotes for LaTeX2e @@ -8,15 +8,15 @@ Clemens Niederberger Web: https://bitbucket.org/cgnieder/snotez/ E-Mail: contact@mychemistry.eu -------------------------------------------------------------------------- -Copyright 2012--2013 Clemens Niederberger +Copyright 2012--2020 Clemens Niederberger This work may be distributed and/or modified under the -conditions of the LaTeX Project Public License, either version 1.3 +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.3 or later is part of all distributions of LaTeX -version 2005/12/01 or later. +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'. @@ -27,4 +27,4 @@ The snotez package consists of the files -------------------------------------------------------------------------- If you have any ideas, questions, suggestions or bugs to report, please feel free to contact me. ---------------------------------------------------------------------------
\ No newline at end of file +-------------------------------------------------------------------------- diff --git a/Master/texmf-dist/doc/latex/snotez/snotez_en.pdf b/Master/texmf-dist/doc/latex/snotez/snotez_en.pdf Binary files differindex 99a82c7f661..54b0b73423b 100644 --- a/Master/texmf-dist/doc/latex/snotez/snotez_en.pdf +++ b/Master/texmf-dist/doc/latex/snotez/snotez_en.pdf diff --git a/Master/texmf-dist/doc/latex/snotez/snotez_en.tex b/Master/texmf-dist/doc/latex/snotez/snotez_en.tex index 5859ff025f7..c488fd49bb9 100644 --- a/Master/texmf-dist/doc/latex/snotez/snotez_en.tex +++ b/Master/texmf-dist/doc/latex/snotez/snotez_en.tex @@ -1,7 +1,3 @@ -% arara: pdflatex -% arara: biber -% arara: pdflatex -% arara: pdflatex % -------------------------------------------------------------------------- % the SNOTEZ package % @@ -12,401 +8,348 @@ % Web: https://bitbucket.org/cgnieder/snotez/ % E-Mail: contact@mychemistry.eu % -------------------------------------------------------------------------- -% Copyright 2012--2013 Clemens Niederberger +% Copyright 2012--2020 Clemens Niederberger % % This work may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either version 1.3 +% 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.3 or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% 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 Clemens Niederberger. % -------------------------------------------------------------------------- -% The snotez package consists of the files -% - snotez.sty, snotez_en.tex, snotez_en.pdf, README -% -------------------------------------------------------------------------- -% If you have any ideas, questions, suggestions or bugs to report, please -% feel free to contact me. -% -------------------------------------------------------------------------- -% in order to compile this documentation you need the document class -% `cnpkgdoc' which you can get here: -% https://bitbucket.org/cgnieder/cnpkgdoc/ -% -\PassOptionsToPackage{supstfm=libertinesups}{superiors} -\documentclass[toc=index,toc=bib,mpinclude]{cnpkgdoc} +\documentclass[load-preamble+]{cnltx-doc} +\setlength\textwidth{\dimexpr\textwidth-1.2\marginparwidth\relax} \setlength{\marginparwidth}{2\marginparwidth} -\docsetup{ - pkg={[footnote,perpage,dblarg]snotez}, - subtitle=sidenote support for \LaTeXe -} -\addcmds{ - RaggedRight, - sidenote,setsidenotes,superiors@spaced, - textsu -} -% Layout: -\cnpkgusecolorscheme{friendly} -\renewcommand*\othersectionlevelsformat[3]{% - \textcolor{main}{#3\autodot}\enskip} -\renewcommand*\partformat{% - \textcolor{main}{\partname~\thepart\autodot}} -\usepackage{fnpct} -\AdaptNoteOpt\sidenote\multsidenote -\pagestyle{headings} - -\usepackage[biblatex]{embrac}[2013/03/22] -\ChangeEmph{[}[,.02em]{]}[.055em,-.08em] -\ChangeEmph{(}[-.01em,.04em]{)}[.04em,-.05em] -\robustify\snotez - -\usepackage{libertinehologopatch} -\usepackage{ragged2e} - -\normalmarginpar - -% Index: -\usepackage{imakeidx} -\usepackage{filecontents} -\begin{filecontents*}{\jobname.ist} - heading_prefix "{\\bfseries " - heading_suffix "\\hfil}\\nopagebreak\n" - headings_flag 1 - delim_0 "\\dotfill\\hyperpage{" - delim_1 "\\dotfill\\hyperpage{" - delim_2 "\\dotfill\\hyperpage{" - delim_r "}\\textendash\\hyperpage{" - delim_t "}" - suffix_2p "\\nohyperpage{\\,f.}" - suffix_3p "\\nohyperpage{\\,ff.}" -\end{filecontents*} -\indexsetup{othercode=\footnotesize} -\makeindex[options={-s \jobname.ist},intoc,columns=3] - -\usepackage[backend=biber,style=alphabetic]{biblatex} -\addbibresource{\jobname.bib} -\begin{filecontents}{\jobname.bib} -@package{pkg:chngcntr, - title = {\paket*{chngcntr}}, - author = {Peter Wilson and Will Robertson}, - date = {2009-09-02}, - version = {1.0a}, - url = {http://mirror.ctan.org/macros/latex/contrib/chngcntr} -} -@package{pkg:etoolbox, - title = {\paket*{etoolbox}}, - author = {Philipp Lehman}, - date = {2011-01-21}, - version = {2.1}, - url = {http://mirror.ctan.org/macros/latex/contrib/etoolbox} -} -@package{pkg:fnpct, - title = {\paket*{fnpct}}, - author = {Clemens Niederberger}, - date = {2013-04-07}, - version = {0.2k}, - url = {http://mirror.ctan.org/macros/latex/contrib/fnpct} -} -@package{pkg:marginnote, - title = {\paket*{marginnote}}, - author = {Markus Kohm}, - date = {2012-03-29}, - version = {1.1i}, - url = {http://mirror.ctan.org/macros/latex/contrib/marginnote} -} -@package{cls:memoir, - title = {\klasse{memoir}}, - author = {Lars Madsen and Peter Wilson}, - date = {2011-03-06}, - version = {3.6j patch 6.0g}, - url = {http://mirror.ctan.org/macros/latex/contrib/memoir} -} -@package{pkg:perpage, - title = {\paket*{perpage}}, - author = {David Kastrup}, - date = {2006-07-15}, - version = {1.12}, - url = {http://mirror.ctan.org/macros/latex/contrib/perpage} -} -@package{pkg:pgfopts, - title = {\paket*{pgfopts}}, - author = {Joseph Wright}, - date = {2011-06-02}, - version = {2.1}, - url = {http://mirror.ctan.org/macros/latex/contrib/pgfopts} -} -@package{pkg:ragged2e, - title = {\paket*{ragged2e}}, - author = {Martin Schröder}, - date = {2009-05-21}, - version = {2.1}, - url = {http://mirror.ctan.org/macros/latex/contrib/ragged2e} -} -@package{pkg:sidenotes, - title = {\paket*{sidenotes}}, - author = {Andy Thomas and Oliver Schebaum}, - date = {2012-11-09}, - version = {0.92}, - url = {http://mirror.ctan.org/macros/latex/contrib/sidenotes} -} -@package{pkg:superiors, - title = {\paket*{superiors}}, - author = {Michael Sharpe}, - date = {2012-08-13}, - version = {1.02}, - url = {http://mirror.ctan.org/macros/latex/contrib/superiors} -} -@package{cls:tufte, - title = {\klasse{tufte-latex}}, - author = {Kevin Godby and Bil Kleb and Bill Wood}, - date = {2009-12-11}, - version = {3.5.0}, - url = {http://mirror.ctan.org/macros/latex/contrib/sidenotes} +\usepackage[footnote,perpage]{snotez} +\setcnltx{ + package = snotez , + authors = Clemens Niederberger , + email = contact@mychemistry.eu , + url = https://bitbucket.org/cgnieder/snotez , + info = sidenote support for \LaTeXe , + add-cmds = { + newsnotezfloat , + setsidenotes , + sidenote , + sidenotemark , + sidenotetext , + thesidenote , + } , + add-silent-cmds = { + @captype, @car ,@cdr , @currentlabel , @nil , + @the@snotez@mark , + @x@sf , + cnltx@create@generic@message , + ifltxcounter , + MakeSorted , MakeSortedPerPage , + marginnote , + pgfkeys , pgfqkeys , + protected@edef , protected@xdef , + RaggedRight , + snotez@date , + snotez@description , + snotez@error , + snotez@error@message , + snotez@format , + snotez@if@nblskip , + snotez@marginnote , snotez@marginpar , + snotez@mark , + snotez@new@sidefloat , + snotez@note@mark@format , + snotez@note@mark@sep , + snotez@sidefloat@box , + snotez@sidefloat@format , + snotez@sidenote@aux , + snotez@sidenote@dblarg , + snotez@sidenote@dblarg@aux , + snotez@sidenote@nodblarg , + snotez@sidenote@nodblarg@aux , + snotez@sidenotetext@aux , + snotez@sidenotetext@dblarg , + snotez@sidenotetext@dblarg@aux , + snotez@sidenotetext@nodblarg , + snotez@sidenotetext@nodblarg@aux , + snotez@text , + snotez@text@mark@format , + snotez@version , + snotez@write@mark , + snotez@warning , + textsu + } , + makeindex-setup = {columns=3, columnsep=1em} } -\end{filecontents} -\newcommand*\Default[1]{% - \hfill\llap{% - \ifblank{#1} - {(initially~empty)} - {Default:~\code{#1}}% - }\newline -} +\defbibheading{bibliography}[\bibname]{\addsec{References}} \makeatletter -\providecommand*\sinceversion[1]{% - \@bsphack - \marginnote{% - \footnotesize\sffamily\RaggedRight - \textcolor{black!75}{Introduced in version~#1}}% - \@esphack} -\providecommand*\changedversion[1]{% - \@bsphack - \marginnote{% - \footnotesize\sffamily\RaggedRight - \textcolor{black!75}{Changed in version~#1}}% - \@esphack} - \newcommand*\defaultsidenotes{% \setsidenotes{ - note-mark-format = \@textsuperscript{\normalfont##1}, - text-format = \footnotesize + note-mark-format = \@textsuperscript{\normalfont\normalcolor##1}, + text-format = \normalfont\normalcolor\footnotesize }} +\makeatother \setsidenotes{ note-mark-format=#1., - text-mark-format=\textsu{\hspace*{\superiors@spaced}#1}, + text-mark-format=\textsu{\hspace*{.04em}#1}, text-format+=\RaggedRight } -\makeatother + +\renewrobustcmd*\sinceversion[1]{% + \sidenote{\GetTranslation{cnltx-introduced}~#1}% +} +\renewrobustcmd*\changedversion[1]{% + \sidenote{\GetTranslation{cnltx-changed}~#1}% +} + +\newname\kohm{Markus Kohm} +\newname\tennent{Bob Tennent} +\newname\thomas{Andy Thomas} \begin{document} -\section{License and Requirements}\label{sec:license}\secidx{License} -\snotez is placed under the terms of the \LaTeX{} Project Public License, -version 1.3 or later (\url{http://www.latex-project.org/lppl.txt}). It has the -status ``maintained.'' +\section{License and Requirements}\label{sec:license} +\license -\snotez needs and loads the packages -\paket*{etoolbox}\sidenote[*-2][]{\textcite{pkg:etoolbox}}, -\paket*{pgfopts}\sidenote[*-][]{\textcite{pkg:pgfopts}}, -\paket*{marginnote}\sidenote{\textcite{pkg:marginnote}} and -\paket*{perpage}\sidenote{\textcite{pkg:perpage}}. -\secidx*{License} +\snotez\ needs and loads the packages +\pkg{etoolbox}\sidenote(*-2){\textcite{pkg:etoolbox}}, +\pkg{pgfopts}\sidenote(*-1){\textcite{pkg:pgfopts}}, +\pkg{marginnote}\sidenote{\textcite{pkg:marginnote}} and +\pkg{perpage}\sidenote{\textcite{pkg:perpage}}. -\section{Motivation} +\section{Motivation}\label{sec:motivation} This has just been an exercise on a lazy -afternoon\sidenote[*-2][]{\url{http://www.youtube.com/watch?v=PPRiaYH1iTk}}. -Well, more or less at least. Since there already is Andy Thomas' \paket*{sidenotes} -package\sidenote[*-][]{\textcite{pkg:sidenotes}} there is probably -no real need for \snotez. Moreover, the tufte classes\sidenote{\textcite{cls:tufte}} -as well as \klasse{memoir}\sidenote{\textcite{cls:memoir}} also provide corresponding -mechanisms. Besides the fun I had my motivation was also based on the fact that -I didn't like some smaller things (\emph{not} bugs) done by the \paket{sidenotes} -package such as inserting kerns and superscripted commas for multiple marks. I -prefer to let my \paket*{fnpct}\sidenote{\textcite{pkg:fnpct}} package handle -these things. Anyways, here it is and it seems to be working as intended so I -don't see a reason why it shouldn't be available for use. +afternoon\sidenote{\url{https://www.youtube.com/watch?v=OU6EyXcFBxA}}. Well, +in the beginning at least. Since there already is \thomas' \pkg{sidenotes} +package\sidenote{\textcite{pkg:sidenotes}} there is probably no real need for +\snotez. Moreover, the tufte classes\sidenote{\textcite{cls:tufte}} as well +as \cls{memoir}\sidenote{\textcite{cls:memoir}} also provide corresponding +mechanisms. Besides the fun I had my motivation was also based on the fact +that I didn't like some things done by the \pkg{sidenotes} package such as +inserting kerns and superscripted commas for multiple marks. I prefer to let +my \pkg{fnpct}\sidenote{\textcite{pkg:fnpct}} package handle these things. +Anyways, here it is and it seems to be working as intended so I don't see a +reason why it shouldn't be available for use. -By the way: the \paket*{fnpct} package v0.2k and later knows about \snotez and -automatically adapts the note commands. Please note that you need to enable -the \key{dblarg} option (see page~\pageref{key:dblarg}) when you're using -\paket*{fnpct} together with \snotez! +By the way: the \pkg{fnpct} package~v0.2k and later knows about \snotez\ and +automatically adapts the note commands! -\section{Introduction}\secidx{Introduction} -The \snotez Package introduces a \cmd{sidenote} command% +\section{Introduction}\label{sec:introduction} +The \snotez\ package introduces a \cs{sidenote} command% \begingroup\defaultsidenotes \sidenote{This is an example demonstrating the default appearance.} \endgroup -that typesets sidenotes the -same way \cmd{footnote} typesets footnotes. It provides some options that allow -formatting the appearance of the sidenotes\sidenote[*][]{In all sidenotes in this -document the mark is typeset on the baseline and the text is set ragged right.}. -As a default sidenotes are typeset in a \cmd{marginpar} but there are possibilities -using Markus Kohm's \paket{marginnote}~\cite{pkg:marginnote} package as well. +that typesets sidenotes the same way \cs*{footnote} typesets footnotes. It +provides some options that allow formatting the appearance of the +sidenotes\sidenote{In all sidenotes in this document the mark is typeset + on the baseline and the text is set ragged right.}. As a default sidenotes +are typeset in a \cs*{marginpar} but there are possibilities using \kohm's +\pkg{marginnote}~\cite{pkg:marginnote} package as well. As with footnotes it is possible to set mark and text separately using the -equivalent commands \cmd{sidenotemark} and \cmd{sidenotetext}, respectively. -Instead of lots of code examples this documentation will use the \cmd{sidenote} -macro itself extensively. It is assumend you know how to use \cmd{footnote} and -are able to transfer your knowledge. -\secidx*{Introduction} +equivalent commands \cs{sidenotemark} and \cs{sidenotetext}, respectively. +Instead of lots of code examples this documentation will use the \cs{sidenote} +macro itself extensively. It is assumend you know how to use \cs*{footnote} +and are able to transfer your knowledge. -\section{Usage}\secidx{Usage} -The basic usage is the very same as with \LaTeX's \cmd{footnote}, \cmd{footnotemark} -and \cmd{footnotetext}. Unsurprisingly the presented commands are these: -\begin{beschreibung} - \Befehl{sidenote}\oa{<mark>}\ma{<text>}\newline - The basic command. The syntax is the very same as for \cmd{footnote}. - \Befehl{sidenote}\oa{<offset>}\oa{<mark>}\ma{<text>}\newline - Actually I lied: \cmd{sidenote} has a second option that smuggles itself - before the \oa{<mark>} option if you use it: an argument for a vertical offset - that takes a length. An empty second option assumes you want the automatic - mark. If you use this argument the note is set with the \cmd{marginnote} - command\sidenote[*-3][]{From the \paket{marginnote} package}. - Please see its documentation\sidenote[*-2][]{For example with \texttt{texdoc - marginnote} on your command line.}~\cite{pkg:marginnote} for the \da{<offset>} - argument. \snotez only passes the value on.\par - \sinceversion{0.3} Actually, this is only part of the truth: while typing this - documentation I repeatedly found myself shifting notes by multiples of - \cmd{baselineskip} so the argument accepts a shortcut for this. A star \code{*} - followed by a (positive or negative) number denotes a multiple of \cmd{baselineskip}. - By the way: a positive value shifts the note \emph{down}.\par - When you're using the \key{dblarg}{false} option this second optional argument - has parentheses instead of square brackets! - \Befehl{sidenotemark}\oa{<text>}\newline - This command has the same purpose as \cmd{footnotemark} but for sidenotes. - \Befehl{sidenotetext}\oa{<mark>}\ma{<text>}\newline - The same as \cmd{footnotetext} but for sidenotes. Beware where you place it: - it calls \cmd{marginpar} or \cmd{marginnote} and thus determines where the - actual note is placed. - \Befehl{sidenotetext}\oa{<offset>}\oa{<mark>}\ma{<text>}\newline - I lied again: \cmd{sidenotetext} also has the second optional argument - \oa{<offset>} that again smuggles itself before the \oa{<mark>} option if you - use it. For details see the second description of the \cmd{sidenote} command. -\end{beschreibung} +\section{Usage}\label{sec:usage} +The basic usage is the very same as with \LaTeX's \cs*{footnote}, +\cs*{footnotemark} and \cs*{footnotetext}. Unsurprisingly the presented +commands are these: +\begin{commands} + \command{sidenote}[\oarg{mark}\marg{text}] + The basic command. The syntax is the very same as for \cs*{footnote}. + \command{sidenote}[\darg{offset}\oarg{mark}\marg{text}] + Actually I lied: \cs{sidenote} has a second option that smuggles itself + before the \meta{mark} option if you use it: an argument for a vertical + offset that takes a length. An empty second option assumes you want the + automatic mark. If you use this argument the note is set with the + \cs*{marginnote} command\sidenote(*-1){From the \pkg{marginnote} + package}. Please see its documentation\sidenote{For example with + \code{texdoc marginnote} on your command line.}~\cite{pkg:marginnote} + for the \meta{offset} argument. \snotez\ only passes the value on. + + Actually, this is only part of the truth: while typing this documentation + I repeatedly found myself shifting notes by multiples of + \cs*{baselineskip} so the argument accepts a shortcut for this. A star + \code{*} followed by a (positive or negative) number denotes a multiple of + \cs*{baselineskip}. By the way: a positive value shifts the note + \emph{down}. + + When you're using the \keyis{dblarg}{true} option the \meta{offset} + argument has square brackets instead of parentheses! + \command{sidenotemark}[\oarg{marg}] + This command has the same purpose as \cs*{footnotemark} but for + sidenotes. + \command{sidenotetext}[\oarg{mark}\marg{text}] + The same as \cs*{footnotetext} but for sidenotes. Beware where you place + it: it calls \cs*{marginpar} or \cs*{marginnote} and thus determines where + the actual note is placed. + \command{sidenotetext}[\darg{offset}\oarg{mark}\marg{text}] + I lied again: \cs{sidenotetext} also has the second optional argument + \meta{offset} that again smuggles itself before the \meta{mark} option if + you use it. For details see the second description of the \cs{sidenote} + command. +\end{commands} Here is one short example of the usage. -\begin{beispiel}[code only] - % produces a sidenote with automatic number in a - % \marginpar: - \sidenote{A note} - - % produces a sidenote with mark `a' in a - % \marginpar: - \sidenote[a]{A note} - - % produces a sidenote with automatic number in a - % \marginnote: - \sidenote[][]{A note} - % alternative syntax (dblarg=false): - \sidenote(){A note} +\begin{sourcecode} + % produces a sidenote with automatic number in a + % \marginpar: + \sidenote{A note} + + % produces a sidenote with mark `a' in a + % \marginpar: + \sidenote[a]{A note} + + % produces a sidenote with automatic number in a + % \marginnote: + \sidenote(){A note} + % alternative syntax (dblarg=true): + \sidenote[][]{A note} + + % produces a sidenote with automatic number in a + % \marginnote shifted down by \baselineskip: + \sidenote(*){A note} + % alternative syntax (dblarg=true): + \sidenote[*][]{A note} + + % produces a sidenote with automatic number in a + % \marginnote shifted up by 2ex: + \sidenote(-2ex){A note} + % alternative syntax (dblarg=true): + \sidenote[-2ex][]{A note} + + % produces a sidenote with mark `a' in a + % \marginnote shifted down by 2\baselineskip: + \sidenote(*2)[a]{A note} + % alternative syntax (dblarg=true): + \sidenote[*2][a]{A note} +\end{sourcecode} - % produces a sidenote with automatic number in a - % \marginnote shifted down by \baselineskip: - \sidenote[*][]{A note} - % alternative syntax (dblarg=false): - \sidenote(*){A note} +\section{Figures in the Margin}\label{sec:figures-margin} +In the case of small figures or tables one might want to place them in the +margin, too. Especially in a document with a larger margin than it is in the +standard classes. - % produces a sidenote with automatic number in a - % \marginnote shifted up by 2ex: - \sidenote[-2ex][]{A note} - % alternative syntax (dblarg=false): - \sidenote(-2ex){A note} +For these cases \snotez\ provides\sinceversion{0.5} these environments: +\begin{environments} + \environment{sidefigure} + Places a figure in the margin within a \cs*{marginpar}. \cs*{caption} can + be used in the usual way. + \environment{sidetable} + Places a table in the margin within a \cs*{marginpar}. \cs*{caption} can + be used in the usual way. +\end{environments} - % produces a sidenote with mark `a' in a - % \marginnote shifted down by 2\baselineskip: - \sidenote[*2][a]{A note} - % alternative syntax (dblarg=false): - \sidenote(*2)[a]{A note} -\end{beispiel} -\secidx*{Usage} +In order to be able to place other floats in the margin, too, \snotez\ +provides the following command: +\begin{commands} + \command{newsnotezfloat}[\oarg{code}\marg{name}] + This defines a new environment \code{side}\meta{name}. \meta{code} would + be placed after the formatting from \option{sidefloat-format} but before + the environment's contents. +\end{commands} +Both existing environments have been defined with this command. +\begin{sourcecode} + \newsnotezfloat{figure} + \newsnotezfloat{table} +\end{sourcecode} -\section{Options}\secidx{Options} +\section{Options}\label{sec:options} Although all options can be used as package option you can also set all options (locally) with a setup command: -\begin{beschreibung} - \Befehl{setsidenotes}{<options>} -\end{beschreibung} +\begin{commands} + \command{setsidenotes}[\marg{options}] + Set options as a comma-separated list of key/value pairs. +\end{commands} Available options are these: -\begin{beschreibung} - \Option{dblarg}{\default{true}|false}\Default{true} - \sinceversion{0.3}\emph{This option can only be used as a package option!} - Prior to version~0.3 \snotez' \cmd{sidenote} and \cmd{sidenotetext} had both - their optional arguments with square brackets where the use of one argument - referred to the mark but when both were used the first argument referred to - the offset and the second to the mark. This syntax is kept with this option. - Setting it to \code{false} changes the \oa{<offset>} argument syntax into - \da{<offset>}.\par - \emph{If you're using \snotez together with the \paket*{fnpct} package~\cite{pkg:fnpct} - you cannot set \key{dblarg} to \code{false}. Otherwise the \da{<offset>} - argument get's lost!} - \Option{marginnote}{\default{true}|false}\Default{false} - Use \paket{marginnote}'s \cmd{marginnote}~\cite{pkg:marginnote} for all - \cmd{sidenote}s. In the default setting \cmd{sidenote} uses \cmd{marginpar}s - to set the sidenote unless you use the \oa{<offset>} argument. If you use - this option \emph{all} sidenotes are set with \cmd{marginnote}. \emph{This - option can only be used in the preamble}. - \Option{text-format}{<code>}\Default{\cmd*{footnotesize}} - The format of the sidenote text. - \Option{text-format+}{<code>}\Default{} - Code to be appended to the format set with \key{text-format}\sidenote{This - document, for example, appends \paket*{ragged2e}'s \cmd*{RaggedRight}~\cite{pkg:ragged2e} - to the sidenote's format.}. - \Option{perpage}{\default{true}|false}\Default{false} - Make sidenotes counter per page. \emph{This option can only be set in the - preamble}. It uses package \paket{perpage}'s~\cite{pkg:perpage} - \cmd{MakeSortedPerPage} macro for the task. Otherwise the macro - \cmd{MakeSorted} is used. In the default setting sidenotes are counted per - chapter. If you want sidenotes counted document-wise together with a class - that defines a counter \code{chapter} then use for example the package - \paket*{chngcntr}~\cite{pkg:chngcntr} and issue - \cmd*{counterwithout}{sidenote}\ma{chapter} after loading \snotez. - This documentation is an example for the use of the option. - \Option{note-mark-sep}{<code>}\Default{\cmd*{space}} - The separator between sidenote mark and sidenote text in the sidenote. - \Option{note-mark-format}{<code>}\Default{\cmd*{@textsuperscript}\{\cmd*{normalfont}\#1\}} - The format of the sidenote mark in the sidenote. Please refer to the actual - mark with \code{\#1}. - \Option{text-mark-format}{<code>}\Default{\cmd*{@textsuperscript}\{\cmd*{normalfont}\#1\}} - The format of the sidenote mark in the text\sidenote[*-][]{This document uses - Michael Sharpe's \paket*{superiors} package~\cite{pkg:superiors} and redefines - the mark formats to use its \cmd*{textsu} command.}. Please refer to the actual - mark with \code{\#1}. - \Option{footnote}{\default{true}|false}\Default{false} - Let\sidenote[*][]{In the sense of \cmd*{let}} \cmd{footnote} to be \cmd{sidenote}, - \cmd{footnotemark} to be \cmd{sidenotemark} and \cmd{footnotetext} to be - \cmd{sidenotetext}. \emph{This option can only be used in the preamble}. -\end{beschreibung} +\begin{options} + \keybool{dblarg}\Default{false}\label{key:dblarg}% + Prior to version~0.3 \snotez' \cs{sidenote} and \cs{sidenotetext} had both + their optional arguments with square brackets where the use of one argument + referred to the mark but when both were used the first argument referred + to the offset and the second to the mark. This syntax is kept with this + option. Setting it to \code{true} changes the \darg{offset} argument + syntax into \oarg{offset}. + \keybool{marginnote}\Default{false} + Use \pkg{marginnote}'s \cs*{marginnote}~\cite{pkg:marginnote} for all + \cs{sidenote}s. In the default setting \cs{sidenote} uses + \cs*{marginpar}s to set the sidenote unless you use the \meta{offset} + argument. If you use this option \emph{all} sidenotes are set with + \cs*{marginnote}. \emph{This option can only be used in the preamble}. + \keyval{text-format}{code}\Default{\cs*{normalfont}\cs*{footnotesize}} + The format of the sidenote text. + \keyval{text-format+}{code}\Default + Code to be appended to the format set with + \option{text-format}\sidenote{This document, for example, appends + \pkg{ragged2e}'s \cs*{RaggedRight}~\cite{pkg:ragged2e} to the + sidenote's format.}. + \keybool{perpage}\Default{false} + \emph{This option can only be set in the preamble}. Make sidenotes + counter per page. It uses package \pkg{perpage}'s~\cite{pkg:perpage} + \cs*{MakeSortedPerPage} macro for the task. Otherwise the macro + \cs*{MakeSorted} is used. In the default setting sidenotes are counted + per chapter. If you want sidenotes counted document-wise together with a + class that defines a counter \code{chapter} then use for example the + package \pkg{chngcntr}~\cite{pkg:chngcntr} and issue + \cs*{counterwithout}\Marg{sidenote}\Marg{chapter} after loading \snotez. + This documentation is an example for the use of the option. + \keyval{note-mark-sep}{code}\Default{\cs*{space}} + The separator between sidenote mark and sidenote text in the sidenote. + \keyval{note-mark-format}{code}\Default{\cs*{@textsuperscript}\Marg{\cs*{normalfont}\#1}} + The format of the sidenote mark in the sidenote. Please refer to the + actual mark with \code{\#1}. + \keyval{text-mark-format}{code}\Default{\cs*{@textsuperscript}\Marg{\cs*{normalfont}\#1}} + The format of the sidenote mark in the text\sidenote(*-1){This document + uses \tennent's \pkg{libertine} package~\cite{pkg:libertine} and + redefines the mark formats to use its \cs*{textsu} command.}. Please + refer to the actual mark with \code{\#1}. + \keybool{footnote}\Default{false} + \emph{This option can only be used in the preamble}. Let\sidenote{In + the sense of \cs*{let}} \cs*{footnote} to be \cs{sidenote}, + \cs*{footnotemark} to be \cs{sidenotemark} and \cs*{footnotetext} to be + \cs{sidenotetext}. + \keyval{sidefloat-format}{code}\Default{\cs*{raggedright}} + The format of the contents of a sidefloat environment + text\sinceversion{0.5}. + \keyval{sidefloat-format+}{code} + Code to be appended to the format set with + \option{sidefloat-format}\sinceversion{0.5}. +\end{options} +\clearpage As a short example this is how the sidenotes for this document are formatted: -\begin{beispiel}[code only] -\setsidenotes{ - note-mark-format=#1., - text-mark-format=\textsu{\hspace*{\superiors@spaced}#1}, - text-format+=\RaggedRight, - perpage=true -} -\end{beispiel} -\secidx*{Options} +\begin{sourcecode} + \setsidenotes{ + note-mark-format=#1., + text-mark-format=\textsu{\hspace*{.04em}#1}, + text-format+=\RaggedRight, + perpage=true + } +\end{sourcecode} -\setlength{\linewidth}{\dimexpr\textwidth+.5\marginparwidth} -\printbibliography \section{Implementation} In the following code the lines 1--30 have been omitted. They only repeat the license statement which has already been mentioned in section~\ref{sec:license}. -\implementation[linerange={31-1000},firstnumber=31] +\implementation[ + linerange={31-1000}, + firstnumber=31, + basicstyle=\ttfamily\footnotesize +]{snotez.sty} -\indexprologue{\noindent Section titles are indicated \textbf{bold}, packages -\textsf{sans serif}, commands \code{\textbackslash\textcolor{code}{brown}} - and options \textcolor{key}{\code{yellow}}.\par\bigskip} +\indexprologue{\noindent Package names are indicated {\packageformat sans + serif}, commands \code{\textbackslash\textcolor{cs}{brown}} and options + \textcolor{option}{\code{yellow}}.\par\bigskip} -\printindex +% \printindex -\end{document}
\ No newline at end of file +\end{document} diff --git a/Master/texmf-dist/tex/latex/snotez/snotez.sty b/Master/texmf-dist/tex/latex/snotez/snotez.sty index 62c0c2d53a6..0891f93dfe5 100644 --- a/Master/texmf-dist/tex/latex/snotez/snotez.sty +++ b/Master/texmf-dist/tex/latex/snotez/snotez.sty @@ -8,28 +8,22 @@ % Web: https://bitbucket.org/cgnieder/enotez/ % E-Mail: contact@mychemistry.eu % -------------------------------------------------------------------------- -% Copyright 2012--2013 Clemens Niederberger +% Copyright 2012--2020 Clemens Niederberger % % This work may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either version 1.3 +% 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.3 or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% 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 Clemens Niederberger. % -------------------------------------------------------------------------- -% The snotez package consists of the files -% - snotez.sty, snotez_en.tex, snotez_en.pdf, README -% -------------------------------------------------------------------------- -% If you have any ideas, questions, suggestions or bugs to report, please -% feel free to contact me. -% -------------------------------------------------------------------------- -\def\snotez@date{2013/04/21} -\def\snotez@version{v0.3} +\def\snotez@date{2020/12/14} +\def\snotez@version{v0.5a} \def\snotez@description{sidenote support for LaTeX 2e (CN)} \NeedsTeXFormat{LaTeX2e} @@ -41,49 +35,45 @@ {\AtEndPreamble{\RequirePackage{perpage}}} % -------------------------------------------------------------------------- -% message handling -\def\snotez@create@message#1{% - \ifstrequal{#1}{Error} - {% - \lowercase{\csdef{snotez@#1}}##1##2{% - \csuse{Package#1}{snotez}{##1}{##2}}% - }{% - \lowercase{\csdef{snotez@#1}}##1{% - \csuse{Package#1}{snotez}{##1}}% - }} -\snotez@create@message{Error} -\snotez@create@message{Warning} -\snotez@create@message{WarningNoLine} -\snotez@create@message{Info} - -% -------------------------------------------------------------------------- % package options: \newbool{snotez@marginnote} \newbool{snotez@perpage} \newbool{snotez@footnote} \newbool{snotez@dblarg} -\booltrue{snotez@dblarg} -\def\snotez@note@mark@sep{\space} -\def\snotez@note@mark@format#1{\@textsuperscript{\normalfont#1}} -\def\snotez@format{\footnotesize} -\def\snotez@text@mark@format#1{\@textsuperscript{\normalfont#1}} +\newcommand*\snotez@note@mark@sep{\space} +\newcommand*\snotez@note@mark@format[1]{\@textsuperscript{\normalfont#1}} +\newcommand*\snotez@format{\normalfont\footnotesize} +\newcommand*\snotez@text@mark@format[1]{\@textsuperscript{\normalfont#1}} \pgfkeys{ snotez/.cd, % all sidenotes use \marginnote: marginnote/.is if = snotez@marginnote , - text-format/.code = \def\snotez@format{#1} , + % formatting of the note text: + text-format/.code = \renewcommand*\snotez@format{#1} , text-format+/.code = - \expandafter\def\expandafter\snotez@format\expandafter{\snotez@format#1} , + \expandafter\renewcommand + \expandafter*% + \expandafter\snotez@format + \expandafter{\snotez@format#1} , % make sidenotes counted per page: perpage/.is if = snotez@perpage , - note-mark-sep/.code = \def\snotez@note@mark@sep{#1} , - note-mark-format/.code = \def\snotez@note@mark@format##1{#1} , - text-mark-format/.code = \def\snotez@text@mark@format##1{#1} , + % formatting of the note mark: + note-mark-sep/.code = \renewcommand*\snotez@note@mark@sep{#1} , + note-mark-format/.code = \renewcommand*\snotez@note@mark@format[1]{#1} , + text-mark-format/.code = \renewcommand*\snotez@text@mark@format[1]{#1} , % make all footnotes sidenotes: footnote/.is if = snotez@footnote , - dblarg/.is if = snotez@dblarg + % change optional argument input: + dblarg/.is if = snotez@dblarg , + % formmatting of the sidefloats' contents: + sidefloat-format/.code = \renewcommand*\snotez@sidefloat@format{#1} , + sidefloat-format+/.code = + \expandafter\renewcommand + \expandafter*% + \expandafter\snotez@sidefloat@format + \expandafter{\snotez@sidefloat@format#1} } \ProcessPgfOptions* @@ -93,54 +83,62 @@ % -------------------------------------------------------------------------- % the \sidenote command \ifbool{snotez@dblarg}{ - % syntax: - % - \sidenote{text} - % - \sidenote[mark]{text} - % - \sidenote[offset][mark]{text} \newrobustcmd*\sidenote{% - \@ifnextchar[% - {\snotez@sidenote@aux@i} - {\snotez@sidenote@aux@ii{}[]}% no option - } - - \def\snotez@sidenote@aux@i[#1]{% - \@ifnextchar[% - {\snotez@sidenote@aux@ii{#1}}% two options - {\snotez@sidenote@aux@ii{}[{#1}]}% one option + \snotez@sidenote@dblarg } }{ - % syntax: - % - \sidenote{text} - % - \sidenote[mark]{text} - % - \sidenote(offset){text} - % - \sidenote(offset)[mark]{text} \newrobustcmd*\sidenote{% - \@ifnextchar(% - {\snotez@sidenote@aux@i}% offset - {% - \@ifnextchar[ - {\snotez@sidenote@aux@ii{}}% no offset nut mark - {\snotez@sidenote@aux@ii{}[]}% no offset and no mark - }% + \snotez@sidenote@nodblarg } +} - \def\snotez@sidenote@aux@i(#1){% - \@ifnextchar[% - {\snotez@sidenote@aux@ii{#1}}% mark - {\snotez@sidenote@aux@ii{#1}[]}% no mark - } +% syntax: +% - \sidenote{text} +% - \sidenote[mark]{text} +% - \sidenote[offset][mark]{text} +\newrobustcmd*\snotez@sidenote@dblarg{% + \@ifnextchar[% + {\snotez@sidenote@dblarg@aux} + {\snotez@sidenote@aux{}[]}% no option +} + +\protected\def\snotez@sidenote@dblarg@aux[#1]{% + \@ifnextchar[% + {\snotez@sidenote@aux{#1}}% two options + {\snotez@sidenote@aux{}[{#1}]}% one option +} + +% syntax: +% - \sidenote{text} +% - \sidenote[mark]{text} +% - \sidenote(offset){text} +% - \sidenote(offset)[mark]{text} +\newrobustcmd*\snotez@sidenote@nodblarg{% + \@ifnextchar(% + {\snotez@sidenote@nodblarg@aux}% offset + {% + \@ifnextchar[ + {\snotez@sidenote@aux{}}% no offset but mark + {\snotez@sidenote@aux{}[]}% no offset and no mark + }% +} + +\protected\def\snotez@sidenote@nodblarg@aux(#1){% + \@ifnextchar[% + {\snotez@sidenote@aux{#1}}% mark + {\snotez@sidenote@aux{#1}[]}% no mark } % #1: offset % #2: mark % #3: text -\long\def\snotez@sidenote@aux@ii#1[#2]#3{% +\long\def\snotez@sidenote@aux#1[#2]#3{% \snotez@mark{#2}% \snotez@text{#1}{#3}% } % this one is very much \@footnotemark from latex.ltx: -\def\snotez@write@mark#1{% +\newrobustcmd*\snotez@write@mark[1]{% \leavevmode \ifhmode\edef\@x@sf{\the\spacefactor}\nobreak\fi #1% @@ -148,17 +146,23 @@ \relax } -\def\snotez@mark#1{% +\newrobustcmd*\snotez@mark[1]{% \ifblank{#1}% or \ifstrempty? - {\refstepcounter{sidenote}\protected@xdef\@the@snotez@mark{\thesidenote}} - {\protected@edef\@currentlabel{#1}\protected@xdef\@the@snotez@mark{#1}}% - \snotez@write@mark{\hbox{\snotez@text@mark@format{\@the@snotez@mark}}}% + {% + \refstepcounter{sidenote}% + \protected@xdef\@the@snotez@mark{\thesidenote}% + } + {% + \protected@edef\@currentlabel{#1}% + \protected@xdef\@the@snotez@mark{#1}% + }% + \snotez@write@mark{% + \hbox{\snotez@text@mark@format{\@the@snotez@mark}}}% } -\ifcsdef{c@chapter} +\ifltxcounter{chapter} {\newcounter{sidenote}[chapter]} - {\newcounter{sidenote}% -} + {\newcounter{sidenote}} % -------------------------------------------------------------------------- % the \sidenotemark command @@ -167,55 +171,63 @@ % -------------------------------------------------------------------------- % the \sidenotetext command \ifbool{snotez@dblarg}{ - % syntax: - % - \sidenotetext{text} - % - \sidenotetext[mark]{text} - % - \sidenotetext[offset][mark]{text} \newrobustcmd*\sidenotetext{% - \@ifnextchar[% - {\snotez@sidenotetext@aux@i} - {\snotez@sidenotetext@aux@ii{}[]}% no option - } - - \def\snotez@sidenotetext@aux@i[#1]{% - \@ifnextchar[% - {\snotez@sidenotetext@aux@ii{#1}}% two options - {\snotez@sidenotetext@aux@ii{}[{#1}]}% one option + \snotez@sidenotetext@dblarg } }{ - % syntax: - % - \sidenotetext{text} - % - \sidenotetext[mark]{text} - % - \sidenotetext(offset){text} - % - \sidenotetext(offset)[mark]{text} \newrobustcmd*\sidenotetext{% - \@ifnextchar(% - {\snotez@sidenotetext@aux@i}% offset - {% - \@ifnextchar[ - {\snotez@sidenotetext@aux@ii{}}% no offset nut mark - {\snotez@sidenotetext@aux@ii{}[]}% no offset and no mark - }% + \snotez@sidenotetext@nodblarg } +} - \def\snotez@sidenotetext@aux@i(#1){% - \@ifnextchar[% - {\snotez@sidenotetext@aux@ii{#1}}% mark - {\snotez@sidenotetext@aux@ii{#1}[]}% no mark - } +% syntax: +% - \sidenotetext{text} +% - \sidenotetext[mark]{text} +% - \sidenotetext[offset][mark]{text} +\newrobustcmd*\snotez@sidenotetext@dblarg{% + \@ifnextchar[% + {\snotez@sidenotetext@dblarg@aux} + {\snotez@sidenotetext@aux{}[]}% no option +} + +\protected\def\snotez@sidenotetext@dblarg@aux[#1]{% + \@ifnextchar[% + {\snotez@sidenotetext@aux{#1}}% two options + {\snotez@sidenotetext@aux{}[{#1}]}% one option +} + +% syntax: +% - \sidenotetext{text} +% - \sidenotetext[mark]{text} +% - \sidenotetext(offset){text} +% - \sidenotetext(offset)[mark]{text} +\newrobustcmd*\snotez@sidenotetext@nodblarg{% + \@ifnextchar(% + {\snotez@sidenotetext@nodblarg@aux}% offset + {% + \@ifnextchar[ + {\snotez@sidenotetext@aux{}}% no offset nut mark + {\snotez@sidenotetext@aux{}[]}% no offset and no mark + }% +} + +\protected\def\snotez@sidenotetext@nodblarg@aux(#1){% + \@ifnextchar[% + {\snotez@sidenotetext@aux{#1}}% mark + {\snotez@sidenotetext@aux{#1}[]}% no mark } % #1: offset % #2: mark % #3: text -\long\def\snotez@sidenotetext@aux@ii#1[#2]#3{% +\long\protected\def\snotez@sidenotetext@aux#1[#2]#3{% \ifblank{#2}{}{\protected@xdef\@the@snotez@mark{#2}}% \snotez@text{#1}{#3}% } % #1: offset % #2: text -\def\snotez@text#1#2{% +\newrobustcmd*\snotez@text[2]{% \ifblank{#1} {% \snotez@marginpar{% @@ -228,22 +240,54 @@ \snotez@format \snotez@write@mark{\snotez@note@mark@format{\@the@snotez@mark}}% \snotez@note@mark@sep#2% - }[\snotez@if@nblskip{#1}{\@cdr#1\@nil\baselineskip}{#1}]% + }[\snotez@if@nblskip{#1}]% }% } -\def\snotez@if@nblskip#1{% +\newcommand*\snotez@if@nblskip[1]{% + % if #1 starts with * gobble it and add \baselineskip: \expandafter\ifx\@car#1\@nil*% \expandafter\@firstoftwo \else \expandafter\@secondoftwo \fi + {\@cdr#1\@nil\baselineskip}% + {#1}% } \let\snotez@marginpar\marginpar \let\snotez@marginnote\marginnote % -------------------------------------------------------------------------- +% margin floats with captions, based on an idea in tufte-latex +\newsavebox\snotez@sidefloat@box +\newcommand*\snotez@sidefloat@format{\raggedright} + +\newenvironment{snotez@sidefloat}[2] + {% + \def\@captype{#1}% + \begin{lrbox}{\snotez@sidefloat@box}% + \minipage{\marginparwidth}% + \snotez@sidefloat@format#2% + } + { + \endminipage + \end{lrbox}% + \marginpar{\unhbox\snotez@sidefloat@box}% + } + +\newrobustcmd*\snotez@new@sidefloat[2]{% + \newenvironment{side#1} + {\snotez@sidefloat{#1}{#2}} + {\endsnotez@sidefloat}% +} + +\newrobustcmd*\newsnotezfloat[2][]{\snotez@new@sidefloat{#2}{#1}} + +\newsnotezfloat{figure} +\newsnotezfloat{table} + +% -------------------------------------------------------------------------- % process preamble options: \AtBeginDocument{ % if option `footnote=true' let \footnote to \sidenote: @@ -252,13 +296,17 @@ \let\footnote\sidenote \let\footnotemark\sidenotemark \let\footnotetext\sidenotetext + \ifdef\multfootnote{% + \let\multfootnote\multsidenote + }{}% }{} % if option `marginnote=true' use \marginnote for all notes: \ifbool{snotez@marginnote} {% \let\snotez@marginpar\marginnote - \snotez@info{All sidenotes are now using \string\marginnote^^J - instead of \string\marginpar}% + \PackageInfo{snotez} + {All sidenotes are now using \string\marginnote^^J + instead of \string\marginpar}% }% {} } @@ -268,19 +316,6 @@ \ifbool{snotez@perpage} {\MakeSortedPerPage{sidenote}} {\MakeSorted{sidenote}}% - \@ifpackageloaded{fnpct} - {% - \ifbool{snotez@dblarg} - {} - {% - \snotez@error - {When you're using the `fnpct' package together with^^J - `snotez' you need to enable the `dblarg' option!} - {When you're using the `fnpct' package together with^^J - `snotez' you need to enable the `dblarg' option!}% - }% - } - {}% } \endinput @@ -296,4 +331,10 @@ - allow `*' syntax for offsets that are multiples of \baselineskip - syntax change in optional arguments; option `dblarg' - provides previous syntax + provides previous syntax >> this is the default +2013/06/13 v0.3a - better separation of definition of \sidenote and + \sidenotetext commands and the internal commands +2013/11/21 v0.4 - robustify commands where appropriate + - use cnltx-base +2020/01/12 v0.5 - remove dependency on `cnltx-base' +2020/12/14 v0.5a - fix issue #1 |