[tex-eplain] Marginal Notes?

Karl Berry karl at freefriends.org
Tue Aug 2 20:04:32 CEST 2005


    Do you know of a good package or the proper commands to do this? 

I don't know of a package for plain TeX, but Knuth does discuss some
basic approaches in the TeXbook.  Check "marginal notes" in the index
(or search for it in texbook.tex if you don't have the printed copy).

The basic idea is to use \vadjust and \llap (or \rlap).

Here is a simplistic macro from texinfo.tex which maybe you can adapt,
if your needs aren't too complex ...


% @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
% paragraph.  For more general purposes, use the \margin insertion
% class.  WHICH is `l' or `r'.
%
\newskip\inmarginspacing \inmarginspacing=1cm
\def\strutdepth{\dp\strutbox}
%
\def\doinmargin#1#2{\strut\vadjust{%
  \nobreak
  \kern-\strutdepth
  \vtop to \strutdepth{%
    \baselineskip=\strutdepth
    \vss
    % if you have multiple lines of stuff to put here, you'll need to
    % make the vbox yourself of the appropriate size.
    \ifx#1l%
      \llap{\ignorespaces #2\hskip\inmarginspacing}%
    \else
      \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
    \fi
    \null
  }%
}}



More information about the tex-eplain mailing list