在不同的幾何頁面中包含 pdf 頁面

在不同的幾何頁面中包含 pdf 頁面

對於我的論文,我生成了一大組 pdf 圖像,我想將它們包含在文本中。特別是其中一個圖像是整頁 pdf 文件,其尺寸大於一般文件所使用的頁邊距。幾何形狀目前設定為a4paper,無法調整,因為它是強制樣式。

我目前正在包含 includepdf 功能,這會傳回圖像中顯示的結果。我遇到的問題是我無法將標題放在正確的位置。目前我正在使用 vspace 來設定標題的位置,但是當我低於某個值時,它會將標題移到另一個頁面。我相信這與製作頁面的幾何形狀有關,因此我認為更改一頁可以解決問題。然而,我不知道如何實現這一目標。

多謝!

答案1

覆蓋邊距比更改邊距更容易。 (不要忘記跑兩次。)

\documentclass[a4paper]{article}
\usepackage{tikz}
\usepackage{lipsum}
\begin{document}
\begin{figure}[p]
  \begin{minipage}[c][\textheight][s]{\textwidth}
    \begin{tikzpicture}[remember picture, overlay]
    \node[inner sep=0pt] at (current page.center)
      {\includegraphics[height=\paperheight,width=\paperwidth]{example-image}};
% or (\includegraphics[page=1]{filename.pdf}}:
    \end{tikzpicture}
    \vfill\caption{Caption goes here}
  \end{minipage}
\end{figure}

\lipsum[1-8]
\end{document}

這是使用 \newgeometry 的解決方案。 \afterpage 和 \restoregeometry 之間存在一些有趣的衝突,我將頁碼添加到第三頁的唯一方法是直接添加它。

\documentclass[a4paper]{article}
\usepackage[showframe]{geometry}
\usepackage{afterpage}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{lipsum}% MWE only

\begin{document}
\afterpage{\clearpage
\newgeometry{left=0pt,right=0pt,top=0pt,bottom=0pt,nofoot}%
\noindent\rlap{\includegraphics[height=.999\textheight,width=.999\textwidth]{example-image}}%
% or \includegraphics[page=1]{filename.pdf}
\begin{minipage}[b]{\textwidth}
  \captionof{figure}{Caption goes here}
\end{minipage}%
\restoregeometry
\rlap{\raisebox{\dimexpr \topskip-\textheight-\footskip}[0pt][0pt]{\makebox[\textwidth][c]{\thepage}}}%
\vspace{-\baselineskip}}
\lipsum[1-16]
\end{document}

相關內容