TeX - LaTeX Asked by Nischal Karki on February 13, 2021
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.
For anyone having the same problem, I found a solution which apparently worked for me in lyx:
Answered by Nischal Karki on February 13, 2021
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:
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}
Answered by Nav on February 13, 2021
I could not get the above to work. A (low-brow?) way to do this is with a table, ie to make:
begin{figure}
centering{}%
begin{tabular}{cc}
includegraphics[width=7cm]{image1} & includegraphics[width=7cm]{image2}tabularnewline
(a) & (b)tabularnewline
end{tabular}caption{foiw}
end{figure}
For that I just
(a)
and (b)
in the lower row cells (or longer captions if you like)With this, you can add a referencing label to the overall figure, but not separately to each subfigure. You would just use, e.g. Figure~ref{myfig}(a)
Answered by CPBL on February 13, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP