4

In LyX, how can I set a float that contain figure so that the caption is under the figure? By default the caption is always on the left side of figure.

enter image description here

7
  • The default is for the caption to be either above or below the image/figure (depending on which comes first in the document), not beside it, so you're not using a 'standard' document layout I think. What are you using? Commented Jun 24, 2013 at 13:10
  • I thinks it's standard, I only change the document class from article to book since I started writing
    – Nur
    Commented Jun 24, 2013 at 13:13
  • Have you placed the image inside the caption box? It should be outside. Commented Jun 24, 2013 at 13:15
  • Now, I don't use LyX, but just intalled it. It seems you have inserted the gfx where the caption text should go. Instead you should first add a float container to hold the gfx and the caption. Then there is a nice separation of the two in the interface. Caption should not really be used on its own.
    – daleif
    Commented Jun 24, 2013 at 13:33
  • 1
    got it, i'll include a lyx minimal example on my future question
    – Nur
    Commented Jun 24, 2013 at 22:27

1 Answer 1

5

MWE

A figure float in LaTeX is just a figure environment (\begin{figure} ... \end{figure}) but when you make a figure float ("flotante" in the capture because the Spanish configuration) in LyX is also created a\caption{} command inside (the "Figure n: [text]" box) inside. Note that captions are optionals, so you can cut this box to have a figure without legend or even insert more that one caption in the same float.

The images, when translated to LaTeX language are \includegraphics{imagename} commands that allowed inside or outside a float. Inside the float, the image could be before or after the caption. Inside a caption, an image is not allowed in LaTeX by default. However, LyX can force this position including a \protect command.

Then you must care of the exact cursor position when inserting images. Insert the image inside the float but above or below the caption box. When the image was placed in the wrong position, just select only the image, cut it, move the cursor and paste in the right place.

Note that label (\label{} command in LaTeX) might also be inserted in any place in a float, but always place the labels inside or after the caption, never before, in order to avoid wrong cross-references.

With a mouse click then you can control the configuration of the image dimensions. Usually you may want the image centered making a selection with the cursor, and then with a right click selecting center justification. This put in the source code a center environment (\begin{center}... \end{center}) inside the float, but probably is better make an ERT box at the beginning of the float and write \centering (that can produce a different result in terms of vertical spacing).

You can check in the menu View that source LaTeX commands are in the correct order. A figure float with \centering in an ERT box and the image above the caption, correctly labelled, should have this order:

\begin{figure}
\centering
\includegraphics{figure}
\caption{\label{fig:The-caption}The caption}
\end{figure}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .