如何在兩個文字之間插入圖形?

如何在兩個文字之間插入圖形?

我想創建類似於下面給出的內容:垂直居中圖像兩側的文字:

數位

答案1

如果您不記得adjustbox,另一種解決方案可以將圖像放入表格中(tabular僅包含單一單元格),或 a\parbox,或 a 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}

相關內容