On Wed, Dec 28, 2005 at 01:05:18AM +0100, Marc Vinyals wrote:
> Hi again.
> 
> I've solved most of my problem by playing a bit more with LyX. I tried 
> putting the subfigures in separate floats and with no caption, just as I 
> had done to prepare for inserting \ContinuedFloat commands but removing 
> the ERT boxes. When I previewed the results, subcaptions were OK (this 
> is (a) foo; (b) fooo; (c) ... instead of (a) foo; (a) fooo; (a) ...). 
> I'm not sure about what would happen if I put text between two floats or 
> how to make references correctly, but I suppose the last will be documented.
> 
> I hope this will help anyone with the same problems, since I've not been 
> able to find related documentation.

There are two ways of crossreferencing in lyx.

The easy way is, of course, to use insert->label and insert->reference
whenever necessary.  But it may be tricky referencing subfigures this way.

The other way is to use latex commands.  Basically, if you insert a label
using latex commands in ERT, then every reference to that label will have to
be done using ERT and a latex command as well.  (To find these commands,
just export a lyx document with references to latex and see.)

The disadvantage of the latter method is obvious if you have lots
of references to some subfigure.  I have been able to work around
this, so I could use the lyx label/reference inserts even for
referencing subfigures made by lots of ERT and little else.

The trick is that you can terminate ERT anywhere - even in the
middle of some complicated latex construct.  Then, insert a lyx label
after the abruptly terminated ERT.  After that, a new ERT inset that continues
your latex command.  This way, you can use insert->reference to refer
to your subfigures.

I used a float containing stuff like this:
ERT inset containing \subfigure[]{
(Note how the latex command isn't terminated, so anything after this ERT
will be inside the subfigure)
After that, I had a xfig figure and a noraml lyx label for referencing.
The fact that the lyx label is emitted inside the \subfigure means
that any reference to it gets the correct "Figure 1.1(b)" format,
even though lyx itself doesn't support such references to subfigures.
(Well, at least lyx 1.3 didn't at the time I wrote that book)
Latex supports references to subfigures, and that is what counts.

Later, I had a ERT containing just the terminating } that ends the subfigure.

This sequence then repeats a few times, for every subfigure in the float.

I did not have your problem of needing page breaks, as my floats were small.
But this way, I got subfigures with referencable captions.

Helge Hafting


 

Reply via email to