我是 Latex 新手,在对齐标题和图片方面遇到了问题。我需要所有图片都对齐,所有标题都左右对齐。我尝试了很多方法,阅读了很多资料。但就像我说的,我是 Latex 新手,遇到了问题。如果有人能帮助我,我将不胜感激。
\begin{figure}[!ht]
\centering
% ~~~~~~~~~~~
\begin{subfigure}{0.32\linewidth}
\includegraphics[width=0.82\linewidth]{Figures/ConfigManagerRename2}
\caption{Choose configuration to rename.}
\label{f:configmanagerlist}
\end{subfigure}
% ~~~~~~~~~~~
\begin{subfigure}{0.32\linewidth}
\includegraphics[width=0.82\linewidth]{Figures/ConfigManagerRename1}
\caption{Select rename.}
\label{f:savedconfopt}
\end{subfigure}
% ~~~~~~~~~~~
\begin{subfigure}{0.32\linewidth}
\includegraphics[width=0.82\linewidth]{Figures/ConfigManagerRename}
\caption{Choose new configuration name.}
\label{f:renamesavedconf}
\end{subfigure}
% ~~~~~~~~~~~
\caption{Config Manager - renaming selected configuration.}
\end{figure}
答案1
使用可选参数[c]
(上图)或[t]
(下图)垂直对齐子图。
\documentclass[12pt,a4paper]{article}
\usepackage{subcaption}
\usepackage{graphicx}
\begin{document}
\begin{figure}[!ht]
\centering
% ~~~~~~~~~~~
\begin{subfigure}[c]{0.32\linewidth}
\includegraphics[width=0.82\linewidth,height=30pt]{example-image-a}
\caption{Choose configuration to rename.}
\label{f:configmanagerlist}
\end{subfigure}
% ~~~~~~~~~~~
\begin{subfigure}[c]{0.32\linewidth}
\includegraphics[width=0.82\linewidth,height=70pt]{example-image-b}
\caption{Select rename.}
\label{f:savedconfopt}
\end{subfigure}
% ~~~~~~~~~~~
\begin{subfigure}[c]{0.32\linewidth}
\includegraphics[width=0.82\linewidth,height=100pt]{example-image-c}
\caption{Choose new configuration name.}
\label{f:renamesavedconf}
\end{subfigure}
% ~~~~~~~~~~~
\caption{Config Manager - renaming selected configuration.}
\end{figure}
\begin{figure}[!ht]
\centering
% ~~~~~~~~~~~
\begin{subfigure}[t]{0.32\linewidth}
\includegraphics[width=0.82\linewidth,height=30pt]{example-image-a}
\caption{Choose configuration to rename.}
\label{f:configmanagerlist}
\end{subfigure}
% ~~~~~~~~~~~
\begin{subfigure}[t]{0.32\linewidth}
\includegraphics[width=0.82\linewidth,height=70pt]{example-image-b}
\caption{Select rename.}
\label{f:savedconfopt}
\end{subfigure}
% ~~~~~~~~~~~
\begin{subfigure}[t]{0.32\linewidth}
\includegraphics[width=0.82\linewidth,height=100pt]{example-image-c}
\caption{Choose new configuration name.}
\label{f:renamesavedconf}
\end{subfigure}
% ~~~~~~~~~~~
\caption{Config Manager - renaming selected configuration.}
\end{figure}
\end{document}
使用命令\subcaptionbox
对齐子图及其标题。查看子标题 doc,第 2 节。
\documentclass[12pt,a4paper]{article}
\usepackage{subcaption}
\usepackage{graphicx}
\begin{document}
\begin{figure}
\centering
\subcaptionbox{Choose configuration to rename.\label{f:one}}
{\includegraphics[height=30pt,width=0.3\linewidth]{example-image-a}}\hfill
\subcaptionbox{Select rename.\label{f:two}}
{\includegraphics[height=50pt,width=0.3\linewidth]{example-image-b}}\hfill
\subcaptionbox{Choose new configuration name.\label{f:three}}
{\includegraphics[height=100pt,width=0.3\linewidth]{example-image-c}}
\caption{Config Manager - renaming selected configuration.}
\end{figure}
\end{document}