我在 LaTeX 中遇到了垂直对齐的小问题。我有 3 个高度不同的图形,我想将它们并排显示在一张图中。不幸的是,默认情况下它们与底部边缘对齐,看起来不太好。但是,如果我尝试将它们与顶部边缘对齐,看起来也不好,因为子图的标题没有对齐。
我无法使用subfig
包,因为它与我使用的另一个包存在冲突,但是我使用了很多包,所以我不确定哪个包造成了问题。
是否有一些可能的方法,如何将子图与顶部边缘对齐并防止子标题对齐?
这是我当前的代码:
\begin{figure}[!ht]
\begin{subfigure}[t][1\width]{0.3\textwidth}
\centering\vspace{0pt}
\includegraphics[width=\textwidth]{content/indoor/convex_space}
\caption{Convex Spaces}
\label{fig:convex_space}
\end{subfigure}
~
\begin{subfigure}[t][1\width]{0.3\textwidth}
\centering\vspace{0pt}
\includegraphics[width=\textwidth]{content/indoor/axial_line}
\caption{Axial Map}
\label{fig:axial_line}
\end{subfigure}
~
\begin{subfigure}[t][1\width]{0.3\textwidth}
\centering\vspace{0pt}
\includegraphics[width=\textwidth]{content/indoor/intersection_graph}
\caption{Intersection graph}
\label{fig:intersection_graph}
\end{subfigure}
\caption{Examples of some spatial analysis technique\cite{dawes2013}}
\label{fig:scene_walls_3d}
\end{figure}
答案1
基于 TikZ 的解决方案:
\documentclass{article}
\usepackage{subcaption}
\usepackage{tikz}
\begin{document}
\begin{figure}[!ht]
\begin{subfigure}{0.3\textwidth}
\begin{tikzpicture}
\node{\includegraphics[width=\textwidth]{tall}};
% obtain coordinates of size of the largest bounding box to
% be used in the other two subfigures
\coordinate (ne)at(current bounding box.north east);
\coordinate (sw)at(current bounding box.south west);
\end{tikzpicture}
\caption{Convex Spaces}
\label{fig:convex_space}
\end{subfigure}
~
\begin{subfigure}{0.3\textwidth}
\begin{tikzpicture}
\useasboundingbox(ne)rectangle(sw);
\node[below] at(current bounding box.north){\includegraphics[width=\textwidth]{med}};
\end{tikzpicture}
\caption{Axial Map}
\label{fig:axial_line}
\end{subfigure}
~
\begin{subfigure}{0.3\textwidth}
\begin{tikzpicture}
\useasboundingbox(ne)rectangle(sw);
\node[below] at(current bounding box.north){\includegraphics[width=\textwidth]{short}};
\end{tikzpicture}
\caption{Intersection graph}
\label{fig:intersection_graph}
\end{subfigure}
\caption{Examples of some spatial analysis technique}
\label{fig:scene_walls_3d}
\end{figure}
\end{document}