TeX - LaTeX Asked by CeibaM on February 22, 2021
I am new to latex and want to make good format pictures with captions, like this one.
After some search, I was able to generate similar captions with
begin{figure}
begin{minipage}[b]{0.49linewidth}
includegraphics{figure1.pdf}
begin{center} figure1 end{center}
end{minipage}
begin{minipage}[b]{0.49linewidth}
includegraphics{figure2.pdf}
begin{center} figure2 end{center}
end{minipage}
caption{figure1 vs. figure2 }
end{figure}
However, there is a large space between the text.
In general, how can I have more control over the position of text?
There are all kinds of options here, the simplest of which is to set the "sub-figure" construction inside a tabular
:
documentclass{article}
usepackage{graphicx}
begin{document}
begin{figure}
mbox{}hfill
begin{tabular}[b]{c}
includegraphics[width=5em]{example-image-a} \
figure1
end{tabular}hfill
begin{tabular}[b]{c}
includegraphics[width=7em]{example-image-b} \
figure2
end{tabular}hfill
mbox{}
caption{figure1 vs. figure2}
end{figure}
end{document}
Since you're using tabular
, just change the space by adding an optional <len>
argument to the tabular
line break \[<len>]
. If you have multi-line "sub-figure" captions, then one could figure out something different:
documentclass{article}
usepackage{graphicx}
begin{document}
begin{figure}
mbox{}hfill
includegraphics[width=5em]{example-image-a}hfill
makebox[12em]{includegraphics[width=7em]{example-image-b}}hfill
mbox{}par
%vspace{<len>} to increase the space
mbox{}hfill
makebox[5em]{figure1}hfill
begin{tabular}[t]{@{}p{12em}@{}}
This is a beautiful figure that needs more descriptive words
end{tabular}hfill
mbox{}
caption{figure1 vs. figure2}
end{figure}
end{document}
Of course, in a general setting, I'd recommend using subcaption
; you should find sufficient examples within the subcaption
documentation.
Correct answer by Werner on February 22, 2021
I would use subigure
defined in the subcaption
package and write text belos images with caption*{...}
:
documentclass{article}
usepackage{graphicx}
usepackage{caption, subcaption}
captionsetup{skip=1ex, font=small}
captionsetup[sub]{skip=-1ex}
begin{document}
begin{figure}
centering
setkeys{Gin}{width=linewidth}
begin{subfigure}[b]{0.4linewidth}
includegraphics{example-image-a} \
caption*{figure 1}
end{subfigure}%
hfil
begin{subfigure}[b]{0.4linewidth}
includegraphics{example-image-B} \
caption*{figure 2}
end{subfigure}%
caption{figure1 vs. figure2}
label{fig:comparison}
end{figure}
end{document}
Answered by Zarko on February 22, 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