summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-04-30 17:06:06 +0000
committerKarl Berry <karl@freefriends.org>2018-04-30 17:06:06 +0000
commitb40c37a9e22b8235ff9c0bc256d00f7af94304c3 (patch)
tree780eb9f925894604cc014a1d68a448b2ca245241 /Master/texmf-dist/tex/latex
parent2595862e871c121eb470cdd8f5a7a73970e9c398 (diff)
marginnote (20apr18)
git-svn-id: svn://tug.org/texlive/trunk@47515 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r--Master/texmf-dist/tex/latex/marginnote/marginnote.sty278
1 files changed, 115 insertions, 163 deletions
diff --git a/Master/texmf-dist/tex/latex/marginnote/marginnote.sty b/Master/texmf-dist/tex/latex/marginnote/marginnote.sty
index e1cc622cdbc..ac2b5c3f1f5 100644
--- a/Master/texmf-dist/tex/latex/marginnote/marginnote.sty
+++ b/Master/texmf-dist/tex/latex/marginnote/marginnote.sty
@@ -20,35 +20,64 @@
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
-%%% From File: $Id: marginnote.dtx 13 2017-04-22 09:25:22Z mjk $
+%%% From File: $Id: marginnote.dtx 21 2018-04-20 06:19:32Z mjk $
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{marginnote}[%
- 2017/04/22 v1.2b
+ 2018/04/13 v1.3
non floating margin notes for LaTeX]
\begingroup
- \def\@tempb{}%
- \def\@tempa{%
- \PackageError{marginnote}{seems you are not running e-TeX\@tempb}{%
- Since 2004 the LaTeX team recommends to use e-TeX.\MessageBreak
- marginnote since version 1.1d uses e-TeX features.\MessageBreak
- At actual systems `latex' should already use e-TeX.\MessageBreak
- At deprecated systems it may be called `elatex'.\MessageBreak
- Use either unsupported marginnote up to version 1.1c or\MessageBreak
- ask you administrator for LaTeX using e-TeX\@tempb.\MessageBreak
- Not using e-TeX\@tempb\space is a fatal error!\MessageBreak
- Processing cannot be continued!}%
- \endgroup
- \batchmode \errmessage{}\csname @@end\endcsname\end\relax
- \csname endinput\endcsname
+ \@ifundefined{pdfsavepos}{%
+ \@ifundefined{savepos}{%
+ \PackageError{marginnote}{%
+ neither \string\pdfsavepos\space nor \string\savepos\space
+ available
+ }{%
+ Package `marginnote' depends on extended features of
+ PDFLaTeX,\MessageBreak
+ LuaLaTeX or XeLaTeX. It does not work without those
+ feature.\MessageBreak
+ If you'd continue the package will not provide any feature.
+ }%
+ \aftergroup\endinput
+ }{%
+ \@ifundefined{lastxpos}{%
+ \PackageError{marginnote}{%
+ \string\savepos\space but not \string\lastxpos\space
+ available
+ }{%
+ Package `marginnote' depends on extended features of
+ PDFLaTeX,\MessageBreak
+ LuaLaTeX or XeLaTeX. It does not work without those
+ feature.\MessageBreak
+ If you'd continue the package will not provide any feature.
+ }%
+ \aftergroup\endinput
+ }{%
+ \global\let\mn@savepos\savepos
+ \global\let\mn@lastxpos\lastxpos
+ \global\let\mn@pagewidth\pagewidth
+ }%
+ }%
+ }{%
+ \@ifundefined{pdflastxpos}{%
+ \PackageError{marginnote}{%
+ \string\pdfsavepos\space but not \string\pdflastxpos\space
+ available
+ }{%
+ Package `marginnote' depends on extended features of
+ PDFLaTeX,\MessageBreak
+ LuaLaTeX or XeLaTeX. It does not work without those
+ feature.\MessageBreak
+ If you'd continue the package will not provide any feature.
+ }%
+ \aftergroup\endinput
+ }{%
+ \global\let\mn@savepos\pdfsavepos
+ \global\let\mn@lastxpos\pdflastxpos
+ \global\let\mn@pagewidth\pdfpagewidth
+ }%
}%
- \expandafter\ifx\csname eTeXversion\endcsname\relax\else
- \ifnum\eTeXversion <2
- \def\@tempb{ V 2}%
- \else
- \let\@tempa\endgroup
- \fi
- \fi
-\@tempa
+\endgroup
\newif\if@mn@verbose\@mn@verbosetrue
\DeclareOption{verbose}{\@mn@verbosetrue}
\DeclareOption{quiet}{\@mn@verbosefalse}
@@ -105,61 +134,9 @@
\ExecuteOptions{verbose,fulladjust}
\ProcessOptions\relax
\newcommand*{\newmarginnote}{\@newl@bel{mn}}
-\newif\if@mn@pdfmode\@mn@pdfmodefalse
-\newcommand*{\@mn@mode@prefix}{pdf}
-\AtBeginDocument{%
- \begingroup\expandafter\expandafter\expandafter\endgroup
- \expandafter\ifx\csname pdflastxpos\endcsname\relax
- \begingroup\expandafter\expandafter\expandafter\endgroup
- \expandafter\ifx\csname lastxpos\endcsname\relax\else
- \@mn@pdfmodetrue
- \renewcommand*{\@mn@mode@prefix}{}%
- \fi
- \else % bg or 1
- \begingroup\expandafter\expandafter\expandafter\endgroup
- \expandafter\ifx\csname pdftexversion\endcsname\relax % bg 2
- \begingroup\expandafter\expandafter\expandafter\endgroup
- \expandafter\ifx\csname pdfoutput\endcsname\relax % bg 3
- \begingroup\expandafter\expandafter\expandafter\endgroup
- \expandafter\ifx\csname XeTeXrevision\endcsname\relax\else % bg 4
- \@mn@pdfmodetrue
- \fi % ed 4
- \else % or 3
- \ifcase\pdfoutput\else\@mn@pdfmodetrue\fi % bg ed 4
- \fi % ed 3
- \else % or 2
- \ifnum \pdftexversion<140 % bg 3
- \begingroup\expandafter\expandafter\expandafter\endgroup
- \expandafter\ifx\csname pdfoutput\endcsname\relax % bg 4
- \else % or 4
- \ifcase\pdfoutput\else\@mn@pdfmodetrue\fi % bg ed 5
- \fi % ed 4
- \else % or 3
- \@mn@pdfmodetrue
- \fi % ed 3
- \fi % ed 2
- \fi % ed 1
- \if@mn@verbose
- \if@mn@pdfmode
- \PackageInfo{marginnote}{%
- \string\pdfoutput\space not 0 or unimportant and\MessageBreak
- \string\pdflastxpos\space or \string\lastxpos\space
- available.\MessageBreak
- Extended position 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 position detection mode deactivated\@gobble
- }%
- \fi
- \fi
-}
\newcommand*{\marginnotetextwidth}{}
\let\marginnotetextwidth\textwidth
-\AtBeginDocument{\if@mn@pdfmode\edef\marginnotetextwidth{\the\textwidth}\fi}
+\AtBeginDocument{\edef\marginnotetextwidth{\the\textwidth}}
\newcommand*{\@mn@thispage}{}
\newcommand*{\@mn@currpage}{}
\newcommand*{\@mn@currxpos}{}
@@ -181,18 +158,11 @@
\xdef\@mn@thispage{\themn@abspage}%
\let\@mn@currpage\relax
\let\@mn@currxpos\relax
- \if@mn@pdfmode
- \@nameuse{\@mn@mode@prefix savepos}%
- \protected@write\@auxout{\let\themn@abspage\relax}{%
- \string\newmarginnote{note.\@mn@thispage.\@mn@atthispage}{%
- {\themn@abspage}{\noexpand\number\@nameuse{\@mn@mode@prefix lastxpos}sp}}%
- }%
- \else
- \protected@write\@auxout{\let\themn@abspage\relax}{%
- \string\newmarginnote{note.\@mn@thispage.\@mn@atthispage}{%
- {\themn@abspage}{}}%
- }%
- \fi
+ \mn@savepos
+ \protected@write\@auxout{\let\themn@abspage\relax}{%
+ \string\newmarginnote{note.\@mn@thispage.\@mn@atthispage}{%
+ {\themn@abspage}{\noexpand\number\mn@lastxpos sp}}%
+ }%
\expandafter\ifx\csname mn@note.\@mn@thispage.\@mn@atthispage\endcsname\relax
\if@twoside
\if@mn@verbose
@@ -232,14 +202,12 @@
\fi
\fi
\fi
- \begingroup\expandafter\expandafter\expandafter\endgroup
- \expandafter\ifx\csname \@mn@mode@prefix pagewidth\endcsname\relax\else
+ \ifdefined\mn@pagewidth
\@mn@if@RTL{%
\PackageInfo{marginnote}{Margin note
\@mn@thispage.\@mn@atthispage\space in RTL mode}%
\edef\@mn@currxpos{%
- \the\dimexpr\@nameuse{\@mn@mode@prefix pagewidth}
- -\@mn@currxpos\relax
+ \the\dimexpr\mn@pagewidth-\@mn@currxpos\relax
}%
}{}%
\fi
@@ -247,19 +215,36 @@
\edef\@mn@currpage{\expandafter\@firstoftwo\@mn@currpage}%
\if@mn@verbose
\PackageInfo{marginnote}{Margin note \@mn@thispage.\@mn@atthispage\space
- is on absolute page \@mn@currpage\MessageBreak}%
+ is on absolute page \@mn@currpage}%
\fi
\if@twoside
\ifodd\@mn@currpage\relax
\@tempswatrue
+ \if@twocolumn
+ \ifdim \@mn@currxpos
+ < \dimexpr\oddsidemargin+\columnwidth+\columnsep\relax
+ \@tempswafalse
+ \fi
+ \fi
\else
\@tempswafalse
+ \if@twocolumn
+ \ifdim\@mn@currxpos>\dimexpr\evensidemargin+\columnwidth\relax
+ \@tempswatrue
+ \fi
+ \fi
\fi
\else
\if@mn@verbose
\PackageInfo{marginnote}{right page because not two side mode}%
\fi
\@tempswatrue
+ \if@twocolumn
+ \ifdim \@mn@currxpos
+ < \dimexpr\oddsidemargin+\columnwidth+\columnsep\relax
+ \@tempswafalse
+ \fi
+ \fi
\fi
\fi
}
@@ -314,42 +299,26 @@
\fi\fi
\if@tempswa
\rlap{%
- \ifx\@mn@currxpos\relax
- \kern\marginnoterightadjust
- \if@mn@verbose
- \PackageInfo{marginnote}{%
- xpos not known,\MessageBreak
- using \string\marginnoterightadjust}%
+ \if@mn@verbose
+ \PackageInfo{marginnote}{xpos seems to be \@mn@currxpos}%
+ \fi
+ \begingroup
+ \ifx\@mn@currxpos\relax\else\ifx\@mn@currxpos\@empty\else
+ \kern-\dimexpr\@mn@currxpos\relax
+ \fi\fi
+ \ifx\@mn@currpage\relax
+ \let\@mn@currpage\@ne
\fi
- \else\ifx\@mn@currxpos\@empty
- \kern\marginnoterightadjust
- \if@mn@verbose
- \PackageInfo{marginnote}{%
- xpos not known,\MessageBreak
- using \string\marginnoterightadjust}%
+ \if@twoside\ifodd\@mn@currpage\relax
+ \kern\oddsidemargin
+ \else
+ \kern\evensidemargin
\fi
\else
- \if@mn@verbose
- \PackageInfo{marginnote}{%
- xpos seems 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
+ \kern\oddsidemargin
\fi
- \fi
+ \kern 1in
+ \endgroup
\kern\marginnotetextwidth\kern\marginparsep
\vbox to\z@{\kern\marginnotevadjust\kern #3
\vbox to\z@{%
@@ -370,43 +339,30 @@
\kern-\parskip
\marginfont\raggedleftmarginnote\strut\hspace{\z@}%
\ignorespaces#1\endgraf
- \vss}%
- \vss}%
- \ifx\@mn@currxpos\relax
- \kern\marginnoteleftadjust
- \if@mn@verbose
- \PackageInfo{marginnote}{%
- xpos not known,\MessageBreak
- using \string\marginnoteleftadjust}%
+ \vss
+ }%
+ \vss
+ }%
+ \if@mn@verbose
+ \PackageInfo{marginnote}{xpos seems to be \@mn@currxpos}%
+ \fi
+ \begingroup
+ \ifx\@mn@currxpos\relax\else\ifx\@mn@currpos\@empty\else
+ \kern\@mn@currxpos
+ \fi\fi
+ \ifx\@mn@currpage\relax
+ \let\@mn@currpage\@ne
\fi
- \else\ifx\@mn@currxpos\@empty
- \kern\marginnoteleftadjust
- \if@mn@verbose
- \PackageInfo{marginnote}{%
- xpos not known,\MessageBreak
- using \string\marginnoteleftadjust}%
+ \if@twoside\ifodd\@mn@currpage\relax
+ \kern-\oddsidemargin
+ \else
+ \kern-\evensidemargin
\fi
\else
- \if@mn@verbose
- \PackageInfo{marginnote}{%
- xpos seems 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
+ \kern-\oddsidemargin
\fi
- \fi
+ \kern-1in
+ \endgroup
\kern\marginparsep
}%
\fi
@@ -414,10 +370,6 @@
}%
\endgroup
}
-\newcommand*{\marginnoterightadjust}{}
-\newcommand*{\marginnoteleftadjust}{}
-\let\marginnoterightadjust\z@
-\let\marginnoteleftadjust\z@
\newcommand*{\marginnotevadjust}{}
\let\marginnotevadjust\z@
\newcommand{\mn@vlap}[1]{%