1

I am using lyx and want to put two figures side by side. I could do it by inserting two minipages separated by a \hfill inside a float but it only allows me to use separate captions rather than subcaptions (I want it to be labeled as fig 1a, fig 1b). Also by inserting float inside a float, the 2nd figure appeared below the first one rather than in side. Any tips would be really helpful.

2

For anyone having the same problem, I found a solution which apparently worked for me in lyx:

  1. Insert> Float > Figure
  2. Insert > Box > Frameless.
  3. Right click on minipage and go to settings. Set width to 45 column width%
  4. Click right next to the minipage (not inside). Go to Insert> Formatting> Horizontal space and select horizontal fill in spacing.
  5. Repeat step2 and add graphics in both minipages.
  6. Go to Document> Settings > LaTex Preamble and add \usepackage{subcaption}
  7. Inside each minipage, Insert tex code \subcaption{Your subcaption here}
| improve this answer | |
0

The better approach I found, was to use subfigures (especially when you want to refer to subfigures as 1a or 1b. From the LaTeX FAQ:

  • Insert→Float→Figure
  • Again, Insert→Float→Figure (this inserts a "subfigure float" into the float)
  • Put the cursor right next to the subfloat
  • Insert→Formatting→Horizontal Space→Horizontal Fill or Ctrl- -> right-click on space -> select "Horizontal Fill" (to insert a stretchable horizontal space)
  • Insert→Float→Figure (this inserts another "subfigure float")
  • In each subfloat:add the graphics and edit the caption
  • To insert a vertical space, Insert→Formatting→Vertical Space→DefSkip.

Or if you could just use this code (this is LyX syntax; not LaTeX) from what I created (you may have to right click on the images and adjust the width % of the images):

\begin_layout Standard
\begin_inset Float figure
wide false
sideways false
status open

\begin_layout Plain Layout
\begin_inset Float figure
wide false
sideways false
status open

\begin_layout Plain Layout
\begin_inset Graphics
    filename images/Fig2_1.png
    scale 30

\end_inset


\end_layout

\begin_layout Plain Layout
\begin_inset Caption Standard

\begin_layout Plain Layout
Name1
\begin_inset CommandInset label
LatexCommand label
name "fig:label1"

\end_inset


\end_layout

\end_inset


\end_layout

\end_inset


\begin_inset space \hfill{}
\end_inset


\begin_inset Float figure
wide false
sideways false
status open

\begin_layout Plain Layout
\begin_inset Graphics
    filename images/Fig2_2.png
    scale 30

\end_inset


\end_layout

\begin_layout Plain Layout
\begin_inset Caption Standard

\begin_layout Plain Layout
Name2
\begin_inset CommandInset label
LatexCommand label
name "fig:Name2"

\end_inset


\end_layout

\end_inset


\end_layout

\end_inset


\begin_inset VSpace defskip
\end_inset


\end_layout

\begin_layout Plain Layout
\begin_inset Float figure
wide false
sideways false
status open

\begin_layout Plain Layout
\begin_inset Graphics
    filename images/Fig2_3.png
    scale 30

\end_inset


\end_layout

\begin_layout Plain Layout
\begin_inset Caption Standard

\begin_layout Plain Layout
Name3
\begin_inset CommandInset label
LatexCommand label
name "fig:Name3"

\end_inset


\end_layout

\end_inset


\end_layout

\end_inset


\begin_inset space \hfill{}
\end_inset


\begin_inset Float figure
wide false
sideways false
status open

\begin_layout Plain Layout
\begin_inset Graphics
    filename images/Fig2_4.png
    scale 30

\end_inset


\end_layout

\begin_layout Plain Layout
\begin_inset Caption Standard

\begin_layout Plain Layout
Name3
\begin_inset CommandInset label
LatexCommand label
name "fig:Name3"

\end_inset


\end_layout

\end_inset


\end_layout

\end_inset


\end_layout

\begin_layout Plain Layout
\begin_inset Caption Standard

\begin_layout Plain Layout
Caption for figure
\begin_inset CommandInset label
LatexCommand label
name "fig:FigureLabel"

\end_inset


\end_layout

\end_inset


\end_layout

\end_inset

 
\end_layout

For doing the same thing in pure LaTeX:

\begin{figure}[tb]
\begin{center}
\subfigure[Name1]{\includegraphics[width=1.625in]{images/Fig2_1.png}}
\subfigure[Name2]{\includegraphics[width=1.625in]{images/Fig2_2.png}}
\subfigure[Name3]{\includegraphics[width=1.625in]{images/Fig2_3.png}}
\subfigure[Name4]{\includegraphics[width=1.625in]{images/Fig2_4.png}}
\end{center}
\caption{Caption for figure}
\label{figureLabel}
\end{figure}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.