summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/sidenotes
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-12-18 22:01:25 +0000
committerKarl Berry <karl@freefriends.org>2013-12-18 22:01:25 +0000
commit6b143eea98b60a128b535e6b84043e76b4798569 (patch)
tree91dc539527d7d75ab09d02d9f232238296c6b002 /Master/texmf-dist/source/latex/sidenotes
parent51dd85fd0039ad102b4c0551cefc94c2dc7b46c0 (diff)
sidenotes (18dec13)
git-svn-id: svn://tug.org/texlive/trunk@32439 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/sidenotes')
-rw-r--r--Master/texmf-dist/source/latex/sidenotes/sidenotes.dtx27
1 files changed, 19 insertions, 8 deletions
diff --git a/Master/texmf-dist/source/latex/sidenotes/sidenotes.dtx b/Master/texmf-dist/source/latex/sidenotes/sidenotes.dtx
index b4a08ccb7a1..f97ae822b58 100644
--- a/Master/texmf-dist/source/latex/sidenotes/sidenotes.dtx
+++ b/Master/texmf-dist/source/latex/sidenotes/sidenotes.dtx
@@ -19,7 +19,7 @@
%</driver>
%<package>\ProvidesPackage{sidenotes}[%
%<*driver|package>
- 2012/11/09 v0.92 rich text in the margin for LaTeX]
+ 2012/04/07 v0.93 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)
@@ -160,24 +160,34 @@
% \changes{v0.91}{2012/06/03}{sidenotetextstyle is not needed any more}
% We need a counter similar to the footnote counter and we want to
% have a buffer.
-% \begin{macrocode}
+% \begin{macrocode}
\newcounter{sidenote} % make counter
\newcounter{@sidenotes@buffer}
\setcounter{sidenote}{1} % init counter
% \end{macrocode}
-
+% \changes{v0.93}{2012/04/17}{regular ifnextchar gobbles trailing whitespaces, introduce a new one that does not.}
+% \begin{macrocode}
+\def\@sidenotes@ifnextchar#1#2#3{%
+\let\@sidenotes@buffere #1\def\@sidenotes@buffera{#2}%
+\def\@sidenotes@bufferb{#3}\futurelet\@sidenotes@bufferc\@sidenotes@ifnextchar@real}%
+\def\@sidenotes@ifnextchar@real{%
+\ifx\@sidenotes@bufferc \@sidenotes@buffere \let\@sidenotes@bufferd\@sidenotes@buffera%
+\else\let\@sidenotes@bufferd\@sidenotes@bufferb\fi\@sidenotes@bufferd}%
+% \end{macrocode}
+%
% \begin{macro}{\sidenote}
% Introduce the sidenote macro with an additional optional argument 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.}
% \changes{v0.81}{2011/11/29}{added a comma between subsequent sidenotes}
% \changes{v0.90}{2012/06/02}{add optional offset for sidenote}
+% \changes{v0.93}{2012/04/17}{removed mandatory whitespace, new ifnextchar takes care of that}
% \begin{macrocode}
\newcommandtwoopt{\sidenote}[3][][]{%
\sidenotemark[#1]%
\sidenotetext[#1][#2]{#3}%
-\@ifnextchar\sidenote{\kern-0.07em\textsuperscript{,}}%
-{\@ifnextchar\sidecite{\kern-0.07em\textsuperscript{,}}{ }}%
+\@sidenotes@ifnextchar\sidenote{\kern-0.07em\textsuperscript{,}}%
+{\@sidenotes@ifnextchar\sidecite{\kern-0.07em\textsuperscript{,}}{}}%
}
% \end{macrocode}
% \end{macro}
@@ -194,7 +204,7 @@
\setcounter{sidenote}{#1}%
\textsuperscript{\thesidenote}% print out the argument otherwise
\setcounter{sidenote}{\value{@sidenotes@buffer}}}%
-\@ifnextchar\sidenote{\textsuperscript{,}}{}%
+\@sidenotes@ifnextchar\sidenote{\textsuperscript{,}}{}%
\ignorespaces%
}%
% \end{macrocode}
@@ -204,6 +214,7 @@
% Sidenotetext is supposed to work similarly to footnotetext. The additional, optional argument sets the offset.
% \changes{v0.80}{2011/11/10}{unstar the newcommand.}
% \changes{v0.90}{2012/06/02}{add optional offset for sidenotetext}
+% \changes{v0.93}{2012/04/17}{add missing comment marks}
% \begin{macrocode}
\newcommandtwoopt{\sidenotetext}[3][][]{%
\ifthenelse{\isempty{#1}}{% sitenotemark given?
@@ -213,8 +224,8 @@
{\marginnote{\textsuperscript{\thesidenote}{} #3}[#2]}%
\addtocounter{sidenote}{1}}%
{\ifthenelse{\isempty{#2}}% offset given?
-{\marginpar{\textsuperscript{#1} #3}}
-{\marginnote{\textsuperscript{#1} #3}[#2]}}
+{\marginpar{\textsuperscript{#1} #3}}%
+{\marginnote{\textsuperscript{#1} #3}[#2]}}%
}%
% \end{macrocode}
% \end{macro}