diff options
author | Karl Berry <karl@freefriends.org> | 2013-12-18 22:01:25 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-12-18 22:01:25 +0000 |
commit | 6b143eea98b60a128b535e6b84043e76b4798569 (patch) | |
tree | 91dc539527d7d75ab09d02d9f232238296c6b002 /Master | |
parent | 51dd85fd0039ad102b4c0551cefc94c2dc7b46c0 (diff) |
sidenotes (18dec13)
git-svn-id: svn://tug.org/texlive/trunk@32439 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/sidenotes/caesar_example.pdf | bin | 0 -> 67225 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/sidenotes/caesar_example.tex | 128 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/sidenotes/sidenotes.pdf | bin | 198887 -> 199873 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/sidenotes/sidenotes.dtx | 27 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/sidenotes/caesar_book.cls | 132 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/sidenotes/sidenotes.sty | 19 |
6 files changed, 291 insertions, 15 deletions
diff --git a/Master/texmf-dist/doc/latex/sidenotes/caesar_example.pdf b/Master/texmf-dist/doc/latex/sidenotes/caesar_example.pdf Binary files differnew file mode 100644 index 00000000000..c14745b0f2f --- /dev/null +++ b/Master/texmf-dist/doc/latex/sidenotes/caesar_example.pdf diff --git a/Master/texmf-dist/doc/latex/sidenotes/caesar_example.tex b/Master/texmf-dist/doc/latex/sidenotes/caesar_example.tex new file mode 100644 index 00000000000..3cb3d70fd48 --- /dev/null +++ b/Master/texmf-dist/doc/latex/sidenotes/caesar_example.tex @@ -0,0 +1,128 @@ +\documentclass{caesar_book} +% +% -- use dummy graphics +\usepackage{mwe} + +%auto generate the bib file +\usepackage{filecontents} +% +\begin{filecontents}{\jobname.bib} +@book{Tufte2006, + author = {Edward R. Tufte}, + title = {Beautiful Evidence}, + year = {2006}, + publisher = {Graphics Press, {LLC}}, + isbn = {0-9613921-7-7} +} + +@book{Tufte1990, + author = {Edward R. Tufte}, + title = {Envisioning Information}, + publisher = {Graphics Press}, + year = {1990}, + isbn = {0-9613921-1-8} +} +\end{filecontents} + +% -- language: English -- +% +\usepackage[english]{babel} +% -- biblatex -- +\usepackage[backend=biber,style=philosophy-classic]{biblatex} % xxx +% the .bib file with the references +\addbibresource{\jobname.bib} + +% Information about the book +% to be put on the title page +\title{Caesar\\Quick start} +\author{Andy Thomas} +\publisher{Bielefeld University} + +\begin{document} +% no page numbering in front matter +\frontmatter +% generate the title page +\maketitlepage +% show the table of contents +\tableofcontents +% start to number the pages +\mainmatter +% The first chapter with annotation and citations +\chapter{Quick start} +% +We compiled a minimal example file to show the basic use of the caesar class, which allows the typesetting of (science) textbooks or theses. The class itself is a reference implementation of the \emph{sidenotes} package. The package provides the additional functionality\sidenote{namely the use of marginal material such as this note or even figures or tables.} and the class gives sensible default values for page margins, chapter formatting and such. The caesar class is derived from the standard \LaTeX-book class and a little bit of experience with the standard class might be very helpful. In this example, biblatex is used for the references. + +The first pages of the book (the frontmatter) are not numbered, the numbering starts after the \texttt{mainmatter} macro, which is called after the generation of the title page. The layout has ample margins to allow annotations. A main feature and the package is the sidenote, which is a footnote in the margin and can be placed with the \texttt{sidenote} macro.\sidenote{All information is on the same page, no turning of pages is necessary.} It is very similar to \texttt{footnote} and tries to emulate its behavior. The sidenote moves up or down (floats) to not overlap with other floats in the margin and all the sidenotes are subsequently numbered. + +References can be put in the margin as well.\sidecite[For the ideas behind all this, please see:][ and more work by Tufte.]{Tufte1990,Tufte2006} The macro was named \texttt{sidecite} and is defined with two optional parameters (prefix and postfix) similar to \texttt{cite} taken from the biblatex package. The next two sections describe the different options for the use of figures and tables in a document. We start with a couple of figures. +% A section with a couple of figures +\section{Figures} +% +\begin{marginfigure}% + \includegraphics[width=\marginparwidth]{example-image-a}% + \caption{A small rectangle put in the margin.\label{rectangle}}% +\end{marginfigure}% +% +There are three basic options to include figures in a document. The first option is a small figure and its caption in the margin. Figure \ref{rectangle} shows that with a gray rectangle framing the letter \emph{A}. We simply use the \texttt{marginfigure} environment instead of the \texttt{figure} one. + +The next alternative is a figure in the text frame. The figure is placed using the regular \LaTeX-figure environment and its caption, which is displayed in figure~\ref{rectangle2}. +% +\begin{figure}[htbp]% + \includegraphics[height=180pt,width=\textwidth]{example-image-b}% + \caption{A larger rectangle in the main area of the text, i.e.\ it does not span into the margin.}% + \label{rectangle2}% +\end{figure}% +% + +In case that a wider figure is needed, the third option spans over the text as well as the margin area. Here, the common \texttt{figure*} environment can be used. The figure options make it easy to choose the appropriate size for a given input file. +% +\begin{figure*}[htbp] + \includegraphics[height=180pt,width=400pt]{example-image-c}% + \caption{An even larger rectangle. This is the widest figure option. Both, the text as well as the margin width are used for the diagram.} + \label{rectangle3} +\end{figure*} +% + +% Next section with a variety of tables +\section{Tables} +The same set of options (small, normal and wide) are also available for tables. The first option is a small table in the margin, this \texttt{margintable} is shown in table \ref{table1}. +% +\begin{margintable}% + \begin{tabular}{lll}% + A&B&C\\% + 0.50&0.47&0.48\\% + \end{tabular}% + \vspace{2pt} + \caption{A couple of numbers in a table in the margin.\label{table1}}% +\end{margintable}% + +Table \ref{table2} displays a larger table with more numbers. This is done using regular \LaTeX-macros for placing the table along with its caption. +% +\begin{table}[htbp]% + \begin{tabular}{lllllllll}% + A&B&C&D&E&F&G&H&I\\% + 0.50&0.47&0.48&0.50&0.47&0.48&0.60&0.39&1.00\\% + \end{tabular}% + \vspace{2pt}% + \captionsetup{width=\textwidth, justification=justified}% + \caption{A couple of numbers in a larger table. This table spans the usual text width.\label{table2}}% +\end{table}% + +The \texttt{table*} environment is also defined in analogy to \texttt{figure*} and is demonstrated in table \ref{table3}. +% +\begin{table*}[h!] + \begin{tabular}{lllllllllllll}% + A&B&C&D&E&F&G&H&I&J&K&L&M\\% + 0.50&0.47&0.48&0.50&0.47&0.48&0.60&0.39&1.00&0.50&0.47&0.48&0.60\\% + \end{tabular}% + \vspace{2pt} + \caption{Even more numbers in a big table are shown here. This table spans across the full page, text width plus margin.\label{table3}}% +\end{table*} + +% +\section{More information} +\marginpar{It is also possible to put a comment in the margin without a corresponding mark in the text with \texttt{marginpar}.} This is a short example file to show the features of the caesar class together with the sidenotes package. Sometimes it is necessary to compile the document up to 3 times in order to get the alignment of all objects correctly. +% +\printbibliography[heading=bibintoc] + % +\end{document} diff --git a/Master/texmf-dist/doc/latex/sidenotes/sidenotes.pdf b/Master/texmf-dist/doc/latex/sidenotes/sidenotes.pdf Binary files differindex a223b907b2d..e7c8014088a 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/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} diff --git a/Master/texmf-dist/tex/latex/sidenotes/caesar_book.cls b/Master/texmf-dist/tex/latex/sidenotes/caesar_book.cls new file mode 100644 index 00000000000..750ae562708 --- /dev/null +++ b/Master/texmf-dist/tex/latex/sidenotes/caesar_book.cls @@ -0,0 +1,132 @@ +\NeedsTeXFormat{LaTeX2e} +\ProvidesFile{caesar_book.cls}[2013/12/18 v0.93 Caesar book] +% Load the amsmath and the mhchem package before loading microtype +\RequirePackage{amsmath}% better math handling +\RequirePackage[version=3]{mhchem}% chemical formulas +\LoadClassWithOptions{book}% this is derived from the book class +\RequirePackage{sidenotes}% put annotations, tables and figures in the margin +\captionsetup{font=footnotesize, skip=4pt} +\RequirePackage[maxfloats=45]{morefloats}% a lot of marginals need more float 'memory' +\RequirePackage{marginfix}% automatically adjust the side-floats nicely +\newcommand{\caesar@letterspace}[1]{#1}% allow LuaLaTeX, LaTeX letterspacing +\RequirePackage{microtype}% microtypography +\@ifpackagelater{microtype}{2011/08/18}% xxx allow LaTeX and earlier microtype +{\renewcommand{\caesar@letterspace}[1]{\textls{#1}}}% +{\AtEndDocument{\ClassWarningNoLine{caesar_book}{Need newest microtype (beta) for letterspacing.}}} +% Set page layout geometry -- default is epubli science-book format +\RequirePackage[paperwidth=170mm, paperheight=240mm, left=42pt, top=40pt, textwidth=280pt, marginparsep=20pt, marginparwidth=100pt, textheight=560pt, footskip=40pt]{geometry} +% fontsize is 10pt, 13pt for book +\renewcommand{\normalsize}{\fontsize{10pt}{13pt}\selectfont}% +\renewcommand{\footnotesize}{\fontsize{8pt}{10pt}\selectfont}% +% fullwidth environment, text across textwidth+marginparsep+marginparwidth +\newlength{\overhang} +\setlength{\overhang}{\marginparwidth} +\addtolength{\overhang}{\marginparsep} +% +\newenvironment{fullwidth} + {\ifthenelse{\boolean{@twoside}}% + {\begin{adjustwidth*}{}{-\overhang}}% + {\begin{adjustwidth}{}{-\overhang}}% + }% + {\ifthenelse{\boolean{@twoside}}% + {\end{adjustwidth*}}% + {\end{adjustwidth}}% + } +% set up the fonts +\RequirePackage{ifluatex} +\ifluatex% in LuaLateX we use fontspec + \RequirePackage{fontspec}% + \RequirePackage[vargreek-shape=TeX]{unicode-math}% + \setmathfont{Asana-Math.otf}% asana math works well with palatino + \setmainfont[Ligatures=TeX, Numbers=OldStyle]{Tex Gyre Pagella}% free Palatino clone + \setmonofont{Tex Gyre Cursor}% works okay with palatino + \setsansfont{Tex Gyre Heros}% work okay with palatino + \mhchemoptions{textfontcommand=\addfontfeature{Numbers=Lining}} % use lining numbers for chemical formulas +\else% in LaTeX we load fonts differently + \IfFileExists{mathpazo.sty}{\RequirePackage[osf,sc]{mathpazo}}{}% palatino clone for math + \IfFileExists{helvet.sty}{\RequirePackage{helvet}}{}% helvetica is sans serif font + \IfFileExists{beramono.sty}{\RequirePackage{beramono}}{}% beramono is tt font + \RequirePackage[T1]{fontenc}% finally load fontenc +\fi +% nice headings and TOC +\RequirePackage{titlesec,titletoc}% load the helper package +\setcounter{secnumdepth}{-1}% no numbering at all +\titleformat{\chapter}[display]{\relax\itshape\huge}{}{0pt}{\huge\rmfamily\itshape}[]% chapter format +\titleformat{\section}[hang]{\normalfont\Large\itshape}{}{1em}{}[]% section format +\titleformat{\subsection}[hang]{\normalfont\large\itshape}{}{1em}{}[]% subsection format +\titleformat{\paragraph}[runin]{\normalfont\itshape}{}{1em}{}[]% paragraph format +\renewcommand*\descriptionlabel[1]{\hspace\labelsep\normalfont\em #1}% italic description instead of bold) +\setcounter{tocdepth}{0}% The Table of Contents, only chapters +\titlecontents{chapter}% + [0em] % distance from left margin + {\vspace{1.5\baselineskip}\begin{fullwidth}\LARGE\rmfamily\itshape} % above (global formatting of entry) + {\hspace*{0em}\contentslabel{2em}} % before w/label (label = ``2'') + {\hspace*{0em}} % before w/o label + {\rmfamily\upshape\qquad\thecontentspage} % filler + page (leaders and page num) + [\end{fullwidth}] % after +%set up header, footer and page numbering +\RequirePackage{fancyhdr}% helper package +\renewcommand{\headrulewidth}{0pt}% The running heads and feet do not have rules +\renewcommand{\footrulewidth}{0pt} +\fancyhf{}% set up the page numbering +{\fancyfoot[LE,RO]{\thepage}} +\fancypagestyle{plain}{% + \fancyhf{} +} +\renewcommand{\frontmatter}{\pagestyle{empty}}% the frontmatter is empty +\renewcommand{\mainmatter}{\cleardoublepage\pagestyle{fancy}}% mainmatter with page numbering +\RequirePackage{ragged2e} % \RaggedRight works better than \raggedright +\newcommand{\marginparstyle}{\footnotesize\RaggedRight} % initialize style with start value +\long\def\@ympar#1{% redefine margin par to avoid too many macros in the document + \@savemarbox\@marbox{\marginparstyle#1}% marginparstyle is a prefix to the marginpar text now + \global\setbox\@currbox\copy\@marbox % the rest of the definition is taken from original LaTeX + \@xympar} +\renewcommand*{\marginfont}{\marginparstyle} +% setup itemize and enumerate +\RequirePackage{enumitem} +\setlist[itemize]{leftmargin=*} +%\renewcommand{\labelitemi}{} +% compatibility with T-L +% +% titlepage +\newcommand{\publisher}[1]{\gdef\caesar@publisher{#1}} +\RequirePackage{textcase} % provides \MakeTextUppercase and \MakeTextLowercase +\RequirePackage{color} % the title is too black, define gray +\definecolor{darkgray}{rgb}{0.25,0.25,0.25} +\newcommand{\maketitlepage}{% the title page is generated here + % first count the number of lines in the title + \setbox0\vbox{\noindent\fontsize{30}{38}\selectfont\caesar@letterspace{\MakeTextUppercase{\@title}}\par + \count@\z@ + \loop + \unskip\unpenalty\unskip\unpenalty\unskip + \setbox0\lastbox + \ifvoid0 + \xdef\caesar@numlines{\the\count@}% + \else + \advance\count@\@ne + \repeat} + % now adjust the vertical spaces accordingly + \edef\caesar@titlespace{\the\dimexpr 210pt - 15pt * \caesar@numlines \relax}% calculate the necessary space + \cleardoublepage% + \begingroup% + {% + \sffamily% + \begin{fullwidth}% + \vspace*{0em}% one line extra space + \LARGE\caesar@letterspace{\MakeTextUppercase{\@author}}\par + \vfill% + \noindent\fontsize{30}{38}\selectfont\textcolor{darkgray}{\caesar@letterspace{\MakeTextUppercase{\@title}}}\par + \vfill% + \vspace{\caesar@titlespace}% + \Large\noindent\caesar@letterspace{\MakeTextUppercase{\caesar@publisher}}\par + \end{fullwidth}% + }% + \endgroup% + \thispagestyle{empty}% + \clearpage% +} +\newcommand\newthought[1]{% + \addvspace{1.0\baselineskip plus 0.5ex minus 0.2ex}% + \noindent\textsc{#1}% +}% +\newcommandtwoopt{\sidecite}[3][][]{\sidenote{\fullcite[#1][#2]{#3}}} diff --git a/Master/texmf-dist/tex/latex/sidenotes/sidenotes.sty b/Master/texmf-dist/tex/latex/sidenotes/sidenotes.sty index f0cbb66dc4e..a6598e9bb1f 100644 --- a/Master/texmf-dist/tex/latex/sidenotes/sidenotes.sty +++ b/Master/texmf-dist/tex/latex/sidenotes/sidenotes.sty @@ -13,7 +13,7 @@ %% about the files the work consists of. %% \ProvidesPackage{sidenotes}[% - 2012/11/09 v0.92 rich text in the margin for LaTeX] + 2012/04/07 v0.93 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 @@ -22,12 +22,17 @@ \newcounter{sidenote} % make counter \newcounter{@sidenotes@buffer} \setcounter{sidenote}{1} % init counter - +\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}% \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{,}}{}}% } \newcommand{\sidenotemark}[1][]{% \nobreak\hspace{0.1pt}\nobreak% @@ -38,7 +43,7 @@ \setcounter{sidenote}{#1}% \textsuperscript{\thesidenote}% print out the argument otherwise \setcounter{sidenote}{\value{@sidenotes@buffer}}}% -\@ifnextchar\sidenote{\textsuperscript{,}}{}% +\@sidenotes@ifnextchar\sidenote{\textsuperscript{,}}{}% \ignorespaces% }% \newcommandtwoopt{\sidenotetext}[3][][]{% @@ -49,8 +54,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]}}% }% \DeclareCaptionStyle{sidecaption}{font=footnotesize} \newcommand{\sidecaption}{\@ifstar\@sidenotes@sidecaption@starred\@sidenotes@sidecaption@unstarred} |