Latex 使用eso pic在页边距内居中显示背景图像

Latex 使用eso pic在页边距内居中显示背景图像,latex,Latex,在我的论文中,我包括了已经发表的论文。我已将页面提取为单独的EPS文件,并正在缩小它们,以便将它们放在页边距内的一页上(\pageScale) 虽然这样可以正常工作,但页面看起来非常小,无法放入页边距。我希望将图形的大小增加到超出页边距的地方,这样页眉和页码信息将与插入页面的页边距重叠 eso pic允许我用插入的页面填充整个页面,但页眉和页码与插入页面中的文本重叠: \mbox{} \AddToShipoutPictureBG*{ \includegraphics{Integrative-

在我的论文中,我包括了已经发表的论文。我已将页面提取为单独的EPS文件,并正在缩小它们,以便将它们放在页边距内的一页上(
\pageScale

虽然这样可以正常工作,但页面看起来非常小,无法放入页边距。我希望将图形的大小增加到超出页边距的地方,这样页眉和页码信息将与插入页面的页边距重叠

eso pic允许我用插入的页面填充整个页面,但页眉和页码与插入页面中的文本重叠:

\mbox{}
\AddToShipoutPictureBG*{
  \includegraphics{Integrative-Theory-Associative/pdf-pages/page-1.pdf}
}
\newpage

我喜欢缩小比例,将页面上的图形居中,使它们尽可能大,而图形中的文本不在页眉后面,而是在页边空白处

我不介意手动计算图形的正确比例,但我不知道如何将较小图形的中心放置在边距的中心<代码>\AtPageCenter
没有达到我预期的效果,将图形居中,而不是将图形左下角居中。

在下面的示例中,我使用了的一些技巧来调整包含的内容:

\documentclass{article}
\usepackage{fancyhdr,lipsum}% Just for this example
\fancyhf{}
\fancyhead[C]{This is some random header text}
\fancyfoot[C]{\thepage}
\renewcommand{\headrulewidth}{.4pt}
\renewcommand{\footrulewidth}{.4pt}
\pagestyle{fancy}

\usepackage[export]{adjustbox}
\usepackage{eso-pic}

\newcommand{\pictureincenteroftextblock}[2][]{%
  \AddToShipoutPictureBG*{%
    \AtTextLowerLeft{%
      \raisebox{.5\textheight}{%
        \hspace*{.5\textwidth}%
        \makebox[0pt]{\includegraphics[max width=\textwidth,max height=\textheight,valign=c,#1]{#2}}%
      }%
    }%
  }%
}

\begin{document}
\lipsum[1-5]

\clearpage

\mbox{}% Just put something on this page.
\pictureincenteroftextblock{example-image-a}

\clearpage

\mbox{}% Just put something on this page.
\pictureincenteroftextblock{example-image-10x16}

\clearpage

\mbox{}% Just put something on this page.
\pictureincenteroftextblock{example-image-1x1}

\clearpage

\mbox{}% Just put something on this page.
\pictureincenteroftextblock{example-image-a4}

\end{document}

使用
[export]
选项,
adjustbox
将其键值添加到的
\includegraphics
选项中。我使用的是
max width
max height
,如果宽度或高度超过这些最大值,则会缩小包含的图像(或PDF中的页面),同时仍保持包含的图像/页面纵横比。此外,
valign=c
v
垂直
c
中心方式对齐内容


用于将图像置于背景中,从文本块的左下部分开始。然后,通过标准间距命令,将其提升到位置(
\raisebox
)并推到文本块的中心(
\hspace
)。最后,图像水平居中(
\makebox[0pt]
)。

谢谢@Werner!我有两个澄清问题:(a)我无法使adjustbox软件包工作;CTAN包包含adjustbox.dtx和adjustbox.ins,但没有adjustbox.sty,而latex报告:未找到文件'adjustbox.sty'。(b) 由于我想插入的页面有自己的页边距,我只希望文本部分(在页边距内)与我论文的页边距相匹配。这意味着我应该能够提供一个比例因子,允许插入的页面稍微超出论文的页边。我不知道如何做到这一点,因为我更多地使用的是LyX而不是LaTeX。@b..:当您安装LyX时,它会询问您是否要下载MiKTeX,或者您安装的服务器上是否有现有的TeX发行版(例如TeX Live)。我假设您在安装时下载了MiKTeX。因此,您需要使用。从那里你应该可以选择安装。您可以使用
width=
height=
scale=
(a)我正在运行texlive(UbuntuPrecise),但没有包包含adjustbox。我最终从本地安装了文件(和需求)。(b) 我不确定你在上面的回答中的意思,你能编辑一下吗?理想情况下,基本大小将适合于边距(如上所述),1.2之类的缩放因子将比该基本大小大20%。将
\makebox[0pt]{\includegraphics[max width=\textwidth,max height=\texthheight,valign=c,{1]{2}%
替换为
\makebox[0pt]{\includegraphics[scale=0.9,valign=c,{2}}%
似乎成功了。谢谢
\documentclass{article}
\usepackage{fancyhdr,lipsum}% Just for this example
\fancyhf{}
\fancyhead[C]{This is some random header text}
\fancyfoot[C]{\thepage}
\renewcommand{\headrulewidth}{.4pt}
\renewcommand{\footrulewidth}{.4pt}
\pagestyle{fancy}

\usepackage[export]{adjustbox}
\usepackage{eso-pic}

\newcommand{\pictureincenteroftextblock}[2][]{%
  \AddToShipoutPictureBG*{%
    \AtTextLowerLeft{%
      \raisebox{.5\textheight}{%
        \hspace*{.5\textwidth}%
        \makebox[0pt]{\includegraphics[max width=\textwidth,max height=\textheight,valign=c,#1]{#2}}%
      }%
    }%
  }%
}

\begin{document}
\lipsum[1-5]

\clearpage

\mbox{}% Just put something on this page.
\pictureincenteroftextblock{example-image-a}

\clearpage

\mbox{}% Just put something on this page.
\pictureincenteroftextblock{example-image-10x16}

\clearpage

\mbox{}% Just put something on this page.
\pictureincenteroftextblock{example-image-1x1}

\clearpage

\mbox{}% Just put something on this page.
\pictureincenteroftextblock{example-image-a4}

\end{document}