[tex-eplain] Res: Marginal notes

Flavio Costa flaviocosta at yahoo.com.br
Tue Jun 17 04:56:07 CEST 2008


Hi, just out of curiosity, could \unskip prevent this eventual page break problem?

Thanks,

Flavio

----- Mensagem original ----
De: Oleg Katsitadze <olegkat at gmail.com>
Para: tex-eplain at tug.org
Enviadas: Segunda-feira, 16 de Junho de 2008 10:31:25
Assunto: Re: [tex-eplain] Marginal notes

On Mon, Jun 16, 2008 at 06:28:31AM +0000, Adam Fenn wrote:
> I want the usage of \marginalia to be like \sidx -

For that just add \ignorespaces to the end of \marginalia.  But beware
that putting a space before \marginalia can cause the marginal note to
be broken off to the next page from the preceeding word, if the
preceeding word happens to fall at the very end of a page.

Best,
Oleg



\input eplain
\enablehyperlinks%[idxexact]
\hsize = 10cm

% \marginalia macro
\def\raggedleft{\spaceskip=.3333em \xspaceskip=.5em
     \parfillskip=0pt \leftskip=0pt plus\hsize}    

\def\lmarginaliabox#1{%
    \vtop to 0pt{%
      \raggedright
      \hsize=.9in
      \parindent=0pt
      #1
      \vss
      }}

\def\rmarginaliabox#1{%
    \vtop to 0pt{%
      \raggedleft
      \hsize=.9in
      \parindent=0pt
      #1
      \vss
     }}

\newskip\inmarginspacing \inmarginspacing=1em
\def\strutdepth{\dp\strutbox}

\newcount\marginalno
\marginalno0

\def\marginalpage#1#2{%
    \expandafter\gdef\csname marginalpage#1\endcsname{#2}}

\let\protect\relax
%\newread\auxin
%\newwrite\auxout
%\openin\auxin\jobname.aux
%\ifeof\auxin
%  \let\noaux=1
%  \immediate\openout\auxout\jobname.aux
%  \immediate\closeout\auxout
%\else
%  \let\noaux=0
%  \closein\auxin
%\fi
%\input \jobname.aux
\readauxfile

\outer\def\bye{%
  \par\vfill\supereject
%  \ifx\noaux1
%    \newlinechar=`\^^J
%    \message{^^J(Run TeX a second time to resolve marginal note placing)}%
%  \fi
  \end
}

%\immediate\openout\auxout \jobname.aux
\def\protect{\noexpand\protect\noexpand}

\def\marginalia#1{%
\strut\vadjust{%
  \nobreak
  \kern-\strutdepth
  \vtop to \strutdepth{%
    \vss
  \global\advance\marginalno1
%  \edef\writeit{\write\auxout{%
  \edef\writeit{\write\auxfile{%
          
   {\number\marginalno}%
                    {\noexpand\number\count0}}}%
  \writeit
  \expandafter\ifodd0\csname marginalpage\number\marginalno\endcsname
% odd page stuff here
\rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces
\lmarginaliabox{{\it #1}}}%
\else
% even page stuff here
\llap{\ignorespaces \rmarginaliabox{{\it #1}}\hskip\inmarginspacing}%
\fi
\baselineskip=\strutdepth
\null
}}%
\ignorespaces}


This is a test\marginalia{a note in the margin} to see what happens.

\vfill\eject
\idx{Test}
\vfill\eject
\readindexfile{i}
\bye



      Abra sua conta no Yahoo! Mail, o único sem limite de espaço para armazenamento!
http://br.mail.yahoo.com/


More information about the tex-eplain mailing list