![五位数字的正确对齐](https://linux22.com/image/340134/%E4%BA%94%E4%BD%8D%E6%95%B0%E5%AD%97%E7%9A%84%E6%AD%A3%E7%A1%AE%E5%AF%B9%E9%BD%90.png)
我想将五个数字排成一行。前四个数字应放在 2x2 的网格中,其大小是第五个数字的一半,第五个数字应放在小数字的右边。
我得到了这个代码片段,但它不能完成工作,因为第二行小数字基本上位于右侧的“列”,但在右侧较大数字的下方一行。
\documentclass[12pt,a4paper,twoside]{article}
\usepackage{subcaption} %to have subfigures available
\begin{document}
\begin{figure}
\centering
\begin{subfigure}[t]{0.48\textwidth}
\begin{subfigure}[t]{0.49\textwidth}
\includegraphics[width=\textwidth]{pics/img0.pdf}
\end{subfigure}
\begin{subfigure}[t]{0.49\textwidth}
\includegraphics[width=\textwidth]{pics/img1.pdf}
\end{subfigure}
\begin{subfigure}[t]{0.49\textwidth}
\includegraphics[width=\textwidth]{pics/img2.pdf}
\end{subfigure}
\begin{subfigure}[t]{0.49\textwidth}
\includegraphics[width=\textwidth]{pics/img3.pdf}
\end{subfigure}
\caption{four small figures, each half the size of \ref{fig:large}}
\end{subfigure}
\quad%to get new line
\begin{subfigure}[t]{0.48\textwidth}
\includegraphics[width=\textwidth]{pics/fused_img.pdf}
\caption{one large figure.}
\label{fig:large}
\end{subfigure}
\caption{overall caption}
\end{figure}
\end{document}
我基本上理解了输出,因为小数字的第二行实际上是“整个”数字的第二行。我错过了什么,有没有办法将五个数字整齐地排列在一行中?
答案1
只需改变两个主子图的定位器似乎就可以解决这个问题:
\documentclass[12pt,a4paper,twoside]{article}
\usepackage{subcaption} %to have subfigures available
\begin{document}
\begin{figure}
\centering
\begin{subfigure}[ht]{0.48\textwidth}
\begin{subfigure}[t]{0.49\textwidth}
\includegraphics[width=\textwidth]{pics/img0.pdf}
\end{subfigure}
\begin{subfigure}[t]{0.49\textwidth}
\includegraphics[width=\textwidth]{pics/img1.pdf}
\end{subfigure}
\begin{subfigure}[t]{0.49\textwidth}
\includegraphics[width=\textwidth]{pics/img2.pdf}
\end{subfigure}
\begin{subfigure}[t]{0.49\textwidth}
\includegraphics[width=\textwidth]{pics/img3.pdf}
\end{subfigure}
\caption{four small figures, each half the size of \ref{fig:large}}
\end{subfigure}
\quad%to get new line
\begin{subfigure}[ht]{0.48\textwidth}
\includegraphics[width=\textwidth]{pics/fused_img.pdf}
\caption{one large figure.}
\label{fig:large}
\end{subfigure}
\caption{overall caption}
\end{figure}
\end{document}
答案2
好吧,我明白了。只需要添加一个小页面。不过我不知道这是否是一种好的解决方案/技巧。如果您知道更多基于乳胶的解决方案,请告诉我!
\documentclass[12pt,a4paper,twoside]{article}
\usepackage{subcaption} %to have subfigures available
\begin{document}
\begin{figure}[h!]
\centering
\begin{subfigure}[h!]{0.49\textwidth}
\begin{minipage}{\textwidth}
\begin{subfigure}{0.49\textwidth}
\includegraphics[width=\textwidth]{pics/img0.pdf}
\end{subfigure}
%
\begin{subfigure}{0.49\textwidth}
\includegraphics[width=\textwidth]{pics/img1.pdf}
\end{subfigure}
%
\begin{subfigure}{0.49\textwidth}
\includegraphics[width=\textwidth]{pics/img2.pdf}
\end{subfigure}
%
\begin{subfigure}{0.49\textwidth}
\includegraphics[width=\textwidth]{pics/img3.pdf}
\end{subfigure}
\end{minipage}
\caption{}
\end{subfigure}
\hfill
\begin{subfigure}{0.49\textwidth}
\includegraphics[width=\textwidth]{pics/fused_img.pdf}
\caption{}
\end{subfigure}
\end{figure}
\end{document}