diff options
author | Karl Berry <karl@freefriends.org> | 2011-05-14 22:31:06 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-05-14 22:31:06 +0000 |
commit | 0aaaba30c9c296f6fec0621ade3402a5196dfe76 (patch) | |
tree | 135d8f6eb1558125b1db7c8a7d8872a80434fa00 /Master/texmf-dist/tex/latex/tablenotes/mynotes.sty | |
parent | 937f42e344ee749b7fa0b175ad026955bf90c9fd (diff) |
tablenotes (14may11)
git-svn-id: svn://tug.org/texlive/trunk@22476 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/tablenotes/mynotes.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/tablenotes/mynotes.sty | 880 |
1 files changed, 503 insertions, 377 deletions
diff --git a/Master/texmf-dist/tex/latex/tablenotes/mynotes.sty b/Master/texmf-dist/tex/latex/tablenotes/mynotes.sty index d79cbbf4f59..a707421f9de 100644 --- a/Master/texmf-dist/tex/latex/tablenotes/mynotes.sty +++ b/Master/texmf-dist/tex/latex/tablenotes/mynotes.sty @@ -1,11 +1,10 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % **************************************** -% * myNOTES x1 +% * myNOTES % **************************************** % -% Date of this version: Sun Sep 6 00:25:59 2009 - +% Date of this version: 2011-5-1 % Matthias Borck-Elsner % %% Based on endnotes.sty Copyright 2002 John Lavagnino @@ -17,29 +16,29 @@ %% http://www.latex-project.org/lppl.txt %% and version 1.2 or later is part of all distributions of LaTeX %% version 1999/12/01 or later. -% -% Uses an extra external file, with .mnt extension, to hold the -% text of the mynotes. This may be deleted after the run; a new -% version is generated each time--it doesn't require information -% collected from the previous run. -% -% This code does not obey \nofiles. Perhaps it should. -% -% -% To turn all the footnotes in your documents into mynotes, say -% -% \let\footnote=\mynote -% -% in your preamble, and then add something like -% -% \newpage -% \begingroup -% \parindent 0pt -% \parskip 2ex -% \def\mntnotesize{\normalsize} -% \themynotes -% \endgroup -% +%% +%% Uses an extra external file, with .my extension, to hold the +%% text of the mynotes. This may be deleted after the run; a new +%% version is generated each time--it doesn't require information +%% collected from the previous run. +%% +%% This code does not obey \nofiles. Perhaps it should. +%% +%% +%% To turn all the footnotes in your documents into mynotes, say +%% +%% \let\footnote=\mynote +%% +%% in your preamble, and then add something like +%% +%% \newpage +%% \begingroup +%% \parindent 0pt +%% \parskip 2ex +%% \def\mynotesize{\normalsize} +%% \themynotes +%% \endgroup +%% % as the last thing in your document. (But \themynotes all % by itself will work.) % @@ -82,104 +81,26 @@ % mynotes use the following parameters, similar to those relating % to footnotes: % -% \mntnotesize : Size-changing command for mynotes. +% \mynotesize : Size-changing command for mynotes. % % \themynote : In usual LaTeX style, produces the mynote number. % -% \themntmark : Holds the current mynote's mark--e.g., \dag or '1' or 'a'. +% \themymark : Holds the current mynote's mark--e.g., \dag or '1' or 'a'. % (You don't want to set this yourself, as it comes % either from the autonumbering of notes or from % the optional argument to \mynote. But you'll need -% to use it if you define your own \makemntmark.) +% to use it if you define your own \makemymark.) % -% \makemntmark : A macro to generate the mynote marker from \themntmark -% The default definition is \hbox{$^\themntmark$}. +% \makemymark : A macro to generate the mynote marker from \themymark +% The default definition is \hbox{$^\themymark$}. % -% \@makemnttext{NOTE} : -% Must produce the actual mynote, using \themntmark as the mark +% \@makemytext{NOTE} : +% Must produce the actual mynote, using \themymark as the mark % of the mynote and NOTE as the text. It is called when effectively % inside a \parbox, with \hsize = \columnwidth. For example, it might % be as simple as -% $^{\themntmark}$ NOTE -% -% -% **************************************** -% * myNOTE PSEUDOCODE * -% **************************************** +% $^{\themymark}$ NOTE % -% \mynote{NOTE} == -% BEGIN -% \stepcounter{mynote} -% \@themntmark :=G eval (\themynote) -% \@mynotemark -% \@mynotetext{NOTE} -% END -% -% \mynote[NUM]{NOTE} == -% BEGIN -% begingroup -% counter mynote :=L NUM -% \@themntmark :=G eval (\themynote) -% endgroup -% \@mynotemark -% \@mynotetext{NOTE} -% END -% -% \@mynotetext{NOTE} == -% BEGIN -% write to \@mntnotes file: "\@doanmntnote{myNOTE MARK}" -% begingroup -% \next := NOTE -% set \newlinechar for \write to \space -% write to \@mntnotes file: \meaning\next -% (that is, "macro:->NOTE) -% endgroup -% END -% -% \addtomynotes{TEXT} == -% BEGIN -% open mynotes file if not already open -% begingroup -% let \protect to \string -% set \newlinechar for \write to \space -% write TEXT to \@mntnotes file -% endgroup -% END -% -% \mynotemark == -% BEGIN \stepcounter{mynote} -% \@themntmark :=G eval(\themynote) -% \@mynotemark -% END -% -% \mynotemark[NUM] == -% BEGIN -% begingroup -% mynote counter :=L NUM -% \@themntmark :=G eval(\themynote) -% endgroup -% \@mynotemark -% END -% -% \@mynotemark == -% BEGIN -% \leavevmode -% IF hmode THEN \@x@sf := \the\spacefactor FI -% \makemntmark % put number in main text -% IF hmode THEN \spacefactor := \@x@sf FI -% END -% -% \mynotetext == -% BEGIN \@themntmark :=G eval (\themynote) -% \@mynotetext -% END -% -% \mynotetext[NUM] == -% BEGIN begingroup counter mynote :=L NUM -% \@themntmark :=G eval (\themynote) -% endgroup -% \@mynotetext -% END % % **************************************** % * myNOTE MACROS * @@ -189,63 +110,63 @@ \@definecounter{mynote} \def\themynote{\@arabic\c@mynote} -\def\@makemntmark{\hbox{\@textsuperscript{\begin{tiny}\@themntmark\end{tiny}}}} -\def\makemntmark{\@makemntmark} +\def\@makemymark{\hbox{\@textsuperscript{\begin{tiny}\@themymark\end{tiny}}}} +\def\makemymark{\@makemymark} -\def\themntmark{\@themntmark} +\def\themymark{\@themymark} \newdimen\mynotesep \def\mynote{\@ifnextchar[\@xmynote{\stepcounter{mynote}% - \protected@xdef\@themntmark{\themynote}% + \protected@xdef\@themymark{\themynote}% \@mynotemark\@mynotetext}} \def\@xmynote[#1]{ \begingroup \c@mynote=#1\relax - \unrestored@protected@xdef\@themntmark{\themynote}% + \unrestored@protected@xdef\@themymark{\themynote}% \endgroup \@mynotemark\@mynotetext } % Here begins a section of mynote code that's really different from % the footnote code of LaTeX. -\let\@doanmntnote=0 -\let\@endanmntnote=0 +\let\@doanmynote=0 +\let\@endanmynote=0 -\newwrite\@mntnotes -\newif\if@mntnotesopen \global\@mntnotesopenfalse +\newwrite\@mynotes +\newif\if@mynotesopen \global\@mynotesopenfalse -\def\@openmntnotes{\immediate\openout\@mntnotes=\jobname.mnt\relax - \global\@mntnotesopentrue} +\def\@openmynotes{\immediate\openout\@mynotes=\jobname.my\relax + \global\@mynotesopentrue} % The stuff with \next and \meaning is a trick from the TeXbook, 382, % there intended for setting verbatim text, but here used to avoid % macro expansion when the footnote text is written. \next will have % the entire text of the footnote as one long line, which might well % overflow limits on output line length; the business with \newlinechar -% makes every space become a newline in the \@mntnotes file, so that all +% makes every space become a newline in the \@mynotes file, so that all % of the lines wind up being quite short. \long\def\@mynotetext#1{% - \if@mntnotesopen \else \@openmntnotes \fi - \immediate\write\@mntnotes{\@doanmntnote{\@themntmark}}% + \if@mynotesopen \else \@openmynotes \fi + \immediate\write\@mynotes{\@doanmynote{\@themymark}}% \begingroup \def\next{#1}% \newlinechar='40 - \immediate\write\@mntnotes{\meaning\next}% + \immediate\write\@mynotes{\meaning\next}% \endgroup - \immediate\write\@mntnotes{\@endanmntnote}} + \immediate\write\@mynotes{\@endanmynote}} % \addtomynotes works the way the other mynote macros probably should % have, requiring the use of \protect for fragile commands. \long\def\addtomynotes#1{% - \if@mntnotesopen \else \@openmntnotes \fi + \if@mynotesopen \else \@openmynotes \fi \begingroup \newlinechar='40 \let\protect\string - \immediate\write\@mntnotes{#1}% + \immediate\write\@mynotes{#1}% \endgroup} % End of unique mynote code @@ -253,35 +174,35 @@ \def\mynotemark{% \@ifnextchar[\@xmynotemark {\stepcounter{mynote}% - \protected@xdef\@themntmark{\themynote}% + \protected@xdef\@themymark{\themynote}% \@mynotemark}} \def\@xmynotemark[#1]{% \begingroup \c@mynote #1\relax - \unrestored@protected@xdef\@themntmark{\themynote}% + \unrestored@protected@xdef\@themymark{\themynote}% \endgroup \@mynotemark} \def\@mynotemark{% \leavevmode \ifhmode\edef\@x@sf{\the\spacefactor}\nobreak\fi - \makemntmark + \makemymark \ifhmode\spacefactor\@x@sf\fi \relax} \def\mynotetext{ \@ifnextchar [\@xmynotenext - {\protected@xdef\@themntmark{\themynote}% + {\protected@xdef\@themymark{\themynote}% \@mynotetext}} \def\@xmynotenext[#1]{\begingroup \c@mynote=#1\relax - \xdef\@themntmark{\themynote}\endgroup \@mynotetext} + \xdef\@themymark{\themynote}\endgroup \@mynotetext} \def\@xmynotenext[#1]{% \begingroup \c@mynote=#1\relax - \unrestored@protected@xdef\@themntmark{\themynote}% + \unrestored@protected@xdef\@themymark{\themynote}% \endgroup \@mynotetext} @@ -291,42 +212,38 @@ % The user may want separate mynotes for each chapter, or a big % block of them at the end of the whole document. As it stands, % either will work; you just say \themynotes wherever you want the -% mynotes so far to be inserted. However, you must add -% \setcounter{mynote}{0} after that if you want subsequent mynotes -% to start numbering at 1 again. - -% \mntnoteformat is provided so user can specify some special formatting +% mynotes so far to be inserted. The counter is always set to 0 +% \mynoteformat is provided so user can specify some special formatting % for the mynotes. It needs to set up the paragraph parameters, start -% the paragraph, and print the label. The \mbox stuff in \mntnoteheading +% the paragraph, and print the label. The \mbox stuff in \mynoteheading % is to make and undo a dummy paragraph, to get around the games \section* % plays with paragraph indenting and instead give us uniform % indenting for all notes. -\def\mntnotesname{ mynotes } -\def\mntnoteheading{ \subsubsection*{\mntnotesname - \@mkboth{\MakeUppercase{\mntnotesname}}{\MakeUppercase{\mntnotesname}}} +\def\mynotesname{mynotes} +\def\mynoteheading{\subsubsection*{\footnotesize{\mynotesname} \@mkboth{\MakeUppercase{\mynotesname}}{\MakeUppercase{\mynotesname}}} \mbox{ }\par\vskip-\baselineskip} -\def\mntnoteformat{\rightskip\z@ \leftskip\z@ \parindent=1.8em - \leavevmode\llap{\makemntmark}} +\def\mynoteformat{\rightskip\z@ \leftskip\z@ \parindent=1.8em + \leavevmode\llap{\makemymark}} -\def\mntnotesize{\footnotesize} +\def\mynotesize{\footnotesize} -\def\themynotes{\immediate\closeout\@mntnotes \global\@mntnotesopenfalse +\def\themynotes[#1]{\def\mynotesname{#1}\immediate\closeout\@mynotes \global\@mynotesopenfalse \begingroup \makeatletter % % The machinery with \@ResetGT and > here ensures that - % \@doanmntnote works properly even if > is an active character + % \@doanmynote works properly even if > is an active character % at the point where \themynotes is invoked. > needs to have - % catcode 12 when the arguments of \@doanmntnote are scanned, so + % catcode 12 when the arguments of \@doanmynote are scanned, so % that the > in the string "macro:->" is matched. The actual - % footnote text is not an argument to \@doanmntnote, but just - % follows it in the .mnt file; so \@ResetGT can reset the + % footnote text is not an argument to \@doanmynote, but just + % follows it in the .my file; so \@ResetGT can reset the % category code for > that should be used when processing % that text. That resetting takes place within a - % \begingroup-\endgroup block set up by \@doanmntnote and - % \@endanmntnote, so the catcode for > is back to 12 for the + % \begingroup-\endgroup block set up by \@doanmynote and + % \@endanmynote, so the catcode for > is back to 12 for the % next note. % \edef\@tempa{`\string >}% @@ -336,25 +253,24 @@ \edef\@ResetGT{\noexpand\catcode\@tempa=\the\catcode\@tempa}% \@makeother\>% \fi - \def\@doanmntnote##1##2>{\def\@themntmark{##1}\par\begingroup + \def\@doanmynote##1##2>{\def\@themymark{##1}\par\begingroup \@ResetGT - \edef\@currentlabel{\csname p@mynote\endcsname\@themntmark}% - \mntnoteformat} - \def\@endanmntnote{\par\endgroup}% - \mntnoteheading - \mntnotesize - \input{\jobname.mnt}% + \edef\@currentlabel{\csname p@mynote\endcsname\@themymark}% + \mynoteformat} + \def\@endanmynote{\par\endgroup}% + \mynoteheading + \mynotesize + \input{\jobname.my}% + \setcounter{mynote}{0} \vspace{1.8em} \endgroup} - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % **************************************** -% * noNOTES x2 +% * tabNOTES % **************************************** % -% Date of this version: 28 August 2009. +% Date of this version: 2011-5-1 % Matthias Borck-Elsner % %% Based on endnotes.sty Copyright 2002 John Lavagnino @@ -366,316 +282,500 @@ %% http://www.latex-project.org/lppl.txt %% and version 1.2 or later is part of all distributions of LaTeX %% version 1999/12/01 or later. +%% +%% Uses an extra external file, with .tab extension, to hold the +%% text of the tabnotes. This may be deleted after the run; a new +%% version is generated each time--it doesn't require information +%% collected from the previous run. +%% +%% This code does not obey \nofiles. Perhaps it should. +%% +%% +%% To turn all the footnotes in your documents into tabnotes, say +%% +%% \let\footnote=\tabnote +%% +%% in your preamble, and then add something like +%% +%% \newpage +%% \begingroup +%% \parindent 0pt +%% \parskip 2ex +%% \def\tabnotesize{\normalsize} +%% \thetabnotes +%% \endgroup +%% +% as the last thing in your document. (But \thetabnotes all +% by itself will work.) +% + +% +% +% **************************************** +% * tabNOTE COMMANDS * +% **************************************** +% +% +% \tabnote{NOTE} : User command to insert a tabnote. +% +% \tabnote[NUM]{NOTE} : User command to insert a tabnote numbered +% NUM, where NUM is a number -- 1, 2, +% etc. For example, if tabnotes are numbered +% *, **, etc. within pages, then \tabnote[2]{...} +% produces tabnote '**'. This command does not +% step the tabnote counter. +% +% \tabnotemark[NUM] : Command to produce just the tabnote mark in +% the text, but no tabnote. With no argument, +% it steps the tabnote counter before generating +% the mark. % -% Uses an extra external file, with .not extension, to hold the -% text of the nonotes. This may be deleted after the run; a new -% version is generated each time--it doesn't require information -% collected from the previous run. +% \tabnotetext[NUM]{TEXT} : Command to produce the tabnote but no +% mark. \tabnote is equivalent to +% \tabnotemark \tabnotetext . % -% This code does not obey \nofiles. Perhaps it should. +% \addtotabnotes{TEXT} : Command to add text or commands to current +% tabnotes file: for inserting headings, +% pagebreaks, and the like into tabnotes +% sections. TEXT a moving argument: +% \protect required for fragile commands. % +% **************************************** +% * tabNOTE USER COMMANDS * +% **************************************** % -% To turn all the footnotes in your documents into nonotes, say +% tabnotes use the following parameters, similar to those relating +% to footnotes: +% +% \tabnotesize : Size-changing command for tabnotes. +% +% \thetabnote : In usual LaTeX style, produces the tabnote number. % -% \let\footnote=\nonote +% \thetabmark : Holds the current tabnote's mark--e.g., \dag or '1' or 'a'. +% (You don't want to set this yourself, as it comes +% either from the autonumbering of notes or from +% the optional argument to \tabnote. But you'll need +% to use it if you define your own \maketabmark.) +% +% \maketabmark : A macro to generate the tabnote marker from \thetabmark +% The default definition is \hbox{$^\thetabmark$}. +% +% \@maketabtext{NOTE} : +% Must produce the actual tabnote, using \thetabmark as the mark +% of the tabnote and NOTE as the text. It is called when effectively +% inside a \parbox, with \hsize = \columnwidth. For example, it might +% be as simple as +% $^{\thetabmark}$ NOTE +% +% +% **************************************** +% * tabNOTE MACROS * +% **************************************** +% + +\@definecounter{tabnote} +\def\thetabnote{\@arabic\c@tabnote} + +\def\@maketabmark{\hbox{\@textsuperscript{\begin{tiny}\@thetabmark\end{tiny}}}} +\def\maketabmark{\@maketabmark} + +\def\thetabmark{\@thetabmark} + +\newdimen\tabnotesep + +\def\tabnote{\@ifnextchar[\@xtabnote{\stepcounter{tabnote}% + \protected@xdef\@thetabmark{\thetabnote}% + \@tabnotemark\@tabnotetext}} + +\def\@xtabnote[#1]{ + \begingroup + \c@tabnote=#1\relax + \unrestored@protected@xdef\@thetabmark{\thetabnote}% + \endgroup + \@tabnotemark\@tabnotetext } + +% Here begins a section of tabnote code that's really different from +% the footnote code of LaTeX. + +\let\@doantabnote=0 +\let\@endantabnote=0 + +\newwrite\@tabnotes +\newif\if@tabnotesopen \global\@tabnotesopenfalse + +\def\@opentabnotes{\immediate\openout\@tabnotes=\jobname.tab\relax + \global\@tabnotesopentrue} + +% The stuff with \next and \meaning is a trick from the TeXbook, 382, +% there intended for setting verbatim text, but here used to avoid +% macro expansion when the footnote text is written. \next will have +% the entire text of the footnote as one long line, which might well +% overflow limits on output line length; the business with \newlinechar +% makes every space become a newline in the \@tabnotes file, so that all +% of the lines wind up being quite short. + +\long\def\@tabnotetext#1{% + \if@tabnotesopen \else \@opentabnotes \fi + \immediate\write\@tabnotes{\@doantabnote{\@thetabmark}}% + \begingroup + \def\next{#1}% + \newlinechar='40 + \immediate\write\@tabnotes{\meaning\next}% + \endgroup + \immediate\write\@tabnotes{\@endantabnote}} + +% \addtotabnotes works the way the other tabnote macros probably should +% have, requiring the use of \protect for fragile commands. + +\long\def\addtotabnotes#1{% + \if@tabnotesopen \else \@opentabnotes \fi + \begingroup + \newlinechar='40 + \let\protect\string + \immediate\write\@tabnotes{#1}% + \endgroup} + +% End of unique tabnote code + +\def\tabnotemark{% + \@ifnextchar[\@xtabnotemark + {\stepcounter{tabnote}% + \protected@xdef\@thetabmark{\thetabnote}% + \@tabnotemark}} + +\def\@xtabnotemark[#1]{% + \begingroup + \c@tabnote #1\relax + \unrestored@protected@xdef\@thetabmark{\thetabnote}% + \endgroup + \@tabnotemark} + +\def\@tabnotemark{% + \leavevmode + \ifhmode\edef\@x@sf{\the\spacefactor}\nobreak\fi + \maketabmark + \ifhmode\spacefactor\@x@sf\fi + \relax} + +\def\tabnotetext{ + \@ifnextchar [\@xtabnotenext + {\protected@xdef\@thetabmark{\thetabnote}% + \@tabnotetext}} + +\def\@xtabnotenext[#1]{\begingroup \c@tabnote=#1\relax + \xdef\@thetabmark{\thetabnote}\endgroup \@tabnotetext} + +\def\@xtabnotenext[#1]{% + \begingroup + \c@tabnote=#1\relax + \unrestored@protected@xdef\@thetabmark{\thetabnote}% + \endgroup + \@tabnotetext} + + +% \thetabnotes actually prints out the tabnotes. + +% The user may want separate tabnotes for each chapter, or a big +% block of them at the end of the whole document. As it stands, +% either will work; you just say \thetabnotes wherever you want the +% tabnotes so far to be inserted. The counter is always set to 0 +% \tabnoteformat is provided so user can specify some special formatting +% for the tabnotes. It needs to set up the paragraph parameters, start +% the paragraph, and print the label. The \mbox stuff in \tabnoteheading +% is to make and undo a dummy paragraph, to get around the games \section* +% plays with paragraph indenting and instead give us uniform +% indenting for all notes. + +\def\tabnotesname{tabnotes} +\def\tabnoteheading{\subsubsection*{\footnotesize{\tabnotesname} \@mkboth{\MakeUppercase{\tabnotesname}}{\MakeUppercase{\tabnotesname}}} + \mbox{ }\par\vskip-\baselineskip} + +\def\tabnoteformat{\rightskip\z@ \leftskip\z@ \parindent=1.8em + \leavevmode\llap{\maketabmark}} + +\def\tabnotesize{\footnotesize} + +\def\thetabnotes[#1]{\def\tabnotesname{#1}\immediate\closeout\@tabnotes \global\@tabnotesopenfalse + \begingroup + \makeatletter + % + % The machinery with \@ResetGT and > here ensures that + % \@doantabnote works properly even if > is an active character + % at the point where \thetabnotes is invoked. > needs to have + % catcode 12 when the arguments of \@doantabnote are scanned, so + % that the > in the string "macro:->" is matched. The actual + % footnote text is not an argument to \@doantabnote, but just + % follows it in the .tab file; so \@ResetGT can reset the + % category code for > that should be used when processing + % that text. That resetting takes place within a + % \begingroup-\endgroup block set up by \@doantabnote and + % \@endantabnote, so the catcode for > is back to 12 for the + % next note. + % + \edef\@tempa{`\string >}% + \ifnum\catcode\@tempa=12% + \let\@ResetGT\relax + \else + \edef\@ResetGT{\noexpand\catcode\@tempa=\the\catcode\@tempa}% + \@makeother\>% + \fi + \def\@doantabnote##1##2>{\def\@thetabmark{##1}\par\begingroup + \@ResetGT + \edef\@currentlabel{\csname p@tabnote\endcsname\@thetabmark}% + \tabnoteformat} + \def\@endantabnote{\par\endgroup}% + \tabnoteheading + \tabnotesize + \input{\jobname.tab}% + \setcounter{tabnote}{0} \vspace{1.8em} + \endgroup} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% in your preamble, and then add something like +% **************************************** +% * imgNOTES +% **************************************** % -% \newpage -% \begingroup -% \parindent 0pt -% \parskip 2ex -% \def\notnotesize{\normalsize} -% \thenonotes -% \endgroup +% Date of this version: 2011-5-1 +% Matthias Borck-Elsner % -% as the last thing in your document. (But \thenonotes all +%% Based on endnotes.sty Copyright 2002 John Lavagnino +%% +%% This file may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.2 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.2 or later is part of all distributions of LaTeX +%% version 1999/12/01 or later. +%% +%% Uses an extra external file, with .img extension, to hold the +%% text of the imgnotes. This may be deleted after the run; a new +%% version is generated each time--it doesn't require information +%% collected from the previous run. +%% +%% This code does not obey \nofiles. Perhaps it should. +%% +%% +%% To turn all the footnotes in your documents into imgnotes, say +%% +%% \let\footnote=\imgnote +%% +%% in your preamble, and then add something like +%% +%% \newpage +%% \begingroup +%% \parindent 0pt +%% \parskip 2ex +%% \def\imgnotesize{\normalsize} +%% \theimgnotes +%% \endgroup +%% +% as the last thing in your document. (But \theimgnotes all % by itself will work.) % % % % **************************************** -% * noNOTE COMMANDS * +% * imgNOTE COMMANDS * % **************************************** % % -% \nonote{NOTE} : User command to insert a nonote. +% \imgnote{NOTE} : User command to insert a imgnote. % -% \nonote[NUM]{NOTE} : User command to insert a nonote numbered +% \imgnote[NUM]{NOTE} : User command to insert a imgnote numbered % NUM, where NUM is a number -- 1, 2, -% etc. For example, if nonotes are numbered -% *, **, etc. within pages, then \nonote[2]{...} -% produces nonote '**'. This command does not -% step the nonote counter. -% -% \nonotemark[NUM] : Command to produce just the nonote mark in -% the text, but no nonote. With no argument, -% it steps the nonote counter before generating +% etc. For example, if imgnotes are numbered +% *, **, etc. within pages, then \imgnote[2]{...} +% produces imgnote '**'. This command does not +% step the imgnote counter. +% +% \imgnotemark[NUM] : Command to produce just the imgnote mark in +% the text, but no imgnote. With no argument, +% it steps the imgnote counter before generating % the mark. % -% \nonotetext[NUM]{TEXT} : Command to produce the nonote but no -% mark. \nonote is equivalent to -% \nonotemark \nonotetext . +% \imgnotetext[NUM]{TEXT} : Command to produce the imgnote but no +% mark. \imgnote is equivalent to +% \imgnotemark \imgnotetext . % -% \addtononotes{TEXT} : Command to add text or commands to current -% nonotes file: for inserting headings, -% pagebreaks, and the like into nonotes +% \addtoimgnotes{TEXT} : Command to add text or commands to current +% imgnotes file: for inserting headings, +% pagebreaks, and the like into imgnotes % sections. TEXT a moving argument: % \protect required for fragile commands. % % **************************************** -% * noNOTE USER COMMANDS * +% * imgNOTE USER COMMANDS * % **************************************** % -% nonotes use the following parameters, similar to those relating +% imgnotes use the following parameters, similar to those relating % to footnotes: % -% \notnotesize : Size-changing command for nonotes. +% \imgnotesize : Size-changing command for imgnotes. % -% \thenonote : In usual LaTeX style, produces the nonote number. +% \theimgnote : In usual LaTeX style, produces the imgnote number. % -% \thenotmark : Holds the current nonote's mark--e.g., \dag or '1' or 'a'. +% \theimgmark : Holds the current imgnote's mark--e.g., \dag or '1' or 'a'. % (You don't want to set this yourself, as it comes % either from the autonumbering of notes or from -% the optional argument to \nonote. But you'll need -% to use it if you define your own \makenotmark.) +% the optional argument to \imgnote. But you'll need +% to use it if you define your own \makeimgmark.) % -% \makenotmark : A macro to generate the nonote marker from \thenotmark -% The default definition is \hbox{$^\thenotmark$}. +% \makeimgmark : A macro to generate the imgnote marker from \theimgmark +% The default definition is \hbox{$^\theimgmark$}. % -% \@makenottext{NOTE} : -% Must produce the actual nonote, using \thenotmark as the mark -% of the nonote and NOTE as the text. It is called when effectively +% \@makeimgtext{NOTE} : +% Must produce the actual imgnote, using \theimgmark as the mark +% of the imgnote and NOTE as the text. It is called when effectively % inside a \parbox, with \hsize = \columnwidth. For example, it might % be as simple as -% $^{\thenotmark}$ NOTE -% -% -% **************************************** -% * noNOTE PSEUDOCODE * -% **************************************** +% $^{\theimgmark}$ NOTE % -% \nonote{NOTE} == -% BEGIN -% \stepcounter{nonote} -% \@thenotmark :=G eval (\thenonote) -% \@nonotemark -% \@nonotetext{NOTE} -% END -% -% \nonote[NUM]{NOTE} == -% BEGIN -% begingroup -% counter nonote :=L NUM -% \@thenotmark :=G eval (\thenonote) -% endgroup -% \@nonotemark -% \@nonotetext{NOTE} -% END -% -% \@nonotetext{NOTE} == -% BEGIN -% write to \@notnotes file: "\@doannotnote{noNOTE MARK}" -% begingroup -% \next := NOTE -% set \newlinechar for \write to \space -% write to \@notnotes file: \meaning\next -% (that is, "macro:->NOTE) -% endgroup -% END -% -% \addtononotes{TEXT} == -% BEGIN -% open nonotes file if not already open -% begingroup -% let \protect to \string -% set \newlinechar for \write to \space -% write TEXT to \@notnotes file -% endgroup -% END -% -% \nonotemark == -% BEGIN \stepcounter{nonote} -% \@thenotmark :=G eval(\thenonote) -% \@nonotemark -% END -% -% \nonotemark[NUM] == -% BEGIN -% begingroup -% nonote counter :=L NUM -% \@thenotmark :=G eval(\thenonote) -% endgroup -% \@nonotemark -% END -% -% \@nonotemark == -% BEGIN -% \leavevmode -% IF hmode THEN \@x@sf := \the\spacefactor FI -% \makenotmark % put number in main text -% IF hmode THEN \spacefactor := \@x@sf FI -% END -% -% \nonotetext == -% BEGIN \@thenotmark :=G eval (\thenonote) -% \@nonotetext -% END -% -% \nonotetext[NUM] == -% BEGIN begingroup counter nonote :=L NUM -% \@thenotmark :=G eval (\thenonote) -% endgroup -% \@nonotetext -% END % % **************************************** -% * noNOTE MACROS * +% * imgNOTE MACROS * % **************************************** % -\@definecounter{nonote} -\def\thenonote{\@arabic\c@nonote} +\@definecounter{imgnote} +\def\theimgnote{\@arabic\c@imgnote} -\def\@makenotmark{\hbox{\@textsuperscript{\begin{tiny}\@thenotmark\end{tiny}}}} -\def\makenotmark{\@makenotmark} +\def\@makeimgmark{\hbox{\@textsuperscript{\begin{tiny}\@theimgmark\end{tiny}}}} +\def\makeimgmark{\@makeimgmark} -\def\thenotmark{\@thenotmark} +\def\theimgmark{\@theimgmark} -\newdimen\nonotesep +\newdimen\imgnotesep -\def\nonote{\@ifnextchar[\@xnonote{\stepcounter{nonote}% - \protected@xdef\@thenotmark{\thenonote}% - \@nonotemark\@nonotetext}} +\def\imgnote{\@ifnextchar[\@ximgnote{\stepcounter{imgnote}% + \protected@xdef\@theimgmark{\theimgnote}% + \@imgnotemark\@imgnotetext}} -\def\@xnonote[#1]{ +\def\@ximgnote[#1]{ \begingroup - \c@nonote=#1\relax - \unrestored@protected@xdef\@thenotmark{\thenonote}% + \c@imgnote=#1\relax + \unrestored@protected@xdef\@theimgmark{\theimgnote}% \endgroup - \@nonotemark\@nonotetext } + \@imgnotemark\@imgnotetext } -% Here begins a section of nonote code that's really different from +% Here begins a section of imgnote code that's really different from % the footnote code of LaTeX. -\let\@doannotnote=0 -\let\@endannotnote=0 +\let\@doanimgnote=0 +\let\@endanimgnote=0 -\newwrite\@notnotes -\newif\if@notnotesopen \global\@notnotesopenfalse +\newwrite\@imgnotes +\newif\if@imgnotesopen \global\@imgnotesopenfalse -\def\@opennotnotes{\immediate\openout\@notnotes=\jobname.not\relax - \global\@notnotesopentrue} +\def\@openimgnotes{\immediate\openout\@imgnotes=\jobname.img\relax + \global\@imgnotesopentrue} % The stuff with \next and \meaning is a trick from the TeXbook, 382, % there intended for setting verbatim text, but here used to avoid % macro expansion when the footnote text is written. \next will have % the entire text of the footnote as one long line, which might well % overflow limits on output line length; the business with \newlinechar -% makes every space become a newline in the \@notnotes file, so that all +% makes every space become a newline in the \@imgnotes file, so that all % of the lines wind up being quite short. -\long\def\@nonotetext#1{ - \if@notnotesopen \else \@opennotnotes \fi - \immediate\write\@notnotes{\@doannotnote{\@thenotmark}}% +\long\def\@imgnotetext#1{% + \if@imgnotesopen \else \@openimgnotes \fi + \immediate\write\@imgnotes{\@doanimgnote{\@theimgmark}}% \begingroup \def\next{#1}% \newlinechar='40 - \immediate\write\@notnotes{\meaning\next}% + \immediate\write\@imgnotes{\meaning\next}% \endgroup - \immediate\write\@notnotes{\@endannotnote}} + \immediate\write\@imgnotes{\@endanimgnote}} -% \addtononotes works the way the other nonote macros probably should +% \addtoimgnotes works the way the other imgnote macros probably should % have, requiring the use of \protect for fragile commands. -\long\def\addtononotes#1{% - \if@notnotesopen \else \@opennotnotes \fi +\long\def\addtoimgnotes#1{% + \if@imgnotesopen \else \@openimgnotes \fi \begingroup \newlinechar='40 \let\protect\string - \immediate\write\@notnotes{#1}% + \immediate\write\@imgnotes{#1}% \endgroup} -% End of unique nonote code +% End of unique imgnote code -\def\nonotemark{% - \@ifnextchar[\@xnonotemark - {\stepcounter{nonote}% - \protected@xdef\@thenotmark{\thenonote}% - \@nonotemark}} +\def\imgnotemark{% + \@ifnextchar[\@ximgnotemark + {\stepcounter{imgnote}% + \protected@xdef\@theimgmark{\theimgnote}% + \@imgnotemark}} -\def\@xnonotemark[#1]{% +\def\@ximgnotemark[#1]{% \begingroup - \c@nonote #1\relax - \unrestored@protected@xdef\@thenotmark{\thenonote}% + \c@imgnote #1\relax + \unrestored@protected@xdef\@theimgmark{\theimgnote}% \endgroup - \@nonotemark} + \@imgnotemark} -\def\@nonotemark{% +\def\@imgnotemark{% \leavevmode \ifhmode\edef\@x@sf{\the\spacefactor}\nobreak\fi - \makenotmark + \makeimgmark \ifhmode\spacefactor\@x@sf\fi \relax} -\def\nonotetext{% - \@ifnextchar [\@xnonotenext - {\protected@xdef\@thenotmark{\thenonote}% - \@nonotetext}} +\def\imgnotetext{ + \@ifnextchar [\@ximgnotenext + {\protected@xdef\@theimgmark{\theimgnote}% + \@imgnotetext}} -\def\@xnonotenext[#1]{\begingroup \c@nonote=#1\relax - \xdef\@thenotmark{\thenonote}\endgroup \@nonotetext} +\def\@ximgnotenext[#1]{\begingroup \c@imgnote=#1\relax + \xdef\@theimgmark{\theimgnote}\endgroup \@imgnotetext} -\def\@xnonotenext[#1]{% +\def\@ximgnotenext[#1]{% \begingroup - \c@nonote=#1\relax - \unrestored@protected@xdef\@thenotmark{\thenonote}% + \c@imgnote=#1\relax + \unrestored@protected@xdef\@theimgmark{\theimgnote}% \endgroup - \@nonotetext} + \@imgnotetext} -% \thenonotes actually prints out the nonotes. +% \theimgnotes actually prints out the imgnotes. -% The user may want separate nonotes for each chapter, or a big +% The user may want separate imgnotes for each chapter, or a big % block of them at the end of the whole document. As it stands, -% either will work; you just say \thenonotes wherever you want the -% nonotes so far to be inserted. However, you must add -% \setcounter{nonote}{0} after that if you want subsequent nonotes -% to start numbering at 1 again. - -% \notnoteformat is provided so user can specify some special formatting -% for the nonotes. It needs to set up the paragraph parameters, start -% the paragraph, and print the label. The \mbox stuff in \notnoteheading +% either will work; you just say \theimgnotes wherever you want the +% imgnotes so far to be inserted. The counter is always set to 0 +% \imgnoteformat is provided so user can specify some special formatting +% for the imgnotes. It needs to set up the paragraph parameters, start +% the paragraph, and print the label. The \mbox stuff in \imgnoteheading % is to make and undo a dummy paragraph, to get around the games \section* % plays with paragraph indenting and instead give us uniform % indenting for all notes. -\def\notnotesname{ nonotes } -\def\notnoteheading{\subsubsection*{\notnotesname - \@mkboth{\MakeUppercase{\notnotesname}}{\MakeUppercase{\notnotesname}}} - \mbox{}\par\vskip-\baselineskip} +\def\imgnotesname{imgnotes} +\def\imgnoteheading{\subsubsection*{\footnotesize{\imgnotesname} \@mkboth{\MakeUppercase{\imgnotesname}}{\MakeUppercase{\imgnotesname}}} + \mbox{ }\par\vskip-\baselineskip} -\def\notnoteformat{\rightskip\z@ \leftskip\z@ \parindent=1.8em - \leavevmode\llap{\makenotmark}} +\def\imgnoteformat{\rightskip\z@ \leftskip\z@ \parindent=1.8em + \leavevmode\llap{\makeimgmark}} -\def\notnotesize{\footnotesize} +\def\imgnotesize{\footnotesize} -\def\thenonotes{\immediate\closeout\@notnotes \global\@notnotesopenfalse +\def\theimgnotes[#1]{\def\imgnotesname{#1}\immediate\closeout\@imgnotes \global\@imgnotesopenfalse \begingroup \makeatletter % % The machinery with \@ResetGT and > here ensures that - % \@doannotnote works properly even if > is an active character - % at the point where \thenonotes is invoked. > needs to have - % catcode 12 when the arguments of \@doannotnote are scanned, so + % \@doanimgnote works properly even if > is an active character + % at the point where \theimgnotes is invoked. > needs to have + % catcode 12 when the arguments of \@doanimgnote are scanned, so % that the > in the string "macro:->" is matched. The actual - % footnote text is not an argument to \@doannotnote, but just - % follows it in the .not file; so \@ResetGT can reset the + % footnote text is not an argument to \@doanimgnote, but just + % follows it in the .img file; so \@ResetGT can reset the % category code for > that should be used when processing % that text. That resetting takes place within a - % \begingroup-\endgroup block set up by \@doannotnote and - % \@endannotnote, so the catcode for > is back to 12 for the + % \begingroup-\endgroup block set up by \@doanimgnote and + % \@endanimgnote, so the catcode for > is back to 12 for the % next note. % \edef\@tempa{`\string >}% @@ -685,15 +785,41 @@ \edef\@ResetGT{\noexpand\catcode\@tempa=\the\catcode\@tempa}% \@makeother\>% \fi - \def\@doannotnote##1##2>{\def\@thenotmark{##1}\par\begingroup + \def\@doanimgnote##1##2>{\def\@theimgmark{##1}\par\begingroup \@ResetGT - \edef\@currentlabel{\csname p@nonote\endcsname\@thenotmark}% - \notnoteformat} - \def\@endannotnote{\par\endgroup}% - \notnoteheading - \notnotesize - \input{\jobname.not} + \edef\@currentlabel{\csname p@imgnote\endcsname\@theimgmark}% + \imgnoteformat} + \def\@endanimgnote{\par\endgroup}% + \imgnoteheading + \imgnotesize + \input{\jobname.img}% + \setcounter{imgnote}{0} \vspace{1.8em} \endgroup} - +\newlength{\imgwidth} \newlength{\imgheight} +\def\ruler[#1]{\begin{picture}(0,0)\begin{tiny} +%horizontal +\put(0\imgwidth,0){\textcolor{#1}{\rotatebox{270}{ -0.00}}} +\put(-0.10\imgwidth,0){\textcolor{#1}{\rotatebox{270}{ -0.10}}} +\put(-0.20\imgwidth,0){\textcolor{#1}{\rotatebox{270}{ -0.20}}} +\put(-0.30\imgwidth,0){\textcolor{#1}{\rotatebox{270}{ -0.30}}} +\put(-0.40\imgwidth,0){\textcolor{#1}{\rotatebox{270}{ -0.40}}} +\put(-0.50\imgwidth,0){\textcolor{#1}{\rotatebox{270}{ -0.50}}} +\put(-0.60\imgwidth,0){\textcolor{#1}{\rotatebox{270}{ -0.60}}} +\put(-0.70\imgwidth,0){\textcolor{#1}{\rotatebox{270}{ -0.70}}} +\put(-0.80\imgwidth,0){\textcolor{#1}{\rotatebox{270}{ -0.80}}} +\put(-0.90\imgwidth,0){\textcolor{#1}{\rotatebox{270}{ -0.90}}} +\put(-1.00\imgwidth,0){\textcolor{#1}{\rotatebox{270}{ -1.00}}} +%vertical +\put(0,0\imgheight){\textcolor{#1}{\rotatebox{0}{+0.0}}} +\put(0,0.10\imgheight){\textcolor{#1}{\rotatebox{0}{+0.10}}} +\put(0,0.20\imgheight){\textcolor{#1}{\rotatebox{0}{+0.20}}} +\put(0,0.30\imgheight){\textcolor{#1}{\rotatebox{0}{+0.30}}} +\put(0,0.40\imgheight){\textcolor{#1}{\rotatebox{0}{+0.40}}} +\put(0,0.50\imgheight){\textcolor{#1}{\rotatebox{0}{+0.50}}} +\put(0,0.60\imgheight){\textcolor{#1}{\rotatebox{0}{+0.60}}} +\put(0,0.70\imgheight){\textcolor{#1}{\rotatebox{0}{+0.70}}} +\put(0,0.80\imgheight){\textcolor{#1}{\rotatebox{0}{+0.80}}} +\put(0,0.90\imgheight){\textcolor{#1}{\rotatebox{0}{+0.90}}} +\put(0,1.00\imgheight){\textcolor{#1}{\rotatebox{0}{+1.00}}} +\end{tiny} \end{picture}} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - |