垂直對齊的子浮動標題防止換行

垂直對齊的子浮動標題防止換行

我已經對此進行了搜索,但無法找到適合我的特定文件的解決方案。

使用回答 我並排放置了兩張不同寬度的圖像。

我希望圖像 (a) 的文字不換行。理想情況下,我希望圖像位於非換行標題上方的中心。

微量元素

\documentclass{article}
\usepackage{graphicx}
\usepackage{subfig}
\begin{document}
\newsavebox{\myimage}

\begin{figure}
  \centering
  \savebox{\myimage}{\hbox{\rule{150pt}{150pt}}}% Store largest image
  \subfloat[First caption text is a bit longer and wraps.]{\usebox{\myimage}} \quad
  \subfloat[Second fits on one line.]{\raisebox{\dimexpr.5\ht\myimage-.5\height\relax}{\rule{100pt}{20pt}}}
  \caption{This is a figure.}
\end{figure}
\end{document}

文字換行

答案1

只需在較大影像的一側添加一些空間即可。這將使標題不換行:

在此輸入影像描述

\documentclass{article}

\usepackage{graphicx,subfig}

\newsavebox{\myimage}

\begin{document}

\begin{figure}
  \centering
  \savebox{\myimage}{\hbox{\rule{150pt}{150pt}}}% Store largest image
  \subfloat[First caption text is a bit longer and wraps.]{\quad\usebox{\myimage}\quad} \quad
  \subfloat[Second fits on one line.]{\raisebox{\dimexpr.5\ht\myimage-.5\height}{\rule{100pt}{20pt}}}
  \caption{This is a figure.}
\end{figure}

\end{document}

上面我\quad在左圖的兩側使用了。有關更多選項,請參閱水平間距有哪些指令?

相關內容