LATEX-L Archives

Mailing list for the LaTeX3 project


Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Frank Mittelbach <[log in to unmask]>
Reply To:
Mailing list for the LaTeX3 project <[log in to unmask]>
Sun, 8 Jan 2012 11:32:08 +0100
text/plain (70 lines)
I just had a look into the following question on

The issue here is the following code:

   \sbox\@tempboxa{#1: #2}%
   \ifdim \wd\@tempboxa >\hsize
     #1: #2\par
     \global \@minipagefalse

The problem is that this code trial typesets the caption as 
\sbox\@tempboxa{#1: #2} but then is not using it if the line is getting 
to long but instead uses  #1: #2\par. If however the line is short 
enough it reuses the box.

There are some reason for doing this (I mean not reusing the box in the 
multi-line version) as this has other deficiencies, but together with 
varioref this produces a problem. The problem being that varioref 
internally increments some counters to add label names and those are 
then never written to the aux file with bad results (basically a \vref 
may pick up the wrong information)

I wonder if this isn't a more general issue which needs addressing by 
providing some  "trial area" where you can go

    ... do the trial

where changes to counters dimensions etc are being stored away and 
returned back to their previous values afterwards.

what you would need then is a way to flag certain variables for this 
trial usage so that they can be properly saved and restored.

I think I remember that Michael Downes at one time wrote code for this 
for amsmath to manage labels and the like appearing in places like 
\mathchoice or in environments that do several trial typesettings to 
determine placement.

A brute force solution (but most certainly wrong with more complication 
structures in the caption) would be

   \sbox\@tempboxa{\globaldefs=-1\relax #1: #2}%
   \ifdim \wd\@tempboxa >\hsize
     #1: #2\par
     \global \@minipagefalse
     \hb@xt@\hsize{\hfil #1: #2\hfil}%

ie make all mods local in the trial and then retypeset the whole thing 
in both cases. But it is not difficult to see who this dies a different 
death depending on input.

Anybody some good ideas how to address topic this in a general fashion?