[Tex/LaTex] Put figure text under images

floatslyx

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

Best Answer

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}
Related Question