diff options
author | Karl Berry <karl@freefriends.org> | 2006-12-26 23:16:15 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-12-26 23:16:15 +0000 |
commit | 3cfdc74a6e64575df5c94eaa11bc7884a0cfc020 (patch) | |
tree | ca7aef2b6187918182b62a66ff8a31444e9ba612 /Master/texmf-dist/source | |
parent | 2503beec69ff30090720f0148d220f7363a674ef (diff) |
marginnote update
git-svn-id: svn://tug.org/texlive/trunk@2949 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/latex/marginnote/README | 18 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/marginnote/marginnote.dtx | 398 |
2 files changed, 324 insertions, 92 deletions
diff --git a/Master/texmf-dist/source/latex/marginnote/README b/Master/texmf-dist/source/latex/marginnote/README index 4908a5c2239..ec57f89502b 100644 --- a/Master/texmf-dist/source/latex/marginnote/README +++ b/Master/texmf-dist/source/latex/marginnote/README @@ -10,7 +10,6 @@ inside floats, footnotes, frames made with framed package ... If you have a distribution of marginnote with an archive containing the files - README doc/ doc/latex/ doc/latex/marginnote/ @@ -26,14 +25,19 @@ files tex/latex/marginnote/ tex/latex/marginnote/marginnote.sty -you may simply extract this archive at your local texmf tree (local TDS -tree) that may be e.g. C:\localtexmf or /usr/local/share/texmf or -/usr/TeX/texmf-local. You may not extract the low level README file or -remove it after extraction. After this update your FileName DataBase e.g. +you may simply extract this archive at your local texmf tree (local TDS tree) +that may be e.g. C:\localtexmf or /usr/local/share/texmf or +/usr/TeX/texmf-local. You may not extract the low level README file or should +remove it after extraction. After this update your File Name DataBase e.g. using the MiKTeX Options dialog or texhash. -If you instead of this have one the files marginnote.dtx, marginnote.ins +If the files are at a root directory marginnote the distributor has changed my +original distribution archive and you have to copy the files yourself into +the appropriate directories at one of your texmf trees and update your File +Name DataBase. + +If you instead of this have only the files marginnote.dtx, marginnote.ins marginnote.pdf (optional) and README, you have to call: - tex marginnote.ist + tex marginnote.ins and follow the instructions. ---------------------------------------------------------------------------- diff --git a/Master/texmf-dist/source/latex/marginnote/marginnote.dtx b/Master/texmf-dist/source/latex/marginnote/marginnote.dtx index 88816bf93fb..0e8a0813382 100644 --- a/Master/texmf-dist/source/latex/marginnote/marginnote.dtx +++ b/Master/texmf-dist/source/latex/marginnote/marginnote.dtx @@ -1,4 +1,4 @@ -% \CheckSum{260} +% \CheckSum{506} % \iffalse meta-comment % % marginnote.dtx @@ -27,7 +27,7 @@ %</driver> %<package>\ProvidesPackage{marginnote}[% %<*driver|package> - 2006/02/06 v1.0a non floating margin notes for LaTeX] + 2006/10/26 v1.1 non floating margin notes for LaTeX] %</driver|package> %<*driver> \documentclass{ltxdoc} @@ -57,6 +57,7 @@ % \cs{marginpar}. But there might be other problems \dots % \end{abstract} % +% \changes{v1.0b}{2006/14/03}{spelling fixes} % % \section{How to Use \textsf{marginnote} Package} % @@ -73,7 +74,7 @@ % kernel. Even \cs{reversemarginpar} will be considered. The note \meta{left} % or \meta{right} will be put at the current vertical position. Second % optional argument \meta{voffset} may be used to adjust the vertical position -% of the margin note. Use a negativ dimension to move it up or a positiv +% of the margin note. Use a negative dimension to move it up or a positive % dimension to move it down. % % \DescribeMacro{\marginnoteleftadjust} @@ -95,6 +96,33 @@ % at your preamble after loading package \textsf{framed} to fix the problem % using \texttt{framed} environment. % +% NOTE: \cs{marginnoteleftadjust} and \cs{marginnoterightadjust} will be used +% only, if the correct horizontal possition cannot determined using PDF\TeX{} +% features (\cs{pdfsavepos} and \cs{pdflastxpos}). So if you are using +% PDF\LaTeX{} with PDF output you will not need to use the example code above, +% but you will need at least two PDF\LaTeX{} runs to get the correct +% horizontal possitions of the margin notes. +% +% \DescribeMacro{\marginnotetextwidth} +% Package \textsl{marginnote} needs to know the real width of the type area to +% find the right margin. While some environments (e.g. thos of package +% \textsl{framed}) change \cs{textwidth}, \textsl{marginnote} defines it's own +% text width macro. If you change type area after \cs{begin\{document\}} you +% should add +% \begin{verbatim} +% \edef\marginnotetextwidth{\the\textwidth} +% \end{verbatim}\vskip-\baselineskip +% after changing the type area. Maybe you should do this globally using +% \verb|\xdef| instead of \verb|\edef|. Most users will never need to change +% \cs{marginnotetextwidth}. +% +% \DescribeMacro{\marginnotevadjust} +% At some environments the vertical adjustment of the margin note will be +% wrong, e.g. one base line to low. In this case you may use the additional +% optional argument of \cs{marginnote} at every usage of \cs{marginnote} or +% redefine \cs{marginnotevadjust} at the begin of the environment. The default +% definition is \texttt{0pt}. +% % \DescribeMacro{\raggedleftmarginnote} % \DescribeMacro{\raggedrightmarginnote} % These macros define how the margin note will be aligned. The defaults are: @@ -138,7 +166,7 @@ % % The command \cs{marginnote} uses \cs{strut} and \cs{vadjust} to put the % margin note at the correct position. But under some circumstances this may -% fail. You may adjust te vertical position of the margin note using the +% fail. You may adjust the vertical position of the margin note using the % second optional argument of \cs{marginnote}. Sometimes even the text outside % \cs{marginnote} will be moved because of using \cs{marginnote}. There's % currently no other solution for this problem then moving the \cs{marginnote} @@ -156,6 +184,15 @@ % With math \cs{marginnote} may work or may not depending on the math % environment. % +% If you are using PDF\LaTeX{} with PDF output and the horizontal possition of +% a margin note is wrong, do one more PDF\LaTeX{} run. +% +% Sometimes lines are stretched vertically using \cs{marginnote}, e.g.\ if +% you're using \cs{marginnote} at a list \emph{and} upper case umlauts like +% ``\"U''. In this case \verb|\lineskiplimit=-\maxdimen| should help. +% +% You should not use \cs{marginnote} at the optional argument of \cs{item}. +% % % \StopEventually{\PrintIndex\PrintChanges} % @@ -165,8 +202,20 @@ %<*package> % \fi % -% First process the options (no options are defined). +% First declare and process the options. +% +% \begin{macro}{\if@mn@verbose} +% Use verbose output mode by default. But you may change this using option +% \texttt{quiet}. % \begin{macrocode} +\newif\if@mn@verbose\@mn@verbosetrue +\DeclareOption{verbose}{\@mn@verbosetrue} +\DeclareOption{quiet}{\@mn@verbosefalse} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\ExecuteOptions{verbose} \ProcessOptions\relax % \end{macrocode} % @@ -181,11 +230,67 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\if@mn@pdfmode} +% \changes{v1.1}{2006/10/23}{new switch} +% We need to know, wether or not PDF\TeX{} is used. With PDF\TeX{} the +% horizontal output possition may be detected using \cs{pdfsavepos} and +% \cs{pdflastxpos}. So the relative position of the margin may be +% calculated. Without PDF\TeX{} only manual adjustment is available. While PDF +% mode or not may change before start of the document, setting up the switch +% is delayed. +% \begin{macrocode} +\newif\if@mn@pdfmode\@mn@pdfmodefalse +\AtBeginDocument{% + \begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname pdflastxpos\endcsname\relax\else + \begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname pdfoutput\endcsname\relax\else + \ifcase\pdfoutput\else\@mn@pdfmodetrue\fi + \fi + \fi + \if@mn@verbose + \if@mn@pdfmode + \PackageInfo{marginnote}{% + \string\pdfoutput\space not 0 and \string\pdflastxpos\space + available.\MessageBreak + Extended possition detection mode activated\@gobble + }% + \else + \PackageInfo{marginnote}{% + either \string\pdflastxpos\space or \string\pdfoutput\space not + available\MessageBreak + or \string\pdfoutput\space set to 0.\MessageBreak + Extended possition detection mode deactivated\@gobble + }% + \fi + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\marginnotetextwidth} +% \changes{v1.1}{2006/10/23}{new macro} +% Some environments change \cs{textwidth}. But at PDF mode we need to know the +% real text width to find the right margin. So we use our own text width +% macro. Sometimes it may be usefull if the user can set it up. Because of +% this it is a user command. +% \begin{macrocode} +\newcommand*{\marginnotetextwidth}{} +\let\marginnotetextwidth\textwidth +\AtBeginDocument{\if@mn@pdfmode\edef\marginnotetextwidth{\the\textwidth}\fi} +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\@mn@margintest} +% \changes{v1.1}{2006/10/23}{new PDF mode feature} % \begin{macro}{\@mn@thispage} % \begin{macro}{\@mn@atthispage} +% \begin{macro}{\@mn@currpage} +% \changes{v1.1}{2006/10/23}{new (internal)} +% \begin{macro}{\@mn@currxpos} +% \changes{v1.1}{2006/10/23}{new (internal)} % \begin{macro}{mn@abspage} -% Macro \cs{@margintest} does the complete test, which margin to use. The +% Macro \cs{@mn@margintest} does the complete test, which margin to use. The % result may be found at \cs{if@tempswa}. To avoid changes on the last page % if there is a new note on the first page, try to count the notes by % page. We know that this can not be successfull, but never the less it may @@ -193,10 +298,15 @@ % of \cs{@mn@margintest}. \cs{@mn@atthispage} saves the number of margin % note at this page. But we need to know the absolut page number to do % this. So we increase the absolut page number \texttt{mn@abspage} at every -% \cs{@outputpage}. +% \cs{@outputpage}. \cs{@mn@currpage} is the page from the page label if +% found. \cs{@mn@currxpos} is somehow special. Using PDF\TeX{} the real $x$ +% possition may be written with the page label and used to calculate the +% correct horizontal offset. In this case \cs{marginnoteleftadjust} and +% \cs{marginnoterightadjust} will not be used! % \begin{macrocode} \newcommand*{\@mn@thispage}{} -\let\@mn@thispage\@empty +\newcommand*{\@mn@currpage}{} +\newcommand*{\@mn@currxpos}{} \newcounter{mn@abspage} \AtBeginDocument{\setcounter{mn@abspage}{1}% \g@addto@macro\@outputpage{\stepcounter{mn@abspage}}} @@ -218,38 +328,67 @@ \xdef\@mn@thispage{\themn@abspage}% % \end{macrocode} % Use the number of the page and the number of the margin note at this page -% to save the real number of this page at the \texttt{aux} file. -% \begin{macrocode} - \protected@write\@auxout{\let\themn@abspage\relax}{% - \string\newmarginnote{note.\@mn@thispage.\@mn@atthispage}{\themn@abspage}% - }% -% \end{macrocode} -% If we are not in two side mode, we are on a odd page. +% to save the real number of this page at the \texttt{aux} file. At PDF mode +% save the current $x$ possition too. % \begin{macrocode} - \if@twoside + \let\@mn@currpage\relax + \let\@mn@currxpos\relax + \if@mn@pdfmode + \pdfsavepos + \protected@write\@auxout{\let\themn@abspage\relax}{% + \string\newmarginnote{note.\@mn@thispage.\@mn@atthispage}{% + {\themn@abspage}{\noexpand\number\pdflastxpos sp}}% + }% + \else + \protected@write\@auxout{\let\themn@abspage\relax}{% + \string\newmarginnote{note.\@mn@thispage.\@mn@atthispage}{% + {\themn@abspage}{}}% + }% + \fi % \end{macrocode} % If the margin note label was not defined, it seams to be new. In this case % the absolut page number will be used for the test instead of the saved % real page number. % \begin{macrocode} - \@ifundefined{mn@note.\@mn@thispage.\@mn@atthispage}{% - \PackageInfo{marginnote}{Suggest that margin - note \@mn@thispage.\@mn@atthispage\space will be on\MessageBreak - absolute page \themn@abspage.\MessageBreak - This may be wrong}% + \expandafter\ifx\csname mn@note.\@mn@thispage.\@mn@atthispage\endcsname\relax +% \end{macrocode} +% If we are not in two side mode, we are on a odd page. +% \begin{macrocode} + \if@twoside + \if@mn@verbose + \PackageInfo{marginnote}{Suggest that margin + note \@mn@thispage.\@mn@atthispage\space will be on\MessageBreak + absolute page \themn@abspage.\MessageBreak + This may be wrong}% + \fi \ifodd\value{mn@abspage}\@tempswatrue\else\@tempswafalse\fi - }{% + \else + \if@mn@verbose + \PackageInfo{marginnote}{right page because not two side mode}% + \fi + \@tempswatrue + \fi + \else + \edef\@mn@currpage{\csname + mn@note.\@mn@thispage.\@mn@atthispage\endcsname}% + \edef\@mn@currxpos{\expandafter\@secondoftwo\@mn@currpage}% + \edef\@mn@currpage{\expandafter\@firstoftwo\@mn@currpage}% + \if@mn@verbose \PackageInfo{marginnote}{Margin note \@mn@thispage.\@mn@atthispage\space - is on absolute page \@nameuse{mn@note.\@mn@thispage.\@mn@atthispage}}% - \ifodd\@nameuse{mn@note.\@mn@thispage.\@mn@atthispage} + is on absolute page \@mn@currpage\MessageBreak}% + \fi + \if@twoside + \ifodd\@mn@currpage\relax \@tempswatrue \else \@tempswafalse \fi - }% - \else - \PackageInfo{marginnote}{right page because not two side mode}% - \@tempswatrue + \else + \if@mn@verbose + \PackageInfo{marginnote}{right page because not two side mode}% + \fi + \@tempswatrue + \fi \fi } % \end{macrocode} @@ -257,13 +396,16 @@ % \end{macro} % \end{macro} % \end{macro} +% \end{macro} +% \end{macro} % % \begin{macro}{\marginnote} % \begin{macro}{\@mn@marginnote} % \begin{macro}{\@mn@@marginnote} % \begin{macro}{\@mn@@@marginnote} -% Command \cs{marginnote} is the main macro of the package. The others are -% helpers to manage the optional arguments. +% \changes{v1.1}{2006/10/23}{new PDF mode feature} +% Command \cs{marginnote} is the main macro of the package. The others are +% helpers to manage the optional arguments. % \begin{macrocode} \newcommand*{\marginnote}{% \@dblarg\@mn@marginnote @@ -284,8 +426,8 @@ \def\@mn@@marginnote[#1]#2[#3]{% \endgroup % \end{macrocode} -% In horizontal mode the space hack of the \LaTeX{} kernel will be used. In -% vertical mode this should not be used. +% In horizontal mode the space hack of the \LaTeX{} kernel will be used. In +% vertical mode this should not be used. % \begin{macrocode} \ifhmode \@mn@@@marginnote[{#1}]{#2}[{#3}]% @@ -297,65 +439,142 @@ \newcommand{\@mn@@@marginnote}{} \def\@mn@@@marginnote[#1]#2[#3]{% % \end{macrocode} -% All changes (but change of counters that are global because of using the -% \LaTeX{} commands to change them an \cs{gdef} and \cs{xdef}) should be -% local. In h-mode a \cs{strut} will be used to fix base line. The margin -% note will be put to vertical list using \cs{vadjust}. This also means that -% wie are one line to deep. This will be corrected later using negativ kern. -% In v-mode wie use a special kind of vbox to simply set everything. Math -% mode should behave like v-mode. And if we are just after an item we have -% to leave v-mode first. +% All changes (but change of counters that are global because of using the +% \LaTeX{} commands to change them an \cs{gdef} and \cs{xdef}) should be +% local. In h-mode a \cs{strut} will be used to fix base line. The margin +% note will be put to vertical list using \cs{vadjust}. This also means that +% wie are one line to deep. This will be corrected later using negative kern. +% In v-mode wie use a special kind of vbox to simply set everything. Math +% mode should behave like v-mode. And if we are just after an item we have +% to leave v-mode first. +% \begin{macrocode} + \begingroup + \ifmmode\strut\let\@tempa\vadjust\else + \if@inlabel\leavevmode\fi + \ifhmode\strut\let\@tempa\vadjust\else\let\@tempa\mn@vlap\fi + \fi + \@tempa{% +% \end{macrocode} +% Everything will be put upwards using a vbox with zero height and depth and +% \cs{vss}. At this box the margin test will be done. If cs{reversemargin} +% was used, the logic switchs. Then the note will be places to the margin. % \begin{macrocode} - \begingroup - \ifmmode\strut\let\@tempa\vadjust\else - \if@inlabel\leavevmode\fi - \ifhmode\strut\let\@tempa\vadjust\else\let\@tempa\mn@vlap\fi - \fi - \@tempa{% + \vbox to\z@{% + \vss + \@mn@margintest + \if@reversemargin\if@tempswa + \@tempswafalse + \else + \@tempswatrue + \fi\fi + \if@tempswa + \rlap{% % \end{macrocode} -% Everything will be put upwards using a vbox with zero height and depth and -% \cs{vss}. At this box the margin test will be done. If cs{reversemargin} -% was used, the logic switchs. Then the note will be places to the margin. +% If \cs{@mn@currpos} is neither \cs{relax} nor empty it is the real current +% $x$ possition of the last PDF\LaTeX{} run and may be used to calculate the +% real horizontal offset. % \begin{macrocode} - \vbox to\z@{% - \vss - \@mn@margintest - \if@reversemargin\if@tempswa - \@tempswafalse - \else - \@tempswatrue - \fi\fi - \if@tempswa - \rlap{\kern\textwidth\kern\marginparsep\kern\marginnoterightadjust - \vbox to\z@{\kern #3 - \vbox to\z@{% - \hsize\marginparwidth + \ifx\@mn@currxpos\relax + \kern\marginnoterightadjust + \if@mn@verbose + \PackageInfo{marginnote}{% + xpos not known,\MessageBreak + using \string\marginnoterightadjust}% + \fi + \else\ifx\@mn@currxpos\@empty + \kern\marginnoterightadjust + \if@mn@verbose + \PackageInfo{marginnote}{% + xpos not known,\MessageBreak + using \string\marginnoterightadjust}% + \fi + \else + \if@mn@verbose + \PackageInfo{marginnote}{% + xpos seams to be \@mn@currxpos,\MessageBreak + \string\marginnoterightadjust + \space ignored}% + \fi + \begingroup + \setlength{\@tempdima}{\@mn@currxpos}% + \kern-\@tempdima + \if@twoside\ifodd\@mn@currpage\relax + \kern\oddsidemargin + \else + \kern\evensidemargin + \fi + \else + \kern\oddsidemargin + \fi + \kern 1in + \endgroup + \fi + \fi + \kern\marginnotetextwidth\kern\marginparsep + \vbox to\z@{\kern\marginnotevadjust\kern #3 + \vbox to\z@{% + \hsize\marginparwidth % \end{macrocode} % Here's the correction of the vertical position. The rest is simple. % \begin{macrocode} - \kern-\baselineskip\kern-\parskip - \marginfont\raggedrightmarginnote\hspace{\z@}\strut#2\endgraf - \vss}% - \vss}% - }% - \else - \llap{% - \vbox to\z@{\kern #3 - \vbox to\z@{% - \hsize\marginparwidth + \kern-\baselineskip\kern-\parskip + \marginfont\raggedrightmarginnote\hspace{\z@}\strut#2\endgraf + \vss}% + \vss}% + }% + \else + \llap{% + \vbox to\z@{\kern #3 + \vbox to\z@{% + \hsize\marginparwidth % \end{macrocode} % Same like above for left margins. % \begin{macrocode} - \kern-\baselineskip\kern-\parskip - \marginfont\raggedleftmarginnote\hspace{\z@}\strut#1\endgraf - \vss}% - \vss}% - \kern\marginparsep\kern\marginnoteleftadjust - }% - \fi - }% - }% - \endgroup + \kern-\baselineskip\kern-\parskip + \marginfont\raggedleftmarginnote\hspace{\z@}\strut#1\endgraf + \vss}% + \vss}% + \ifx\@mn@currxpos\relax + \kern\marginnoteleftadjust + \if@mn@verbose + \PackageInfo{marginnote}{% + xpos not known,\MessageBreak + using \string\marginnoteleftadjust}% + \fi + \else\ifx\@mn@currxpos\@empty + \kern\marginnoteleftadjust + \if@mn@verbose + \PackageInfo{marginnote}{% + xpos not known,\MessageBreak + using \string\marginnoteleftadjust}% + \fi + \else + \if@mn@verbose + \PackageInfo{marginnote}{% + xpos seams to be \@mn@currxpos,\MessageBreak + \string\marginnoteleftadjust + \space ignored}% + \fi + \begingroup + \kern\@mn@currxpos + \if@twoside\ifodd\@mn@currpage\relax + \kern-\oddsidemargin + \else + \kern-\evensidemargin + \fi + \else + \kern-\oddsidemargin + \fi + \kern-1in + \endgroup + \fi + \fi + \kern\marginparsep + }% + \fi + }% + }% + \endgroup } % \end{macrocode} % \end{macro} @@ -366,7 +585,7 @@ % \begin{macro}{\marginnoterightadjust} % \begin{macro}{\marginnoteleftadjust} % These may be used to define an automatic horizontal adjust. The default is -% zero. +% zero. It will be used only if the PDF mode features are not available. % \begin{macrocode} \newcommand*{\marginnoterightadjust}{} \newcommand*{\marginnoteleftadjust}{} @@ -376,12 +595,22 @@ % \end{macro} % \end{macro} % +% \begin{macro}{\marginnotevadjust} +% This may be used to define an automatic vertical adjust. The defaul tis +% zero. Values greater than zero will move the margin note down, values less +% than zero will move the margin note up. +% \begin{macrocode} +\newcommand*{\marginnotevadjust}{} +\let\marginnotevadjust\z@ +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\mn@vlap} % This macro is used to set a vertical box without size at vertical mode. % \begin{macrocode} \newcommand{\mn@vlap}[1]{% \setbox\@tempboxa\vbox to \ht\strutbox{#1\vss}% - \box\@tempboxa\vskip-\baselineskip\ifhmode\typeout{FALSCH!}\fi + \box\@tempboxa\vskip-\baselineskip } % \end{macrocode} % \end{macro} @@ -411,7 +640,6 @@ % \iffalse %%% Local Variables: %%% mode: doc-tex -%%% mode: font-lock %%% Text-master: t %%% End: % \fi
\ No newline at end of file |