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/texmf-dist/tex/latex/sidenotes | |
parent | 910d7ec0ecd78259b59aa682474418b57b4954bb (diff) |
sidenotes (16nov11)
git-svn-id: svn://tug.org/texlive/trunk@24736 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/sidenotes')
-rw-r--r-- | Master/texmf-dist/tex/latex/sidenotes/sidenotes.sty | 98 |
1 files changed, 26 insertions, 72 deletions
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'. |