From 987c2bd7e8f378b80a05a14ec16edfc2c45ef428 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 14 Sep 2006 00:20:24 +0000 Subject: new latex package marginnote (7feb06) git-svn-id: svn://tug.org/texlive/trunk@2128 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/tex/latex/marginnote/marginnote.sty | 159 +++++++++++++++++++++ 1 file changed, 159 insertions(+) create mode 100644 Master/texmf-dist/tex/latex/marginnote/marginnote.sty (limited to 'Master/texmf-dist/tex') diff --git a/Master/texmf-dist/tex/latex/marginnote/marginnote.sty b/Master/texmf-dist/tex/latex/marginnote/marginnote.sty new file mode 100644 index 00000000000..a3df8036f91 --- /dev/null +++ b/Master/texmf-dist/tex/latex/marginnote/marginnote.sty @@ -0,0 +1,159 @@ +%% +%% This is file `marginnote.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% marginnote.dtx (with options: `package') +%% +%% IMPORTANT NOTE: +%% +%% This is a generated file and you are not allowed to distribute it +%% without the source ot the work. See below about more informations +%% about the files the work consists of. +%% +%% Copyright (c) Markus Kohm 2005-2006 +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% 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.3 or later is part of all distributions of LaTeX +%% version 2003/12/01 or later. +%% +%% This work has the LPPL maintenance status "maintained". +%% +%% The author of the initial version of these work was +%% Markus Kohm +%% +%% This work consists of the files marginnote.dtx, marginnote.ins, +%% and REAMDE. +%% +\ProvidesPackage{marginnote}[% + 2006/02/06 v1.0a non floating margin notes for LaTeX] +\ProcessOptions\relax +\newcommand*{\newmarginnote}{\@newl@bel{mn}} +\newcommand*{\@mn@thispage}{} +\let\@mn@thispage\@empty +\newcounter{mn@abspage} +\AtBeginDocument{\setcounter{mn@abspage}{1}% + \g@addto@macro\@outputpage{\stepcounter{mn@abspage}}} +\newcommand*{\@mn@margintest}{% + \expandafter\ifx\csname @mn@thispage\endcsname\@empty + \gdef\@mn@atthispage{1}% + \else\expandafter\ifnum \@mn@thispage=\value{mn@abspage}% + \begingroup + \@tempcnta\@mn@atthispage\advance\@tempcnta by \@ne + \xdef\@mn@atthispage{\the\@tempcnta}% + \endgroup + \else + \gdef\@mn@atthispage{1}% + \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}% + \ifodd\value{mn@abspage}\@tempswatrue\else\@tempswafalse\fi + }{% + \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} + \@tempswatrue + \else + \@tempswafalse + \fi + }% + \else + \PackageInfo{marginnote}{right page because not two side mode}% + \@tempswatrue + \fi +} +\newcommand*{\marginnote}{% + \@dblarg\@mn@marginnote +} +\newcommand{\@mn@marginnote}[2][]{% + \ifhmode + \@bsphack + \begingroup + \ifdim\@savsk>\z@\else + \def\:{\@xifnch}\expandafter\def\: { \futurelet\@let@token\@ifnch}% + \fi + \else + \begingroup + \fi + \@ifnextchar [{\@mn@@marginnote[{#1}]{#2}}{\@mn@@marginnote[{#1}]{#2}[\z@]}% +} +\newcommand{\@mn@@marginnote}{} +\def\@mn@@marginnote[#1]#2[#3]{% + \endgroup + \ifhmode + \@mn@@@marginnote[{#1}]{#2}[{#3}]% + \@esphack + \else + \@mn@@@marginnote[{#1}]{#2}[{#3}]% + \fi +} +\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 +} +\newcommand*{\marginnoterightadjust}{} +\newcommand*{\marginnoteleftadjust}{} +\let\marginnoterightadjust\z@ +\let\marginnoteleftadjust\z@ +\newcommand{\mn@vlap}[1]{% + \setbox\@tempboxa\vbox to \ht\strutbox{#1\vss}% + \box\@tempboxa\vskip-\baselineskip\ifhmode\typeout{FALSCH!}\fi +} +\providecommand*{\marginfont}{} +\newcommand*{\raggedleftmarginnote}{\raggedleft} +\newcommand*{\raggedrightmarginnote}{\raggedright} +\endinput +%% +%% End of file `marginnote.sty'. -- cgit v1.2.3