![如何使用 eso-pic 在页面的右上角右对齐打印?](https://linux22.com/image/420100/%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%20eso-pic%20%E5%9C%A8%E9%A1%B5%E9%9D%A2%E7%9A%84%E5%8F%B3%E4%B8%8A%E8%A7%92%E5%8F%B3%E5%AF%B9%E9%BD%90%E6%89%93%E5%8D%B0%EF%BC%9F.png)
如何使用eso-pic
右对齐、在页面的右上角打印?
该手册可以在这里找到: http://ctan.math.utah.edu/ctan/tex-archive/macros/latex/contrib/eso-pic/eso-pic.pdf
答案1
以下按您的需要放置内容。若要稍微移动内容,只需0pt
根据您的喜好进行更改即可。
\documentclass[]{article}
\usepackage{eso-pic}
\AddToShipoutPictureBG
{%
\put(\LenToUnit{\paperwidth-0pt},\LenToUnit{\paperheight-0pt})
{%
\llap % make it overlap to the left from this point
{%
\raisebox{-\height} % move it down a bit to make it top-aligned
{\parbox{5cm}{\blindduck}}% contents
}%
}%
}
\usepackage{duckuments} % dummy text
\begin{document}
\mbox{}% produces one empty page
\end{document}
答案2
变体代码:
\documentclass{article}
\usepackage{graphicx}
\usepackage{eso-pic}
\usepackage{lipsum}
\begin{document}
\AddToShipoutPictureBG{\AtPageUpperLeft{\hspace*{\paperwidth\llap{\raisebox{-\height}{\includegraphics{pepe-le-pew2}}}}}}
\lipsum[1]
\begin{figure}[!h]
\centering
\includegraphics{pepe-le-pew2}
\caption{Pepe le Pew in action}
\end{figure}
\end{document}