我怎样才能将 includegraphics 放置在边距中以使其与文本对齐?

我怎样才能将 includegraphics 放置在边距中以使其与文本对齐?

我想将一些小东西(大部分是图像\includegraphics)放置在页面的外边缘,以便我可以将其与一段文本(例如标题)或\includegraphics文本中的另一段文本对齐。

答案1

图像的参考点位于底部边缘,因此与标准文本基线对齐\marginpar

在此处输入图片描述

\documentclass{article}

\usepackage{graphicx}
\setlength\marginparsep{1pt}% moved closer to show alignment
\begin{document}

One two three four five six seven eight.
One two three four five six seven eight.
\includegraphics[height=.7em]{example-image}
Red yellow blue green black white brown.%
\marginpar{\includegraphics[height=.7em]{example-image-a}}
One two three four five six seven eight.
One two three four five six seven eight.
One two three four five six seven eight.
Red yellow blue green black white brown.
Red yellow blue green black white brown.
Red yellow blue green black white brown.
One two three four five six seven eight.%
\marginpar{\includegraphics[height=.7em]{example-image-a}}
One two three four five six seven eight.
Red yellow blue green black white brown.
Red yellow blue green black white brown.
One two three four five six seven eight.

\end{document}

相关内容