diff options
author | Karl Berry <karl@freefriends.org> | 2011-12-03 16:40:19 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-12-03 16:40:19 +0000 |
commit | 0a958302e42be9e7a4c0521ac5d6f93b003bd602 (patch) | |
tree | ce8832afced2628859732df7466adfbaef43c9e0 /Master | |
parent | 910d7ec0ecd78259b59aa682474418b57b4954bb (diff) |
sidenotes (16nov11)
git-svn-id: svn://tug.org/texlive/trunk@24736 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/sidenotes/sidenotes.pdf | bin | 200851 -> 195212 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/sidenotes/sn_usage_biblatex.pdf | bin | 0 -> 125503 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/sidenotes/sn_usage_biblatex.tex | 75 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/sidenotes/sidenotes.dtx | 238 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/sidenotes/sidenotes.sty | 98 |
5 files changed, 190 insertions, 221 deletions
diff --git a/Master/texmf-dist/doc/latex/sidenotes/sidenotes.pdf b/Master/texmf-dist/doc/latex/sidenotes/sidenotes.pdf Binary files differindex 938c88a7f72..01d223a39e1 100644 --- a/Master/texmf-dist/doc/latex/sidenotes/sidenotes.pdf +++ b/Master/texmf-dist/doc/latex/sidenotes/sidenotes.pdf diff --git a/Master/texmf-dist/doc/latex/sidenotes/sn_usage_biblatex.pdf b/Master/texmf-dist/doc/latex/sidenotes/sn_usage_biblatex.pdf Binary files differnew file mode 100644 index 00000000000..db696178f21 --- /dev/null +++ b/Master/texmf-dist/doc/latex/sidenotes/sn_usage_biblatex.pdf diff --git a/Master/texmf-dist/doc/latex/sidenotes/sn_usage_biblatex.tex b/Master/texmf-dist/doc/latex/sidenotes/sn_usage_biblatex.tex new file mode 100644 index 00000000000..0c79d7ed7b0 --- /dev/null +++ b/Master/texmf-dist/doc/latex/sidenotes/sn_usage_biblatex.tex @@ -0,0 +1,75 @@ +\documentclass{book} + +\usepackage{sidenotes} + +% provide some simple layout +\usepackage[paperwidth=210mm, paperheight=297mm, left=50pt, top=50pt, textwidth=345pt, marginparsep=25pt, marginparwidth=124pt, textheight=692pt, footskip=50pt]{geometry} +\pagestyle{empty} +\captionsetup{width=\marginparwidth, font=footnotesize, skip = 0pt} +\renewcommand{\thefootnote}{\fnsymbol{footnote}} + +\usepackage[backend = biber, citestyle = numeric]{biblatex} +\addbibresource{sn.bib} +\usepackage{marginfix} +\begin{document} +% +\chapter{Usage of the \textbf{sidenotes} package} +The package provides a number of macros to typeset rich content in the margin. Please read the output of this \LaTeX{} file and look at the input file while doing so. We start with the \verb+\sidenote+ macro. + +\section{\texttt{\textbackslash sidenote[number]\{text\}}} +It is very similar to \verb+\footnote+ and tries to emulate its behavior.\sidenote{But like the name says, the note is put in the margin, hence the name sidenote.} It has the same parameters as footnote. The sidenote moves up or down (floats) to not overlap with other floats in the margin.\sidenote{Note how this paragraph is slightly moved down.} All the sidenotes are subsequently numbered. The first, optional parameter will manually change the numbering of the sidenote.\sidenote[666]{This note is evil.} + +\section{\texttt{\textbackslash sidenotemark[number]}} +Sidenote tries to mimic the footnote behavior and provides the same solutions. Sometimes it is not possible to directly call a sidenote macro, e.g. in particular environments. Then, you can also use \verb+\sidenotemark+ macro.\sidenotemark{} If a number is given, that number is used.\sidenotemark[99]{} This puts a mark at the current position. + +\section{\texttt{\textbackslash sidenotetext[number]\{text\}}} +Afterwards,\sidenotetext{Please note, how the numbering still counts from the last usual call} outside of the environment that causes the trouble, it is possible the call \verb+\sidenotetext{text}+ to actually make the sidenote. The optional parameter will again manually change the numbering of the sidenote.\sidenotetext[93]{Then, you have to make sure the number match!} + +\section{\texttt{\textbackslash sidestyle}} +\renewcommand{\sidestyle}{\raggedright\footnotesize} +You can use \verb+\renewcommand{\sidestyle}{something}+, if you want to change the font, text size, text color or something else of the sidenotes.\sidenote{Here, we changed sidestyle to raggedright.} +\renewcommand{\sidestyle}{\footnotesize\em} +The default value is \verb+\footnotesize+, \verb+\sidestyle+ is the prefix for all sidenotes.\sidenote{Here, we changed to \texttt{\textbackslash em}} Please note that the values do not add up, \verb+\sidestyle+ is overwritten by every use of \verb+\renewcommand{\sidestyle}{...}+.% +\renewcommand{\sidestyle}{\footnotesize}% +\sidenote{Back to default behavior.} + +\section{\texttt{\textbackslash sidecite[prefix][postfix]\{citekey\}}} +The macro \verb+\sidecite+ puts a citation in the margin. The macro has the same set of parameters as biblatex. We add a citation here as an example.\sidecite[see:][Nobel prize 1972]{nobel:bcs} The behavior is the same as in \verb+\sidenote+ and auto floating. For post- and prenote please refer to the biblatex manual, the parameters are directly passed to biblatex. + +\section{\texttt{\textbackslash sidecaption\{captiontext\}}} +The \verb+\sidecaption+ macro can be used if the caption of a figure or table is supposed to be in the margin. Please note, that the formatting is done by the caption package. +\begin{figure}[h] +\sidecaption{I am a caption, but in the margin.} +\fbox{\rule{\textwidth}{0mm}\rule{0mm}{1.5cm}} % \includegraphics{image} +\end{figure} +Simply use \verb+\sidecaption+ instead of \verb+\caption+ in the figure environment. + +\section{\texttt{sidefigure}} +The sidefigure environment puts a figure and its caption in the margin. Instead of \verb+\begin{figure}+ use \verb+\begin{sidefigure}+. Please note, that the use of caption before \verb+\includegraphics+ puts the caption in line with the top of the figure and the use after \verb+\includegraphics+ puts it in line with the bottom of the actual figure. The formatting is done by the caption package. +\begin{sidefigure} +\fbox{\rule{0mm}{1.2cm}\rule{\marginparwidth}{0mm}} % \includegraphics{image} +\caption{This is a figure with its caption in the margin.} +\end{sidefigure} + +\section{\texttt{sidetable}} +The sidetable environment works similarly to sidefigure, but with table environments. Use \verb+\begin{sidetable}+ instead of \verb+\begin{table}+. The formatting is also done with help of the caption package. +\begin{sidetable} + \centering + % \fontfamily{ppl}\selectfont + \begin{tabular}{lllll} + \hline + Hg&Sn&Pb&Cd&Tl \\ + \hline + 0.50&0.47&0.48&0.5&0.5\\ + \end{tabular} + \caption{This is a table in the margin} +\end{sidetable} + +\section{Technical notes and further macros} +Sometimes it is useful to put text in the margin without a mark in the text. This can be achieved with \verb+\marginpar{text}+. + +The \verb+\sidecaption+ macro relies on the marginnote package by Markus Kohm and is used by the sidenotes package automatically. + +When writing the package, we tried to be as general as possible. Someone can e.g.\ use sidenotes mixed with footnotes.\footnote{Here, we have a footnote as well. The marker was changed to symbols to avoid confusion with the same numbers as sidenotes.} Also, the package tries to provide only functionality and does not know anything about formatting such as margin text size, color or anything else. Only \verb+\sidestyle+ was added for convenience. + +\end{document} diff --git a/Master/texmf-dist/source/latex/sidenotes/sidenotes.dtx b/Master/texmf-dist/source/latex/sidenotes/sidenotes.dtx index 68e3f6142e9..cafc5a6cbc2 100644 --- a/Master/texmf-dist/source/latex/sidenotes/sidenotes.dtx +++ b/Master/texmf-dist/source/latex/sidenotes/sidenotes.dtx @@ -1,4 +1,3 @@ -% \CheckSum{180} % \iffalse meta-comment % % sidenotes.dtx @@ -20,11 +19,16 @@ %</driver> %<package>\ProvidesPackage{sidenotes}[% %<*driver|package> - 2011/10/06 v0.53 rich text in the margin for LaTeX] + 2011/11/10 v0.80 rich text in the margin for LaTeX] %</driver|package> %<package>\RequirePackage{marginnote} % puts the stuff in the margin and provides an offset option instead of a float %<package>\RequirePackage{caption} % handles the figure caption (in the margin) %<package>\RequirePackage{xifthen} % provide an if command +%<package>\newboolean{@sidenotes@bibtex}% +%<package>\setboolean{@sidenotes@bibtex}{false}% +%<package>\DeclareOption{bibtex}{\setboolean{@sidenotes@bibtex}{true}}% +%<package>\ProcessOptions +%<package>\ifthenelse{\boolean{@sidenotes@bibtex}}{\RequirePackage{bibentry}}{} %<*driver> \documentclass{ltxdoc} \CodelineIndex @@ -67,27 +71,24 @@ % \changes{v0.51}{2011/10/05}{Extent the documentation of the macros.} % \begin{abstract} % This package tries to allow typesetting of rich content in the margin. -% This includes text, but also figures, captions, tables and citations (only with biblatex). +% This includes text, but also figures, captions, tables and citations. % This is common in science textbooks such as Feyman's \textit{Lectures on Physics}. % \end{abstract} % % \tableofcontents % % \changes{v0.2}{2011/08/21}{Initial version} +% \changes{v0.7}{2011/11/09}{rewrite without optional offsets} % % \section{Usage} % % \DescribeMacro{\sidenote} -% The macro \verb+\sidenote+ is one main feature of the package. The macro is very similar to +% The macro is very similar to % the footnote macro and tries to emulate its behavior. But like the name % says, the note is put in the margin, hence the name sidenote. It has the -% same parameters as footnote plus an additional, optional offset: -% \verb+\sidenote[number]{text}[offset]+. If no offset is given, the sidenote moves up or down (floats) -% to not overlap with other floats in the margin. If you use the offset -% (e.g. \verb+\sidenote{foo}[10pt]+) the sidenote is shifted 10pt down in the margin. -% It might overlap with other floats now. This means, omitting the offset and [0pt] do -% not lead to the same result, but you will only notice if there are a moderate number -% of sidenotes or other marginals. All the sidenotes are subsequently numbered. The +% same parameters as footnote: +% \verb+\sidenote[number]{text}+. The sidenote moves up or down (floats) +% to not overlap with other floats in the margin. All the sidenotes are subsequently numbered. The % first, optional parameter will manually change the numbering of the sidenote. % % \DescribeMacro{\sidenotemark} @@ -98,54 +99,47 @@ % commands. \verb+\sidenotemark+ puts a mark at the current position. Then, outside of the environment % \DescribeMacro{\sidenotetext} % that causes the trouble, it is possible the call \verb+\sidenotetext{text}+ to actually make the sidenote. -% Again, the -% first, optional parameter will manually change the numbering of the sidenote, the second optional postfix -% will adjust the position with an offset: \verb+\sidenotetext[number]{text}[offset]+ +% The +% first, optional parameter will manually change the numbering of the sidenote. +% +% \changes{v0.61}{2011/10/17}{documentation of sidetext} % % \DescribeMacro{\sidestyle} % You can use \verb+\renewcommand{\sidestyle}{something}+ % if you want to change the font, text size, text color or something else of the sidenotes. -% It it initialized with \verb+\footnotesize+. It is used as a prefix of the sidenotetext. +% It it initialized with \verb+\footnotesize+. It is used as a prefix of the sidenotetext and sidetext. % % \DescribeMacro{\sidecite} -% The macro \verb+\sidecite+ puts a citation in the margin. It uses the biblatex package -% so you have to go with biblatex instead of bibtex to use \verb+\sidecite+. Therefore, the -% macro has the same set of parameters plus the additional offset: -% \verb+\sidecite[prenote][postnote]{key}[offset]+. -% The behavior is the same as in \verb+\sidenote+, no offset means auto floating. If an offset -% value is given the position is fixed at a certain place, even if it overlaps with other text or objects. +% The macro \verb+\sidecite+ puts a citation in the margin. It uses the biblatex package or bibtex, +% load sidecite with the option [bibtex] for the latter. +% The macro has the same set of parameters. +% \verb+\sidecite[prenote][postnote]{key}+ for biblatex and \verb+\sidecite{key}+ for bibtex. +% The behavior is the same as in \verb+\sidenote+ and auto floating. % For post- and prenote please refer to the biblatex manual, the parameters are directly passed % to biblatex. % %\DescribeMacro{\sidecaption} % The \verb+\sidecaption+ macro can be used if the caption of a figure or table % is supposed to be in the margin. Please note, that the formatting is done by the -% caption package. If the object is referenced by the use of \verb+\label{somelabel}+ -% the label should go in the sidecaption macro: For example -% \verb+\sidecaption{I am a figure\label{fig:1}}+. +% caption package. % % \DescribeEnv{sidefigure} % The sidefigure environment puts a figure and its caption in the margin. Instead of -% \verb+\begin{figure}[htb]+ use \verb+\begin{sidefigure}[offset]+. Please note, that +% \verb+\begin{figure}[htb]+ use \verb+\begin{sidefigure}+. Please note, that % the use of caption before \verb+\includegraphics+ puts the caption in line with the % top of the figure % and the use after \verb+\includegraphics+ puts it in line with the bottom of the actual figure. % % \DescribeEnv{sidetable} -% The sidetable environment works similarly, but with table environments. Use \verb+\begin{sidetable}[offset]+ instead +% The sidetable environment works similarly, but with table environments. Use \verb+\begin{sidetable}+ instead % of \verb+\begin{table}+. % % \section{Technical notes and further macros} % -% \DescribeMacro{\marginnote} % \DescribeMacro{\marginpar} % Sometimes it is useful to put text in the margin without a mark in the text. This can be achieved -% with \verb+\marginnote{text}[offset]+ or \verb+\marginpar{text}+. This feature is not provided -% by this package, but by the -% marginnote package by Markus Kohm. The sidenotes package heavily uses the marginnote package. -% Technically, every time something is evoked with an offset, \verb+\marginnote+ is called. If it is called without -% an offset, it calls the normal \LaTeX{} macro \verb+\marginpar+. This is not true for the sidecaption, since -% the caption has to be adjacent to the figure or table. In that case, \verb+\marginnote+ is always used. +% with \verb+\marginpar{text}+. The \verb+\sidecaption+ macro relies on the +% marginnote package by Markus Kohm. % % When writing the package, we tried to be as general as possible. Someone can e.g.\ use sidenotes mixed with % footnotes. Also, the package tries to provide only functionality and does not know anything about formatting @@ -158,7 +152,7 @@ % This package requires the following packages: % \begin{description} % \item[marginnote] -% supports another command to create notes in the margin. The notes are no floats and can be shifted up or down. +% supports another command to create notes in the margin. The notes are no floats and can be shifted up or down. % \item[caption] % is used to set figure and table captions in the margin and to allow formatting of these captions. % \item[xifthen] is used to test for empty, optional arguments. @@ -187,25 +181,14 @@ % \begin{macro}{\sidenote} % Introduce the sidenote macro with an additional optional argument postfix to set the offset. % \changes{v0.53}{2011/10/07}{bugfix, now optional number and offset possible} +% \changes{v0.80}{2011/11/10}{unstar the newcommand.} % \begin{macrocode} -\newcommand*{\sidenote}[2][]{% - \begingroup% - \@ifnextchar [{\@sidenotes@sidenote[{#1}]{#2}}{\@sidenotes@sidenote[{#1}]{#2}[]}% -} - -\newcommand{\@sidenotes@sidenote}{} -\def\@sidenotes@sidenote[#1]#2[#3]{% - \endgroup% - \@sidenotes@@sidenote[{#1}]{#2}[{#3}]% -} - -\newcommand{\@sidenotes@@sidenote}{} -\def\@sidenotes@@sidenote[#1]#2[#3]{% - \ifthenelse{\isempty{#1}}% - {\sidenotemark% - \sidenotetext{#2}[#3]}% - {\sidenotemark[#1]% - \sidenotetext[#1]{#2}[#3]}% +\newcommand{\sidenote}[2][]{% +\ifthenelse{\isempty{#1}}% +{\sidenotemark% +\sidenotetext{#2}}% +{\sidenotemark[#1]% +\sidenotetext[#1]{#2}}% } % \end{macrocode} % \end{macro} @@ -214,47 +197,30 @@ % Sidenotemark is supposed to work similarly to footnotemark. % \begin{macrocode} \newcommand{\sidenotemark}[1][]{% - \nobreak\hspace{0.1pt}\nobreak% - \ifthenelse{\isempty{#1}}% - {\textsuperscript{\thesidenote}% - \refstepcounter{sidenote}}% if no argument is given use sidenote counter% - % else - {\setcounter{@sidenotes@buffer}{\value{sidenote}}% - \setcounter{sidenote}{#1}% - \textsuperscript{\thesidenote}% print out the argument otherwise - \setcounter{sidenote}{\value{@sidenotes@buffer}}}% - \ignorespaces% +\nobreak\hspace{0.1pt}\nobreak% +\ifthenelse{\isempty{#1}}% +{\textsuperscript{\thesidenote}% +\refstepcounter{sidenote}}% if no argument is given use sidenote counter% +{\setcounter{@sidenotes@buffer}{\value{sidenote}}% +\setcounter{sidenote}{#1}% +\textsuperscript{\thesidenote}% print out the argument otherwise +\setcounter{sidenote}{\value{@sidenotes@buffer}}}% +\ignorespaces% }% % \end{macrocode} % \end{macro} % % \begin{macro}{\sidenotetext} % Sidenotetext is supposed to work similarly to footnotetext. The additional, optional argument postfix sets the offset. +% \changes{v0.80}{2011/11/10}{unstar the newcommand.} % \begin{macrocode} -\newcommand*{\sidenotetext}[2][]{% - \begingroup% - \@ifnextchar [{\@sidenotes@sidenotetext[{#1}]{#2}}{\@sidenotes@sidenotetext[{#1}]{#2}[]}% -} - -\newcommand{\@sidenotes@sidenotetext}{} -\def\@sidenotes@sidenotetext[#1]#2[#3]{% - \endgroup% - \@sidenotes@@sidenotetext[{#1}]{#2}[{#3}]% -} - -\newcommand{\@sidenotes@@sidenotetext}{} -\def\@sidenotes@@sidenotetext[#1]#2[#3]{% - \ifthenelse{\isempty{#1}}{% sitenotemark given? - \addtocounter{sidenote}{-1}% - \ifthenelse{\isempty{#3}}{% offset? - \marginpar{\textsuperscript{\thesidenote}{} \sidestyle#2}}% no offset - {\marginnote{\textsuperscript{\thesidenote}{} \sidestyle#2}[#3]} % with offest - \addtocounter{sidenote}{1}}% - % else - {\ifthenelse{\isempty{#3}}% offset? - {\marginpar{\textsuperscript{#1} \sidestyle#2}}% no offset - {\marginnote{\textsuperscript{\thesidenote}{} \sidestyle#2}}% with offset - }% fi +\newcommand{\sidenotetext}[2][]{% +\ifthenelse{\isempty{#1}}{% sitenotemark given? +\addtocounter{sidenote}{-1}% +\marginpar{\textsuperscript{\thesidenote}{} \sidestyle#2}% +\addtocounter{sidenote}{1}}% +{\marginpar{\textsuperscript{#1} \sidestyle#2}% +}% fi }% % \end{macrocode} % \end{macro} @@ -262,97 +228,71 @@ % % \begin{macro}{\sidecite} % \changes{v0.5}{2011/10/05}{define the sidecite macro without the twoopt package} +% \changes{v0.80}{2011/11/10}{allow the use of bibtex} % Sidecite puts the citation in the margin. The additional, optional argument postfix sets the offset. % Please note, that it only works with biblatex and uses its syntax. % \begin{macrocode} -\newcommand{\sidecite}[1][]{% - \@ifnextchar[{% - \expandafter\@sidenotes@sidecitedo\@sidenotes@getnextopt{#1}% - }{% - \@sidenotes@sidecitedo{#1}{}% - }% -} -\newcommand{\@sidenotes@getnextopt}{} -\long\def\@sidenotes@getnextopt#1[#2]{{#1}{#2}} -\newcommand{\@sidenotes@sidecitedo}[3]{% - \begingroup% - \@ifnextchar [{\@sidenotes@sidecite[{#1}][{#2}]{#3}}{\@sidenotes@sidecite[{#1}][{#2}]{#3}[]}% -} -\newcommand{\@sidenotes@sidecite}{} -\def\@sidenotes@sidecite[#1][#2]#3[#4]{% - \endgroup% - \@sidenotes@@sidecite[{#1}][{#2}]{#3}[{#4}]% +\ifthenelse{\boolean{@sidenotes@bibtex}} +{\newcommand{\sidecite}[1]{% +\sidenote{\bibentry{#1}}% +}} +{\newcommand{\sidecite}[1][]{% + \@ifnextchar[{% + \expandafter\@sidenotes@sidecitedo\@sidenotes@getnextopt{#1}% + }{% + \@sidenotes@sidecitedo{#1}{}% + }% } - -\newcommand{\@sidenotes@@sidecite}{} -\def\@sidenotes@@sidecite[#1][#2]#3[#4]{% - \sidenote{\fullcite[#1][#2]{#3}}[#4]% -}% +\newcommand{\@sidenotes@getnextopt}{} +\long\def\@sidenotes@getnextopt#1[#2]{{#1}{#2}} +\newcommand{\@sidenotes@sidecitedo}[3]{% +\sidenote{\fullcite[#1][#2]{#3}}% +}}% % \end{macrocode} % \end{macro} % % \begin{macro}{\sidecaption} -% Sidecaption puts the caption in the margin. The additional, optional argument postfix sets the offset. +% Sidecaption puts the caption in the margin. % It never floats with the other text in the margin, it has to be next to the figure. % \begin{macrocode} \newcommand{\sidecaption}[2][]{% - \ifthenelse{\isempty{#1}}% - {\marginnote{\caption{#2}}}% - % else - {\marginnote{\caption[#1]{#2}}}% +\ifthenelse{\isempty{#1}}% +{\marginnote{\caption{#2}}}% +{\marginnote{\caption[#1]{#2}}}% }% % \end{macrocode} % \end{macro} % % \begin{environment}{sidefigure} % \changes{v0.3}{2011/09/29}{define the sidefigure enviroment without the environ package} -% The sidefigure is similar to the figure environment. But the figure is put in the margin and the positioning -% is not h or b, but rather an offset, e.g.\ 10pt.\ +% The sidefigure is similar to the figure environment. But the figure is put in the margin. % \begin{macrocode} \newsavebox{\@sidenotes@sidefigurebox} -\newboolean{@sidenotes@sidefigure@skip} -\newcommand{\@sidenotes@sidefigure@skiplength}{} - \newenvironment{sidefigure}[1][]% - {\ifthenelse{\isempty{#1}} % offset? - {\setboolean{@sidenotes@sidefigure@skip}{false}} % no offset - {\setboolean{@sidenotes@sidefigure@skip}{true}\renewcommand{\@sidenotes@sidefigure@skiplength}{#1}} % with offset - \begin{lrbox}{\@sidenotes@sidefigurebox}% - \begin{minipage}{\marginparwidth}% - \captionsetup{type=figure}}% - { \end{minipage}% - \end{lrbox}% - \ifthenelse{\boolean{@sidenotes@sidefigure@skip}}% offset? - {\marginnote{\usebox{\@sidenotes@sidefigurebox}}[\@sidenotes@sidefigure@skiplength]} % with offset - {\marginpar{\usebox{\@sidenotes@sidefigurebox}}} % no offset - } +{\begin{lrbox}{\@sidenotes@sidefigurebox}% +\begin{minipage}{\marginparwidth}% +\captionsetup{type=figure}}% +{\end{minipage}% +\end{lrbox}% +\marginpar{\usebox{\@sidenotes@sidefigurebox}} +} % \end{macrocode} % \end{environment} % % \begin{environment}{sidetable} % \changes{v0.4}{2011/09/30}{define the sidetable enviroment without the environ package} -% The sidetable is similar to the table environment. But the table is put in the margin and the positioning -% is not h or b, but rather an offset, e.g.\ 10pt.\ +% The sidetable is similar to the table environment. But the table is put in the margin. % \begin{macrocode} \newsavebox{\@sidenotes@sidetablebox} -\newboolean{@sidenotes@sidetable@skip} -\newcommand{\@sidenotes@sidetable@skiplength}{} - \newenvironment{sidetable}[1][]% - {\ifthenelse{\isempty{#1}} % offset? - {\setboolean{@sidenotes@sidetable@skip}{false}} % no offset - {\setboolean{@sidenotes@sidetable@skip}{true}\renewcommand{\@sidenotes@sidetable@skiplength}{#1}} % with offset - \begin{lrbox}{\@sidenotes@sidetablebox}% - \begin{minipage}{\marginparwidth}% - \captionsetup{type=table}% - \sidestyle}% - { \end{minipage}% - \end{lrbox}% - \ifthenelse{\boolean{@sidenotes@sidetable@skip}}% offset? - {\marginnote{\usebox{\@sidenotes@sidetablebox}}[\@sidenotes@sidetable@skiplength]} % with offset - {\marginpar{\usebox{\@sidenotes@sidetablebox}}} % no offset - } -% \end{macrocode} +{\begin{lrbox}{\@sidenotes@sidetablebox}% +\begin{minipage}{\marginparwidth}% +\captionsetup{type=table}% +\sidestyle}% +{\end{minipage}% +\end{lrbox}% +\marginpar{\usebox{\@sidenotes@sidetablebox}} +}% \end{macrocode} % \end{environment} % % \Finale diff --git a/Master/texmf-dist/tex/latex/sidenotes/sidenotes.sty b/Master/texmf-dist/tex/latex/sidenotes/sidenotes.sty index 8877c3f19fb..477c72a6d06 100644 --- a/Master/texmf-dist/tex/latex/sidenotes/sidenotes.sty +++ b/Master/texmf-dist/tex/latex/sidenotes/sidenotes.sty @@ -13,33 +13,26 @@ %% about the files the work consists of. %% \ProvidesPackage{sidenotes}[% - 2011/10/06 v0.53 rich text in the margin for LaTeX] + 2011/11/10 v0.80 rich text in the margin for LaTeX] \RequirePackage{marginnote} % puts the stuff in the margin and provides an offset option instead of a float \RequirePackage{caption} % handles the figure caption (in the margin) \RequirePackage{xifthen} % provide an if command +\newboolean{@sidenotes@bibtex}% +\setboolean{@sidenotes@bibtex}{false}% +\DeclareOption{bibtex}{\setboolean{@sidenotes@bibtex}{true}}% +\ProcessOptions +\ifthenelse{\boolean{@sidenotes@bibtex}}{\RequirePackage{bibentry}}{} \newcommand*{\sidestyle}{\footnotesize} \newcounter{sidenote} % make counter \newcounter{@sidenotes@buffer} \setcounter{sidenote}{1} % init counter -\newcommand*{\sidenote}[2][]{% -\begingroup% -\@ifnextchar [{\@sidenotes@sidenote[{#1}]{#2}}{\@sidenotes@sidenote[{#1}]{#2}[]}% -} - -\newcommand{\@sidenotes@sidenote}{} -\def\@sidenotes@sidenote[#1]#2[#3]{% -\endgroup% -\@sidenotes@@sidenote[{#1}]{#2}[{#3}]% -} - -\newcommand{\@sidenotes@@sidenote}{} -\def\@sidenotes@@sidenote[#1]#2[#3]{% +\newcommand{\sidenote}[2][]{% \ifthenelse{\isempty{#1}}% {\sidenotemark% -\sidenotetext{#2}[#3]}% +\sidenotetext{#2}}% {\sidenotemark[#1]% -\sidenotetext[#1]{#2}[#3]}% +\sidenotetext[#1]{#2}}% } \newcommand{\sidenotemark}[1][]{% \nobreak\hspace{0.1pt}\nobreak% @@ -52,31 +45,19 @@ \setcounter{sidenote}{\value{@sidenotes@buffer}}}% \ignorespaces% }% -\newcommand*{\sidenotetext}[2][]{% -\begingroup% -\@ifnextchar [{\@sidenotes@sidenotetext[{#1}]{#2}}{\@sidenotes@sidenotetext[{#1}]{#2}[]}% -} - -\newcommand{\@sidenotes@sidenotetext}{} -\def\@sidenotes@sidenotetext[#1]#2[#3]{% -\endgroup% -\@sidenotes@@sidenotetext[{#1}]{#2}[{#3}]% -} - -\newcommand{\@sidenotes@@sidenotetext}{} -\def\@sidenotes@@sidenotetext[#1]#2[#3]{% +\newcommand{\sidenotetext}[2][]{% \ifthenelse{\isempty{#1}}{% sitenotemark given? \addtocounter{sidenote}{-1}% -\ifthenelse{\isempty{#3}}{% offset? -\marginpar{\textsuperscript{\thesidenote}{} \sidestyle#2}}% no offset -{\marginnote{\textsuperscript{\thesidenote}{} \sidestyle#2}[#3]} % with offest +\marginpar{\textsuperscript{\thesidenote}{} \sidestyle#2}% \addtocounter{sidenote}{1}}% -{\ifthenelse{\isempty{#3}}% offset? -{\marginpar{\textsuperscript{#1} \sidestyle#2}}% no offset -{\marginnote{\textsuperscript{\thesidenote}{} \sidestyle#2}}% with offset +{\marginpar{\textsuperscript{#1} \sidestyle#2}% }% fi }% -\newcommand{\sidecite}[1][]{% +\ifthenelse{\boolean{@sidenotes@bibtex}} +{\newcommand{\sidecite}[1]{% +\sidenote{\bibentry{#1}}% +}} +{\newcommand{\sidecite}[1][]{% \@ifnextchar[{% \expandafter\@sidenotes@sidecitedo\@sidenotes@getnextopt{#1}% }{% @@ -86,59 +67,32 @@ \newcommand{\@sidenotes@getnextopt}{} \long\def\@sidenotes@getnextopt#1[#2]{{#1}{#2}} \newcommand{\@sidenotes@sidecitedo}[3]{% - \begingroup% -\@ifnextchar [{\@sidenotes@sidecite[{#1}][{#2}]{#3}}{\@sidenotes@sidecite[{#1}][{#2}]{#3}[]}% -} -\newcommand{\@sidenotes@sidecite}{} -\def\@sidenotes@sidecite[#1][#2]#3[#4]{% -\endgroup% -\@sidenotes@@sidecite[{#1}][{#2}]{#3}[{#4}]% -} - -\newcommand{\@sidenotes@@sidecite}{} -\def\@sidenotes@@sidecite[#1][#2]#3[#4]{% -\sidenote{\fullcite[#1][#2]{#3}}[#4]% -}% +\sidenote{\fullcite[#1][#2]{#3}}% +}}% \newcommand{\sidecaption}[2][]{% \ifthenelse{\isempty{#1}}% {\marginnote{\caption{#2}}}% {\marginnote{\caption[#1]{#2}}}% }% \newsavebox{\@sidenotes@sidefigurebox} -\newboolean{@sidenotes@sidefigure@skip} -\newcommand{\@sidenotes@sidefigure@skiplength}{} - \newenvironment{sidefigure}[1][]% -{\ifthenelse{\isempty{#1}} % offset? -{\setboolean{@sidenotes@sidefigure@skip}{false}} % no offset -{\setboolean{@sidenotes@sidefigure@skip}{true}\renewcommand{\@sidenotes@sidefigure@skiplength}{#1}} % with offset -\begin{lrbox}{\@sidenotes@sidefigurebox}% +{\begin{lrbox}{\@sidenotes@sidefigurebox}% \begin{minipage}{\marginparwidth}% \captionsetup{type=figure}}% -{ \end{minipage}% +{\end{minipage}% \end{lrbox}% -\ifthenelse{\boolean{@sidenotes@sidefigure@skip}}% offset? -{\marginnote{\usebox{\@sidenotes@sidefigurebox}}[\@sidenotes@sidefigure@skiplength]} % with offset -{\marginpar{\usebox{\@sidenotes@sidefigurebox}}} % no offset +\marginpar{\usebox{\@sidenotes@sidefigurebox}} } \newsavebox{\@sidenotes@sidetablebox} -\newboolean{@sidenotes@sidetable@skip} -\newcommand{\@sidenotes@sidetable@skiplength}{} - \newenvironment{sidetable}[1][]% -{\ifthenelse{\isempty{#1}} % offset? -{\setboolean{@sidenotes@sidetable@skip}{false}} % no offset -{\setboolean{@sidenotes@sidetable@skip}{true}\renewcommand{\@sidenotes@sidetable@skiplength}{#1}} % with offset -\begin{lrbox}{\@sidenotes@sidetablebox}% +{\begin{lrbox}{\@sidenotes@sidetablebox}% \begin{minipage}{\marginparwidth}% \captionsetup{type=table}% \sidestyle}% -{ \end{minipage}% +{\end{minipage}% \end{lrbox}% -\ifthenelse{\boolean{@sidenotes@sidetable@skip}}% offset? -{\marginnote{\usebox{\@sidenotes@sidetablebox}}[\@sidenotes@sidetable@skiplength]} % with offset -{\marginpar{\usebox{\@sidenotes@sidetablebox}}} % no offset -} +\marginpar{\usebox{\@sidenotes@sidetablebox}} +}% \end{macrocode} \endinput %% %% End of file `sidenotes.sty'. |