summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/marginnote
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-12-26 23:16:15 +0000
committerKarl Berry <karl@freefriends.org>2006-12-26 23:16:15 +0000
commit3cfdc74a6e64575df5c94eaa11bc7884a0cfc020 (patch)
treeca7aef2b6187918182b62a66ff8a31444e9ba612 /Master/texmf-dist/tex/latex/marginnote
parent2503beec69ff30090720f0148d220f7363a674ef (diff)
marginnote update
git-svn-id: svn://tug.org/texlive/trunk@2949 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/marginnote')
-rw-r--r--Master/texmf-dist/tex/latex/marginnote/marginnote.sty252
1 files changed, 194 insertions, 58 deletions
diff --git a/Master/texmf-dist/tex/latex/marginnote/marginnote.sty b/Master/texmf-dist/tex/latex/marginnote/marginnote.sty
index a3df8036f91..517a03985ba 100644
--- a/Master/texmf-dist/tex/latex/marginnote/marginnote.sty
+++ b/Master/texmf-dist/tex/latex/marginnote/marginnote.sty
@@ -31,11 +31,45 @@
%% and REAMDE.
%%
\ProvidesPackage{marginnote}[%
- 2006/02/06 v1.0a non floating margin notes for LaTeX]
+ 2006/10/26 v1.1 non floating margin notes for LaTeX]
+\newif\if@mn@verbose\@mn@verbosetrue
+\DeclareOption{verbose}{\@mn@verbosetrue}
+\DeclareOption{quiet}{\@mn@verbosefalse}
+\ExecuteOptions{verbose}
\ProcessOptions\relax
\newcommand*{\newmarginnote}{\@newl@bel{mn}}
+\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
+}
+\newcommand*{\marginnotetextwidth}{}
+\let\marginnotetextwidth\textwidth
+\AtBeginDocument{\if@mn@pdfmode\edef\marginnotetextwidth{\the\textwidth}\fi}
\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}}}
@@ -52,28 +86,56 @@
\fi
\fi
\xdef\@mn@thispage{\themn@abspage}%
- \protected@write\@auxout{\let\themn@abspage\relax}{%
- \string\newmarginnote{note.\@mn@thispage.\@mn@atthispage}{\themn@abspage}%
- }%
- \if@twoside
- \@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}%
+ \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
+ \expandafter\ifx\csname mn@note.\@mn@thispage.\@mn@atthispage\endcsname\relax
+ \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
}
\newcommand*{\marginnote}{%
@@ -103,53 +165,127 @@
}
\newcommand{\@mn@@@marginnote}{}
\def\@mn@@@marginnote[#1]#2[#3]{%
- \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{\kern\textwidth\kern\marginparsep\kern\marginnoterightadjust
- \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
- \kern-\baselineskip\kern-\parskip
- \marginfont\raggedleftmarginnote\hspace{\z@}\strut#1\endgraf
- \vss}%
- \vss}%
- \kern\marginparsep\kern\marginnoteleftadjust
- }%
- \fi
- }%
- }%
- \endgroup
+ \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{%
+ \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
+ \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\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
}
\newcommand*{\marginnoterightadjust}{}
\newcommand*{\marginnoteleftadjust}{}
\let\marginnoterightadjust\z@
\let\marginnoteleftadjust\z@
+\newcommand*{\marginnotevadjust}{}
+\let\marginnotevadjust\z@
\newcommand{\mn@vlap}[1]{%
\setbox\@tempboxa\vbox to \ht\strutbox{#1\vss}%
- \box\@tempboxa\vskip-\baselineskip\ifhmode\typeout{FALSCH!}\fi
+ \box\@tempboxa\vskip-\baselineskip
}
\providecommand*{\marginfont}{}
\newcommand*{\raggedleftmarginnote}{\raggedleft}