Jeannette Meyer wrote:
I am writing my diploma thesis with lyx and up to now things work great. However, there is one issue I could not solve so far: I have quite many subfigures in my figure floats, which I would like cross-reference in the text. I did not find any hint on this in the documentation, and the link on subfigures on Herbert's pages seems to be dead. I can circumvent this problem by just adding "a" or "b" after the reference on the figure, but I do not really like that solution.
Lyx's subfigure support is not very good. You have to use some LaTeX in this case. In the subfigure field of the graphics dialog, add \label{foo} after the subfigure title, in the document, you have to refer with ERT (Insert->TeX) to that label, e.g. \ref{foo} (which will give you 1(a) or whatever).
There is another way, that lets you use the normal "insert label" and "insert cross reference" mechanisms in lyx. You still have to use some tex, but only inside the figure floats. That means less latex if you have lots of references to the same subfigures.
It goes like this: Create a figure float. Insert all the graphichs (or whatever) in the float, but don't check the subfigure thing. Instead, insert a tex box before each graphic that says \subfigure[subfiguretitle]{ after the graphic, insert another texbox that says }
For each subfigure there are two tex boxes. (You can of coure merge adacent texboxes when there are several texboxes, i.e. }\subfigure[nextfiguretitle]{
Now for the labels. Simply Insert->label beside each graphic, that is between the "\subfigure[title]{" and the "}" tex boxes. This will work because latex knows what to do with a label inside a \subfigure, even if lyx don't.
Whenever you need a cross reference, simply insert->cross reference.
Another advantage of this approach is that it works with subfigures that aren't graphichs, such as subfigures made up of math symbols, plain text, a table, external inset or anything.
Helge Hafting