PDF 图像上的章节标题功能仅在非停止模式下有效

PDF 图像上的章节标题功能仅在非停止模式下有效

已更新。以下代码可以运行,但只有在出现警告消息时按下 Enter 键时才会生成 pdf。我目前的解决方案是在非停止模式下运行它,例如:在正确的位置打开 cmd 并输入“pdflatex -interaction nonstopmode example.tex”。我想知道是否有任何方法可以以干净的方式获得相同的结果,即无需忽略警告。

\documentclass[10pt, a3paper]{article}
\newcommand{\projecttitle}{Interaction Nonstopmode}

\usepackage{tikz}
\usepackage{pdfpages}
\usepackage{pdflscape}
\usepackage{geometry}

\geometry{
a3paper,
left=23mm,
top=15mm,
right=10mm,
bottom=15mm,
headheight=38pt,
includeheadfoot,
showframe=false
}

\begin{document}

\tableofcontents

\newpage
\thispagestyle{empty}
\includepdf[scale=1.000, trim=0cm 0cm 0.0cm 2cm, pagecommand= {\begin{tikzpicture}[remember picture, overlay] \node [anchor=west] at (-0.2, 0) {\section{Section 1}}; \end{tikzpicture}}]{any_pdf_image.pdf}

\newpage
\thispagestyle{empty}
\includepdf[scale=1.000, trim=0cm 0cm 0.0cm 2cm, pagecommand= {\begin{tikzpicture}[remember picture, overlay] \node [anchor=west] at (-0.2, 0) {\section{Section 2}}; \end{tikzpicture}}]{any_pdf_image.pdf}

\newpage
\thispagestyle{empty}
\includepdf[scale=1.000, trim=0cm 0cm 0.0cm 2cm, pagecommand= {\begin{tikzpicture}[remember picture, overlay] \node [anchor=west] at (-0.2, 0) {\section{Section 3}}; \end{tikzpicture}}]{any_pdf_image.pdf}

\end{document}

答案1

xwatermark 将水印放在大小为 \paperwidth/\paperheight 的 \parbox 中。尝试将其缩放 12 倍然后旋转时,尺寸会变得太大。将缩放移到 savebox 中。

第二个问题是您在 \node 内部使用了 \section。这太大胆了。将其隐藏在 \parbox 中:

\documentclass[10pt, a3paper]{article}


\newcommand{\projecttitle}{Interaction Nonstopmode}

\usepackage{tikz}
\usepackage[printwatermark]{xwatermark}
\usepackage{pdfpages}
\usepackage{pdflscape}
\usepackage{geometry}

\geometry{
a3paper,
left=23mm,
top=15mm,
right=10mm,
bottom=15mm,
headheight=38pt,
includeheadfoot,
showframe=false
}

\newsavebox\mybox
\newsavebox\mybox
\savebox\mybox{\scalebox{12}{\tikz[color=gray!1000,opacity=0.3]\node{DRAFT};}}
\newwatermark*[allpages,angle=45]{\usebox\mybox}


\begin{document}
\tableofcontents \thispagestyle{fancy}
\addtocontents{toc}{\protect\thispagestyle{empty}}
\pagenumbering{gobble}

\newpage
\thispagestyle{empty}
\includepdf[scale=1.000, trim=0cm 0cm 0.0cm 2cm, pagecommand= {\begin{tikzpicture}[remember picture, overlay] \node [anchor=west] at (-0.2, 0) {\parbox{\linewidth}{\section{Section 1}}}; \end{tikzpicture}}]{example-image.pdf}

\newpage
\thispagestyle{empty}
\includepdf[scale=1.000, trim=0cm 0cm 0.0cm 2cm, pagecommand= {\begin{tikzpicture}[remember picture, overlay] \node [anchor=west] at (-0.2, 0) {\parbox{\linewidth}{\section{Section 2}}}; \end{tikzpicture}}]{example-image.pdf}

\newpage
\thispagestyle{empty}
\includepdf[scale=1.000, trim=0cm 0cm 0.0cm 2cm, pagecommand= {\begin{tikzpicture}[remember picture, overlay] \node [anchor=west] at (-0.2, 0) {\parbox{\linewidth}{\section{Section 3}}}; \end{tikzpicture}}]{example-image.pdf}

\end{document}

相关内容