[dev-context] Enhancements to core-des for theorems

Aditya Mahajan adityam at umich.edu
Sun Jun 3 01:09:39 CEST 2007


On Sat, 2 Jun 2007, Aditya Mahajan wrote:

>> this is what wordright was made for; maybe it can be improved but thsi qed
>> stuff looks too complex to me (may also interfere with other things)
>
> I had a look at \wordright. The trouble is that \wordright makes no
> attempt to prevent a page break if it is on a line of its own. It it
> can be enhanced to take that into account, that is fine with me. The
> placed of endofproof symbol is complicated. amsthm, does something
> similar to qed.sty, while ntheorem goes into a two pass mechansim to
> get the placement right.

Actually, the only part of qed.sty that I use is this:

\def\parag at 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                % not needed since we now only use it in hmode
     \hbox at pushright             % this used to be incorporated
     #1%                         % the end-of-proof mark (or whatever)
     %
     %                     vertical
     \par}}%                     % build paragraph with the above 
parameters

\def\hbox at pushright{% horizontal
     \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 the following \hfill
     \hfill                      % push \square to right
}%


Compare with \wordright

\def\dowordright[#1]%
   {% don't change
    \groupedcommand
      {\removeunwantedspaces
       \hfill
       \allowbreak % changed back from \hskip\zeropoint
       \strut
       \hfill
       \quad % decent spacing
       \hbox}

{\doifelse{#1}\v!right{\kern-\rightskip}{\doifsomething{#1}{\kern-#1}}%
       \parfillskip\zeropoint
       \par}}


And there is also \signed from the texbook

\def\signed #1 (#2){{\unskip\nobreak\hfil\penalty50
          \hskip2em\hbox{}\nobreak\hfil\sl#1\/ \rm(#2)
          \parfillskip=0pt \finalhyphendemerits=0 \par}}


What was the motivation for \wordright? I thought it was same as 
\signed in the TeXbook (pg 106). But \signed uses \nobreak 
(\penality1000) and \penality50, \wordright uses 
allowbreak (\penality0). And then there is \finalhypendemerits=0 which 
is "missing".

And if you are relooking this macro, it will be nice to have the 
\hfill configurable (dotfill or something fancier)

Aditya


More information about the dev-context mailing list