summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r--Master/texmf-dist/source/latex/marginnote/marginnote.dtx473
1 files changed, 212 insertions, 261 deletions
diff --git a/Master/texmf-dist/source/latex/marginnote/marginnote.dtx b/Master/texmf-dist/source/latex/marginnote/marginnote.dtx
index fd66d776e18..9fb12f5fc4c 100644
--- a/Master/texmf-dist/source/latex/marginnote/marginnote.dtx
+++ b/Master/texmf-dist/source/latex/marginnote/marginnote.dtx
@@ -1,8 +1,8 @@
-% \CheckSum{859}
+% \CheckSum{717}
% \iffalse meta-comment
% ======================================================================
% marginnote.dtx
-% Copyright (c) Markus Kohm, 2005-2017
+% Copyright (c) Markus Kohm, 2005-2018
%
% This file is part of the work marginnote.
%
@@ -21,21 +21,21 @@
% derived files README.txt and marginnote.sty.
% ======================================================================
%
-%<package>%%% From File: $Id: marginnote.dtx 13 2017-04-22 09:25:22Z mjk $
+%<package>%%% From File: $Id: marginnote.dtx 21 2018-04-20 06:19:32Z mjk $
%<*dtx>
\ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi
\begingroup
\def\filedate$#1: #2-#3-#4 #5${\gdef\filedate{#2/#3/#4}}
- \filedate$Date: 2017-04-22 11:25:22 +0200 (Sa, 22 Apr 2017) $
+ \filedate$Date: 2018-04-20 08:19:32 +0200 (Fr, 20 Apr 2018) $
\def\filerevision$#1: #2 ${\gdef\filerevision{#2}}
- \filerevision$Revision: 13 $
+ \filerevision$Revision: 21 $
\endgroup
\ProvidesFile{marginnote.dtx}[\filedate\space\filerevision\space
%</dtx>
%<package>\NeedsTeXFormat{LaTeX2e}[1995/12/01]
%<package>\ProvidesPackage{marginnote}[%
%<README>LaTeX package marginnote
-%<README>Copyright (c) Markus Kohm, 2005-2017
+%<README>Copyright (c) Markus Kohm, 2005-2018
%<README>-------------------------------------------------------------------
%<README>Version:
% \fi^^A meta-comment
@@ -43,7 +43,7 @@
% \iffalse meta-comment
%<*package|README>
% \fi^^A meta-comment
- 2017/04/22 v1.2b
+ 2018/04/13 v1.3
% \iffalse meta-comment
%</package|README>
% \fi^^A meta-comment
@@ -59,7 +59,7 @@
%<README>Abstract:
%<README> This package provides the command \marginnote that may be used
%<README> instead of \marginpar at almost every place, where \marginpar
-%<README> cannot be used, e.g. inside floats, footnotes, frames made with
+%<README> cannot be used, e.g., inside floats, footnotes, frames made with
%<README> framed package. See marginnote.pdf for more information.
%<README>-------------------------------------------------------------------
%<*dtx|package>
@@ -127,7 +127,7 @@
% In \LaTeX{} the command \cs{marginpar}\oarg{left}\marg{right} might be
% used to create a note in the margin. But there is a problem with this
% command: it creates a special kind of float. For this it cannot be used
-% e.g. at floats or footnotes. Package \textsl{marginnote} supports another
+% e.g., at floats or footnotes. Package \textsl{marginnote} supports another
% command \cs{marginnote} to create notes in the margin. This does not use a
% kind of float and for this does not have the disadvantage of
% \cs{marginpar}. But there might be other problems \dots
@@ -136,6 +136,7 @@
% \tableofcontents
%
% \changes{v1.0b}{2006/14/03}{spelling fixes}
+% \changes{v1.2b}{2017/10/14}{spelling fixes (by Thomas Reuben)}
%
% \section{How to Use \textsf{marginnote} Package}
%
@@ -172,37 +173,10 @@
% of the margin note. Use a negative dimension to move it up or a positive
% dimension to move it down.
%
-% \DescribeMacro{\marginnoteleftadjust}
-% \DescribeMacro{\marginnoterightadjust}
-% At some environments, e.g. \texttt{framed} from the \textsf{framed} package
-% the horizontal placement of the margin notes are not correct. In this case
-% you may redefine \cs{marginnoteleftadjust} and \cs{marginnoterightadjust} to
-% fix this. Note that these are macros not lengths! So you have to use
-% \cs{renewcommand}, \cs{def} or \cs{let} to change them. You may e.g. use
-% \begin{verbatim}
-% \begingroup
-% \makeatletter
-% \g@addto@macro\framed{%
-% \let\marginnoteleftadjust\FrameSep
-% \let\marginnoterightadjust\FrameSep
-% }
-% \endgroup
-% \end{verbatim}\vskip-\baselineskip
-% 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 position cannot be determined using
-% PDF\TeX{} features (\cs{pdfsavepos} and \cs{pdflastxpos}). So if you are
-% using PDF\LaTeX{} with PDF output or PDF\LaTeX{} with PDF\TeX-version since
-% 1.40 or \XeTeX{} you will not need to use the example code above, but you
-% will need at least two \LaTeX{} runs to get the correct horizontal positions
-% 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
+% find the right margin. While some environments (e.g., those of package
+% \textsl{framed}) change \cs{textwidth}, \textsl{marginnote} defines its own
% text width macro. If you change type area after \cs{begin\{document\}} you
% should add
% \begin{verbatim}
@@ -214,7 +188,7 @@
%
% \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
+% 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}.
@@ -226,7 +200,7 @@
% \item align margin notes at the left margin right to the margin,
% \item align margin notes at the right margin left to the margin.
% \end{itemize}
-% You may change this using \cs{renewcommand}, e.g. use^^A
+% You may change this using \cs{renewcommand}, e.g., use^^A
% \changes{v1.0a}{2006/02/06}{Example to macros \cs{raggedleftmarginnote} and
% \cs{raggedrightmarginnote} at documentation fixed [thanks to Susumu
% Tanimura].}
@@ -247,11 +221,19 @@
% e.g. package \textsf{color} to use \cs{color}.
%
%
-% \section{Known Problems Using \textsf{marginnote}}
+% \section{Known Issues Using \textsf{marginnote}}
+%
+% From version 1.3 \texttt{marginnote} does not longer support \TeX{} engines
+% without primitives \cs{pdfsavepos}/\cs{savepos} and
+% \cs{pdflastxpos}/\cs{lastxpos}. The former (manual adjustment) fallback has
+% been removed. You'll get an error message, if you try to use a \TeX{} engine
+% without these primitives. Also $\varepsilon$-\TeX{} primitves are
+% needed. However, with current free \TeX{} distributions like MiK\TeX{} or
+% \TeX Live this shouldn't be a problem.
%
% At double side layout (e.g. using class option \texttt{twoside})
% \cs{marginnote} needs to know the number of the current page to decide
-% wether the page is odd or even and so wether to use left or right
+% whether the page is odd or even and so whether to use left or right
% margin. \LaTeX{} uses an asynchronous output. Because of this counter
% \texttt{page} should not be used to get the number of the current page
% unless you are at page head or foot. To solve the problem
@@ -278,9 +260,9 @@
% paragraph. You may use \cs{leavevmode} or the third optional argument of
% \cs{marginnote} to place it different.
%
-% No page break may occure inside a margin note created with \cs{marginnote}.
+% No page break may occur inside a margin note created with \cs{marginnote}.
%
-% \cs{marginnote} somewhat different from \cs{marginpar} if used immediate
+% \cs{marginnote} is somewhat different from \cs{marginpar} if used immediate
% after \cs{item}. This is not a bug, it's a feature!
%
% With math \cs{marginnote} may work or may not depending on the math
@@ -298,6 +280,17 @@
%
% You should not use \cs{marginnote} at the optional argument of \cs{item}.
%
+% If \cs{if@twocolumn} is \cs{iftrue}, e.g., because you are using option
+% |twocolumn| or command |\twocolumn|, \cs{marginnote} does decide whether the
+% note should be placed left of the column or right of the columns simply by
+% comaring the current horizontal possition with |\columnwidth+\columnsep|. So
+% if the current horizontal possition is somewhere in the left columns, the
+% note is placed in the left margin. If the current horizontal possition is
+% somewhere right of the left column, the note is placed in the right
+% margin. However, support for twocolumn mode is as problematic as support for
+% reverse margin notes. I do not like it. Maybe it will be changed in
+% future. The current support for twocolumn mode has been implemented only
+% because of a feature request by Florent Chervet.
%
% \StopEventually{\PrintIndex\PrintChanges}
%
@@ -307,34 +300,76 @@
%<*package>
% \fi
%
-% First test $\varepsilon$-\TeX.
+% \changes{v1.3}{2018/04/13}{$\varepsilon$-\TeX{} removed}^^A
+%
+% \changes{v1.3}{2018/04/13}{early \cs{pdfsavepos}/\cs{savepos} test}^^A
+% \begin{macro}{\mn@savepos}
+% \changes{v1.3}{2018/04/13}{new internal command}
+% \begin{macro}{\mn@lastxpos}
+% \changes{v1.3}{2018/04/13}{new internal command}
+% Since version 1.3 \texttt{marginnote} does need either \cs{pdfsavepos} and
+% \cs{pdflastxpos} or \cs{savepos} and \cs{lastxpos} and does not longer
+% support engines without these primitives. All these engines also provide
+% $\varepsilon$-\TeX{} extensions. So we do not longer need an explicite
+% $\varepsilon$-\TeX{} test.
% \begin{macrocode}
\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
% \end{macrocode}
-%
+% \end{macro}
+% \end{macro}
+%
% Next declare and process the options.
%
% \begin{macro}{\if@mn@verbose}
@@ -352,7 +387,7 @@
% \begin{macro}{\mn@strut}
% \changes{v1.1e}{2009/06/06}{new (semi internal)}
% The package needs to adjust the margin note at the current line. Sometimes
-% this provocates extra vertical line spacing. To avoid this you may redefine
+% this causes extra vertical line spacing. To avoid this you may redefine
% \cs{mn@strut}. The default value is \cs{strut}.
% \begin{macrocode}
\newcommand*{\mn@strut}{}
@@ -434,113 +469,53 @@
% \end{macro}
%
% \begin{macro}{\if@mn@pdfmode}
-% \changes{v1.1}{2006/10/23}{new switch}^^A
-% \changes{v1.1a}{2008/11/10}{PDF\TeX\ since 1.40 allows \cs{pdfsavepos} in
-% DVI mode too}^^A
-% \changes{v1.1b}{2009/02/16}{if level fixed}^^A
-% \changes{v1.1c}{2009/02/26}{\protect\XeTeX has working \cs{pdflastxpos}^^A
-% but no \cs{pdftexversion}}^^A
-% \changes{v1.2}{2016/06/02}{addition for lua\TeX{} from 0.85}^^A
+% \changes{v1.1}{2006/10/23}{new switch}^^A
+% \changes{v1.1a}{2008/11/10}{PDF\TeX\ since 1.40 allows \cs{pdfsavepos} in
+% DVI mode too}^^A
+% \changes{v1.1b}{2009/02/16}{if level fixed}^^A
+% \changes{v1.1c}{2009/02/26}{\protect\XeTeX has working \cs{pdflastxpos}^^A
+% but no \cs{pdftexversion}}^^A
+% \changes{v1.2}{2016/06/02}{addition for lua\TeX{} from 0.85}^^A
+% \changes{v1.3}{2018/04/13}{removed}^^A
% \begin{macro}{\@mn@mode@prefix}
-% \changes{v1.2}{2016/06/02}{(new (internal)}^^A
-% We need to know, wether or not PDF\TeX{} and which version of PDF\TeX{} is
-% used. With PDF\TeX{} the horizontal output position 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
-\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
-}
-% \end{macrocode}
+% \changes{v1.2}{2016/06/02}{(new (internal)}^^A
+% \changes{v1.3}{2018/04/13}{removed}^^A
% \end{macro}
% \end{macro}
%
% \begin{macro}{\marginnotetextwidth}
-% \changes{v1.1}{2006/10/23}{new macro}
+% \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
+% macro. Sometimes it may be useful 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}
+\AtBeginDocument{\edef\marginnotetextwidth{\the\textwidth}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@mn@margintest}
-% \changes{v1.1}{2006/10/23}{new PDF mode feature}
+% \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)}
+% \changes{v1.1}{2006/10/23}{new (internal)}
% \begin{macro}{\@mn@currxpos}
-% \changes{v1.1}{2006/10/23}{new (internal)}
+% \changes{v1.1}{2006/10/23}{new (internal)}
% \begin{macro}{\mn@abspage}
-% 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
-% be a good try. \cs{@mn@thispage} saves the page number of the last usage
-% 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{@mn@currpage} is the page from the page label if
-% found. \cs{@mn@currxpos} is somehow special. Using PDF\TeX{} the real $x$
-% position 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!
+% 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 successful, but never the less it may
+% be a good try. \cs{@mn@thispage} saves the page number of the last usage
+% 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{@mn@currpage} is the page from the page label if
+% found. \cs{@mn@currxpos} is the real $x$ position may be written with the
+% page label and used to calculate the correct horizontal offset.
% \begin{macrocode}
\newcommand*{\@mn@thispage}{}
\newcommand*{\@mn@currpage}{}
@@ -550,7 +525,7 @@
\g@addto@macro\@outputpage{\stepcounter{mn@abspage}}}
\newcommand*{\@mn@margintest}{%
% \end{macrocode}
-% \changes{v1.2}{2016/06/02}{addition for lua\TeX{} from 0.85}^^A
+% \changes{v1.2}{2016/06/02}{addition for lua\TeX{} from 0.85}^^A
% Number of the next margin note at this page.
% \begin{macrocode}
\expandafter\ifx\csname @mn@thispage\endcsname\@empty
@@ -566,32 +541,28 @@
\fi
\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. At PDF mode
-% save the current $x$ position too.
+% 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. At PDF mode
+% save the current $x$ position too.
+% \changes{v1.3}{2018/04/13}{use new internals \cs{mn@savepos} and
+% \cs{mn@lastxpos}}^^A
+% \changes{v1.3}{2018/04/13}{non PDF mode removed}^^A
% \begin{macrocode}
\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}}%
+ }%
% \end{macrocode}
-% If the margin note label was not defined, it seems to be new. In this case
-% the absolut page number will be used for the test instead of the saved
-% real page number.
+% If the margin note label was not defined, it seems 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}
\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.
+% If we are not in two side mode, we are on a odd page.
% \begin{macrocode}
\if@twoside
\if@mn@verbose
@@ -643,19 +614,18 @@
\fi
% \end{macrocode}
% \changes{v1.2b}{2017/04/22}{\textsf{bidi} code added}^^A
+% \changes{v1.3}{2018/04/13}{\texttt{twocolumn} test added}^^A
% If you are using package \textsf{bidi} and RTL mode is active, the position
% is from right instead of left. So we have to substract \cs{@mn@currxpos}
% from \cs{pdfpagewidth} (or \cs{pagewidth} using Lua\TeX, but this cannot be,
% because \textsf{bidi} is not Lua\TeX-compatible).
% \begin{macrocode}
- \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
@@ -663,25 +633,42 @@
\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
- \fi
+ \if@twocolumn
+ \ifdim \@mn@currxpos
+ < \dimexpr\oddsidemargin+\columnwidth+\columnsep\relax
+ \@tempswafalse
+ \fi
+ \fi
+ \fi
\fi
}
% \end{macrocode}
% \begin{macro}{@mn@ifRTL}
-% \changes{1.2b}{2017/04/22}{new internal}
+% \changes{v1.2b}{2017/04/22}{new internal}
% Test, whether or not \cs{if@RTL} exists and is true or false.
% \begin{macrocode}
\newcommand*{\@mn@if@RTL}{%
@@ -761,9 +748,10 @@
\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.
+% Everything will be put upwards using a \cs{vbox} with zero height and depth
+% and \cs{vss}. At this box the margin test will be done. If
+% \cs{reversemarginpar} was used, the logic reverses. Then the note will be
+% places to the margin.
% \begin{macrocode}
\vbox to\z@{%
\vss
@@ -780,42 +768,26 @@
% current $x$ position of the last PDF\LaTeX{} run and may be used to
% calculate the real horizontal offset.
% \begin{macrocode}
- \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@{%
@@ -856,43 +828,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
@@ -907,17 +866,9 @@
% \end{macro}
%
% \begin{macro}{\marginnoterightadjust}
+% \changes{v1.3}{2018/04/13}{removed}^^A
% \begin{macro}{\marginnoteleftadjust}
-% These may be used to define an automatic horizontal adjust. The default is
-% zero. They will be used only if not PDF\TeX{} or PDF\TeX{} before version~1.40
-% in DVI mode is used, because in this case the save position features are not
-% available.
-% \begin{macrocode}
-\newcommand*{\marginnoterightadjust}{}
-\newcommand*{\marginnoteleftadjust}{}
-\let\marginnoterightadjust\z@
-\let\marginnoteleftadjust\z@
-% \end{macrocode}
+% \changes{v1.3}{2018/04/13}{removed}^^A
% \end{macro}
% \end{macro}
%