我有一个由三部分组成的图,使用下面的代码可以给出以下输出:
但是,我想将子图的标签更改为交换 (b) 和 (c)。我该怎么做?
\documentclass{article}
\usepackage{subcaption}
\usepackage[demo]{graphicx}
\begin{document}
\begin{figure}[ht]
\centering
\parbox{\textwidth}{
\parbox{.44\textwidth}{%
\subcaptionbox{}{\includegraphics[width=\hsize, height=0.9cm]{example-image-a}}
\vskip1em
\subcaptionbox{}{\includegraphics[width=\hsize, height=2.8cm]{example-image-b}}
}
\hskip1em
\parbox{.55\textwidth}{%
\subcaptionbox{}{\includegraphics[width=\hsize, height=6.5cm]{example-image-c}}
}
}
\caption{Overall caption}
\label{fig:label}
\end{figure}
\end{document}
答案1
使用包tblr
中定义的tabularray
\documentclass{article}
\usepackage{subcaption}
\usepackage{graphicx}
\usepackage{tabularray}
\UseTblrLibrary{counter,varwidth} % <===
\begin{document}
\begin{figure}[ht]
\centering
\begin{tblr}{colspec={X[c] X[c]},
measure = vbox,
vspan=even}
\subfloat[]{\includegraphics[width=\hsize, height=2.8cm]{example-image-a}}
& \SetCell[r=2]{c}
\subfloat[]{\includegraphics[width=\hsize,
height=6.5cm]{example-image-b}} \\
\subfloat[]{\includegraphics[width=\hsize, height=2.8cm]{example-image-c}}
\end{tblr}
\caption{Overall caption}
\label{fig:label}
\end{figure}
\end{document}