答案1
如果你不记得了adjustbox
,另一种解决方案是将图像放在表格中(tabular
仅包含单个单元格),或者\parbox,
或minipage
。如果你想要精细控制垂直对齐(即不完全在垂直中心),可能值得使用\vbox
:
\documentclass{article}
\usepackage{graphicx}
\parskip2em
\begin{document}
Left text%
\begin{tabular}{c}
\includegraphics[width=2cm]{example-image}\\
\end{tabular}%
Right text\par
Left text
\parbox{2cm}{\includegraphics[width=\linewidth]{example-image}}
Right text\par
Left text \vbox to .83cm{\hbox{\includegraphics[width=2cm]{example-image}}}
Right text\par
Left text \vbox to 1.2cm{\hbox{\includegraphics[width=2cm]{example-image}}}
Right text
\end{document}
答案2
使用adjustbox
它的valign=c
选项是:
\documentclass{article}
\usepackage[export]{adjustbox}
\begin{document}
Left text
\includegraphics[height=50pt,valign=c]{example-image}
Right text
\end{document}