diff options
author | Karl Berry <karl@freefriends.org> | 2011-10-12 23:06:28 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-10-12 23:06:28 +0000 |
commit | aa3c4df467c45cb55270c0f7b04378a2c132637c (patch) | |
tree | bfab1606f9b03f712f8dae9abe7743581a1b9c97 /Master/texmf-dist/tex/latex/sidenotes | |
parent | dbb79e00b454d5ef01b12000a491fa3e7203973b (diff) |
sidenotes (12oct11)
git-svn-id: svn://tug.org/texlive/trunk@24275 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 | 64 |
1 files changed, 48 insertions, 16 deletions
diff --git a/Master/texmf-dist/tex/latex/sidenotes/sidenotes.sty b/Master/texmf-dist/tex/latex/sidenotes/sidenotes.sty index 00019db61aa..8877c3f19fb 100644 --- a/Master/texmf-dist/tex/latex/sidenotes/sidenotes.sty +++ b/Master/texmf-dist/tex/latex/sidenotes/sidenotes.sty @@ -13,12 +13,10 @@ %% about the files the work consists of. %% \ProvidesPackage{sidenotes}[% - 2011/08/21 v0.2 footnotes in the margin for LaTeX] + 2011/10/06 v0.53 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{environ} % to define new environments more easily \RequirePackage{xifthen} % provide an if command -\RequirePackage{twoopt} % cite in the biblatex package has 2 optional arguments \newcommand*{\sidestyle}{\footnotesize} \newcounter{sidenote} % make counter \newcounter{@sidenotes@buffer} @@ -41,7 +39,7 @@ {\sidenotemark% \sidenotetext{#2}[#3]}% {\sidenotemark[#1]% -\sidenotetext[#1]{#2}}% +\sidenotetext[#1]{#2}[#3]}% } \newcommand{\sidenotemark}[1][]{% \nobreak\hspace{0.1pt}\nobreak% @@ -78,8 +76,17 @@ {\marginnote{\textsuperscript{\thesidenote}{} \sidestyle#2}}% with offset }% fi }% -\newcommandtwoopt{\sidecite}[3][][]{% -\begingroup% +\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}{} @@ -97,16 +104,41 @@ {\marginnote{\caption{#2}}}% {\marginnote{\caption[#1]{#2}}}% }% -\NewEnviron{sidefigure}[1][]{% -\ifthenelse{\isempty{#1}} % offset? -{\marginpar{\captionsetup{type=figure}\BODY}} % no offset -{\marginnote{\captionsetup{type=figure}\BODY}[#1]} % with offset -}% -\NewEnviron{sidetable}[1][]{% -\ifthenelse{\isempty{#1}} % offset? -{\marginpar{\captionsetup{type=table}\sidestyle\BODY}} % no offset -{\marginnote{\captionsetup{type=table}\sidestyle\BODY}[#1]} % with offset -}% +\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 +} +\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 +} \endinput %% %% End of file `sidenotes.sty'. |