summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-10-12 23:06:28 +0000
committerKarl Berry <karl@freefriends.org>2011-10-12 23:06:28 +0000
commitaa3c4df467c45cb55270c0f7b04378a2c132637c (patch)
treebfab1606f9b03f712f8dae9abe7743581a1b9c97 /Master/texmf-dist
parentdbb79e00b454d5ef01b12000a491fa3e7203973b (diff)
sidenotes (12oct11)
git-svn-id: svn://tug.org/texlive/trunk@24275 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/doc/latex/sidenotes/sidenotes.pdfbin190233 -> 200851 bytes
-rw-r--r--Master/texmf-dist/source/latex/sidenotes/sidenotes.dtx150
-rw-r--r--Master/texmf-dist/tex/latex/sidenotes/sidenotes.sty64
3 files changed, 151 insertions, 63 deletions
diff --git a/Master/texmf-dist/doc/latex/sidenotes/sidenotes.pdf b/Master/texmf-dist/doc/latex/sidenotes/sidenotes.pdf
index 353bd28452c..938c88a7f72 100644
--- a/Master/texmf-dist/doc/latex/sidenotes/sidenotes.pdf
+++ b/Master/texmf-dist/doc/latex/sidenotes/sidenotes.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/sidenotes/sidenotes.dtx b/Master/texmf-dist/source/latex/sidenotes/sidenotes.dtx
index 5a12e994e07..68e3f6142e9 100644
--- a/Master/texmf-dist/source/latex/sidenotes/sidenotes.dtx
+++ b/Master/texmf-dist/source/latex/sidenotes/sidenotes.dtx
@@ -1,5 +1,8 @@
+% \CheckSum{180}
% \iffalse meta-comment
%
+% sidenotes.dtx
+%
% Copyright (C) 2011 by Andy Thomas <andy.thomas(at)uni.bielefeld.de>
%
% This work may be distributed and/or modified under the
@@ -17,29 +20,24 @@
%</driver>
%<package>\ProvidesPackage{sidenotes}[%
%<*driver|package>
- 2011/08/21 v0.2 footnotes in the margin for LaTeX]
+ 2011/10/06 v0.53 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{environ} % to define new environments more easily
%<package>\RequirePackage{xifthen} % provide an if command
-%<package>\RequirePackage{twoopt} % cite in the biblatex package has 2 optional arguments
%<*driver>
\documentclass{ltxdoc}
-\EnableCrossrefs
\CodelineIndex
\RecordChanges
\begin{document}
\DocInput{sidenotes.dtx}
+\PrintIndex
\PrintChanges
- \PrintIndex
\end{document}
%</driver>
% \fi
%
-% \CheckSum{0}
-%
-% \CharacterTable
+% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
% Digits \0\1\2\3\4\5\6\7\8\9
@@ -56,11 +54,8 @@
% Right brace \} Tilde \~}
%
%
-% \changes{v0.2}{2011/08/21}{Initial version}
%
% \GetFileInfo{sidenotes.dtx}
-%
-% \DoNotIndex{\newcommand,\newenvironment}
%
%
% \title{The \textsf{sidenotes} package\thanks{This document
@@ -69,18 +64,21 @@
%
% \maketitle
%
+% \changes{v0.51}{2011/10/05}{Extent the documentation of the macros.}
% \begin{abstract}
-% This package tries to allow typesetting of texts with notes,
-% figures, citations, captions and tables in the margin. This is common
-% in science textbooks such as Feyman's \textit{Lectures on Physics}.
+% 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 is common in science textbooks such as Feyman's \textit{Lectures on Physics}.
% \end{abstract}
%
% \tableofcontents
%
+% \changes{v0.2}{2011/08/21}{Initial version}
+%
% \section{Usage}
%
% \DescribeMacro{\sidenote}
-% The macro \verb+\sidenote+ is the main feature of the package. The macro is very similar to
+% The macro \verb+\sidenote+ is one main feature of the package. 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:
@@ -89,24 +87,35 @@
% (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.
+% of sidenotes or other marginals. All the sidenotes are subsequently numbered. The
+% first, optional parameter will manually change the numbering of the sidenote.
+%
% \DescribeMacro{\sidenotemark}
-% Sidenote tries to mimic the footnote behavior,
-% so you can also use \verb+\sidenotemark[number]+ and \verb+\sidenotetext[number]{text}+ commands.
+% Sidenote tries to mimic the footnote behavior and tries to provide 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[number]+ and \verb+\sidenotetext[number]{text}+
+% commands. \verb+\sidenotemark+ puts a mark at the current position. Then, outside of the environment
% \DescribeMacro{\sidenotetext}
-% This is especially useful, if your are in an environment that does not allow to evoke foot- or sidenote macros.
+% 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]+
+%
% \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 it initialized with \verb+\footnotesize+. It is used as a prefix of the sidenotetext.
%
% \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 this feature. Therefore, the
-% macro has the same set of parameters plus the offset:
+% 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.
+% 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
@@ -118,39 +127,48 @@
% \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
-% the use of caption before \verb+\includegraphics+ or such puts the caption on top
-% and the use after puts it below the actual figure.
+% 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, use \verb+\begin{sidetable}[offset]+ instead
+% The sidetable environment works similarly, but with table environments. Use \verb+\begin{sidetable}[offset]+ 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 the mark in the text. This can be achieved
+% 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.
-% The package also relies on the caption package by Harald Axel Sommerfeldt.
-% The formatting of the figure and table captions
-% has to be done through the caption package.
-%
-% Right now, the package also requires the packages twoopt, environ and xifthen as well. At least the dependence
-% on twoopt and environ should be omitted in the next versions.
%
% 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
-% such as margin text size, color or anything else. Only \verb+\sidestyle+ was added for convinience. If you are
+% such as margin text size, color or anything else. Only \verb+\sidestyle+ was added for convenience. If you are
% looking for a package that provides formatting defaults as well you might want to look into the tufte-latex packages.
-% \StopEventually{}
+%
+% \section{Required packages}
+%
+% \changes{v0.52}{2011/10/06}{added a section that the package needs marginnote, caption and xifthen.}
+% 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.
+% \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.
+% \end{description}%
%
% \section{Implementation}
%
+% \iffalse
+%<*package>
+% \fi%
% \begin{macro}{\sidestyle}
% This macro changes the text formatting of the sidenotes.
% Initially it just sets the text size to the footnote text size.
@@ -168,6 +186,7 @@
% \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}
% \begin{macrocode}
\newcommand*{\sidenote}[2][]{%
\begingroup%
@@ -186,7 +205,7 @@
{\sidenotemark%
\sidenotetext{#2}[#3]}%
{\sidenotemark[#1]%
- \sidenotetext[#1]{#2}}%
+ \sidenotetext[#1]{#2}[#3]}%
}
% \end{macrocode}
% \end{macro}
@@ -242,11 +261,21 @@
%
%
% \begin{macro}{\sidecite}
+% \changes{v0.5}{2011/10/05}{define the sidecite macro without the twoopt package}
% 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}
-\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}{}
@@ -276,26 +305,53 @@
% \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.\
% \begin{macrocode}
-\NewEnviron{sidefigure}[1][]{%
- \ifthenelse{\isempty{#1}} % offset?
- {\marginpar{\captionsetup{type=figure}\BODY}} % no offset
- {\marginnote{\captionsetup{type=figure}\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
+ }
% \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.\
% \begin{macrocode}
-\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@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}
% \end{environment}
%
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'.