[texhax] Forcing text to the right margin

Michael Barr barr at math.mcgill.ca
Mon Dec 31 15:48:57 CET 2007


Someone put this into our journal style.  It looks cumbersome, but it 
works.  It is apparently derived from something that appears in Paul 
Taylor's diagram macros:

% added 98-11-8 - based on P. Taylor macro
\def\pushright#1{{%        set up
    \parfillskip=0pt            % so \par doesnt push \square to left
    \widowpenalty=10000         % so we dont break the page before \square
    \displaywidowpenalty=10000  % ditto
    \finalhyphendemerits=0      % TeXbook exercise 14.32
   %
   %                 horizontal
    \leavevmode                 % \nobreak means lines not pages
    \unskip                     % remove previous space or glue
    \nobreak                    % don't break lines
    \hfil                       % ragged right if we spill over
    \penalty50                  % discouragement to do so
    \hskip.2em                  % ensure some space
    \null                       % anchor following \hfill
    \hfill                      % push \square to right
    {#1}                        % the end-of-proof mark (or whatever)
   %
   %                   vertical
    \par}}                      % build paragraph


\newbox\@endproofbox
\setbox\@endproofbox\hbox{\vrule width5pt height 5pt depth 0pt}
\def\endproofbox{\copy\@endproofbox}
\def\endproof{\pushright{\endproofbox}%
\penalty-700 \par\addvspace{\medskipamount}}

I have added the example of how it is used.  I don't actually know who did 
this macro.

Michael Barr


More information about the texhax mailing list