我想将四张图片放在水平线上,但第一张图片没有像其他三张图片一样对齐。我仅针对图像部分的代码如下:
\begin{figure}[h]
\centering
\begin{subfigure}{0.24\textwidth}
\includegraphics[width=\textwidth]{images/testImages/104055.jpg}
\caption{Imaginea originala}
\end{subfigure}
\begin{subfigure}{0.24\textwidth}
\centering
\includegraphics[width=\textwidth]{images/testImages/groundTruth104055.jpg}
\caption{Imaginea ground-truth}
\end{subfigure}
\centering
\begin{subfigure}{0.24\textwidth}
\includegraphics[width=\textwidth]{images/testImages/imageResult104055.jpg}
\caption{Rezultatul metodei propuse.}
\end{subfigure}
\begin{subfigure}{0.24\textwidth}
\centering
\includegraphics[width=\textwidth]{images/cannyImage/canny104055.jpg}
\caption{Rezultatul metodei Canny.}
\end{subfigure}
\end{figure}
\begin{figure}
\begin{subfigure}{0.24\textwidth}
\includegraphics[width=\textwidth]{images/testImages/163014.jpg}
\caption{Imaginea originala.}
\end{subfigure}
\begin{subfigure}{0.24\textwidth}
\includegraphics[width=\textwidth]{images/testImages/groundTruth163014.jpg}
\caption{Imaginea ground-truth.}
\end{subfigure}
\centering
\begin{subfigure}{0.24\textwidth}
\includegraphics[width=\textwidth]{images/testImages/imageResult163014.jpg}
\caption{Rezultatul metodei propuse.}
\end{subfigure}
\centering
\begin{subfigure}{0.24\textwidth}
\includegraphics[width=\textwidth]{images/cannyImage/canny163014.jpg}
\caption{Rezultatul metodei Canny.}
\end{subfigure}
\end{figure}
答案1
[t]
在每个后面添加选项\begin{subfigure}
。这将使图像与其底线对齐。
\documentclass{article}
\usepackage[textwidth=15cm]{geometry}
\usepackage{graphicx}
\usepackage{subcaption}
\begin{document}
\begin{figure}
\centering
\begin{subfigure}[t]{0.24\textwidth}
\includegraphics[width=\textwidth]{example-image}
\caption{Imaginea originala}
\end{subfigure}
\begin{subfigure}[t]{0.24\textwidth}
\centering
\includegraphics[width=\textwidth]{example-image}
\caption{Imaginea ground-truth}
\end{subfigure}
\centering
\begin{subfigure}[t]{0.24\textwidth}
\includegraphics[width=\textwidth]{example-image}
\caption{Rezultatul metodei propuse.}
\end{subfigure}
\begin{subfigure}[t]{0.24\textwidth}
\centering
\includegraphics[width=\textwidth]{example-image}
\caption{Rezultatul metodei Canny.}
\end{subfigure}
\end{figure}
\end{document}