如何将文本移到右侧?

如何将文本移到右侧?

我怎样才能将其AddToShipoutPictureFG移到右边?如果可以的话,留出一些余地

AtPageUpperLeft从到推断AtPageUpperRight不起作用。

\documentclass[12pt,titlepage]{article}%
\usepackage[landscape]{geometry}
\usepackage{pdfpages}
\usepackage{graphicx}% used for example-image
\usepackage{eso-pic}% used for header text http://ctan.org/pkg/eso-pic

\title{My Title}
\author{John Doe}
\date{\today}

\begin{document}
\maketitle

\AddToShipoutPictureFG*
    {\AtPageUpperLeft
      {\parbox[t]
               {\paperwidth}
               {\mbox{}\\
                 Upper right line\\
                 other line
               }
      }
    }

\begin{figure}%
  \includegraphics[width=\linewidth,height=\textheight,keepaspectratio]{example-image-a}
\end{figure}%
\end{document}

图片

答案1

您可以使用以下命令移动\put

\documentclass[12pt,titlepage]{article}%
\usepackage[landscape]{geometry}
\usepackage{pdfpages}
\usepackage{graphicx}% used for example-image
\usepackage{eso-pic}% used for header text http://ctan.org/pkg/eso-pic

\title{My Title}
\author{John Doe}
\date{\today}

\begin{document}
\maketitle

\AddToShipoutPictureFG*
    {\AtPageUpperLeft
      {\put(0.8\paperwidth,-1cm)
         {\parbox[t]
               {\paperwidth}
               {Upper right line\\
                other line
               }}
      }
    }

\begin{figure}%
  \includegraphics[width=\linewidth,height=\textheight,keepaspectratio]{example-image-a}
\end{figure}%
\end{document}

但是使用当前的 LaTeX,您也可以直接使用 shipout 钩子:

\documentclass[12pt,titlepage]{article}%
\usepackage[landscape]{geometry}
\usepackage{pdfpages}
\title{My Title}
\author{John Doe}
\date{\today}

\begin{document}
\maketitle

\AddToHookNext{shipout/background}
    {
      \put(0.8\paperwidth,-1cm){more on the right}    
    }

\begin{figure}%
  \includegraphics[width=\linewidth,height=\textheight,keepaspectratio]{example-image-a}
\end{figure}%
\end{document}

相关内容