[texhax] Forcing text to the right margin
Aditya Mahajan
adityam at umich.edu
Mon Dec 31 17:19:18 CET 2007
On Mon, 31 Dec 2007, Michael Barr wrote:
> 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.
For some details see: http://www.monad.me.uk/proofs/QEDdoc.html
<quote>
With the help of Chris Thompson of the Cambridge University Computing
Service, I implemented the following solution for my Ph.D. thesis in 1986.
As well as keeping the square on the right (though possibly on the next
line), it also stops it from being left over (as a "widow") on the next
page.
</quote>
Aditya
More information about the texhax
mailing list