Latex多图片灵活排版
发布日期:2021-05-18 06:30:06 浏览次数:18 分类:精选文章

本文共 2085 字,大约阅读时间需要 6 分钟。

  • 转自原文
  • 本文展示浮动体排版的实用技巧
  • 通过简单代码实现多种排版效果

以下是关于浮动体排版的一些示例代码及其效果展示。

\begin{figure}[!htp]
\begin{floatrow}
\ffigbox[\FBwidth]{
\includegraphics[width=0.45\textwidth]{1}
\includegraphics[width=0.45\textwidth]{2}
}{
\caption{共享题注,方便两个子图共用同一个题注}
\label{sharefig:a}
}
\end{floatrow}
\end{figure}

通过添加两张图片并设置同一个题注,实现了方便共享的效果。

\begin{figure}[!htp]
\begin{floatrow}
\ffigbox[\FBwidth]{
\includegraphics[width=0.45\textwidth]{1}
}{
\caption{独立题注}
\label{sepfig:a}
}
\ffigbox[\FBwidth]{
\includegraphics[width=0.45\textwidth]{2}
}{
\caption{独立题注}
\label{sepfig:b}
}
\end{floatrow}
\end{figure}

每张图片都有独立的题注,适用于分开说明的场景。

\begin{figure}[!htp]
\begin{floatrow}
\ffigbox[\textwidth]{
\begin{subfloatrow}[2]
\ffigbox[\FBwidth]{
\includegraphics[width=0.45\textwidth]{2}
}{
\caption{子题注}
\label{subfig:a}
}
\ffigbox[\FBwidth]{
\includegraphics[width=0.45\textwidth]{1}
}{
\caption{子题注}
\label{subfig:b}
}
\end{subfloatrow}
}{
\caption{共享题注带子题注}
\label{fig:sub}
}
\end{floatrow}
\end{figure}

子图可以自定义题注和布局,将同一题注用于多个子图,适合搭建复杂的排版结构。

\begin{figure}[!htp]
\ffigbox[\textwidth]{
\begin{subfloatrow}[2]
\ffigbox[\FBwidth]{
\includegraphics[width=0.4\textwidth]{1}
}{
\caption{子题注1}
\label{trifig:a}
}
\ffigbox[\FBwidth]{
\includegraphics[width=0.4\textwidth]{2}
}{
\caption{子题注2}
\label{trifig:b}
}
\end{subfloatrow}
\begin{subfloatrow}[2]
\ffigbox[\FBwidth]{
\includegraphics[width=0.4\textwidth]{3}
}{
\caption{子题注3}
\label{trifig:c}
}
\ffigbox[\FBwidth]{
\includegraphics[width=0.4\textwidth]{4}
}{
\caption{子题注4}
\label{trifig:d}
}
\end{subfloatrow}
}{
\caption{四个子图,每组两个并列排列}
\label{trifig}
}
\end{figure}

通过将子图分组,可以创建任意复杂的多列排版布局,支持动态扩展。

上一篇:VScode配置C/C++环境(UI界面)
下一篇:用latex简单绘制UML图

发表评论

最新留言

很好
[***.229.124.182]2025年04月15日 22时33分08秒