贝茨编号多个 PDF 文件,并附有页码标签

贝茨编号多个 PDF 文件,并附有页码标签

我真的没想到这是可能的,直到我偶然发现,交叉引用包含标签中的反驳和论点的 PDF,读了那篇文章给了我一些希望。

我有一份文件,其中的文字将包含对贝茨编号记录的引用,引用如下:

我确实认为 x 证明了 y。[R 第 132 页]

我遇到的问题是我的记录包含许多 pdf 文件,在我开始起草该记录的参考资料后,可能会添加一些文件。

从引用的帖子中,我想要修改的代码如下:

\documentclass[12pt,a4paper,fleqn,parskip=half]{scrartcl}

\usepackage{lscape}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[demo]{graphicx}
\usepackage[scaled]{helvet}
\usepackage{caption}
\usepackage[breaklinks=true,colorlinks=true,linkcolor=black,citecolor=black,urlcolor=black]{hyperref}
\usepackage{xargs}                                          


%---------------------------------------------------------------------
%   % Macro to find the number of pages of included PDF document
%---------------------------------------------------------------------
\makeatletter
\newcounter{imagepage}
\newcommand*{\foreachpage}[2]{
  \begingroup
   \sbox0{\includegraphics{#1}}
    \xdef\foreachpage@num{\the\pdflastximagepages}
    \endgroup
  \setcounter{imagepage}{0} 
  \@whilenum\value{imagepage}<\foreachpage@num\do{%
    \stepcounter{imagepage}
    #2\relax
  }
}
\makeatother


%---------------------------------------------------------------------
%   % Macro to include PDF document with page numbers in caption and label
%---------------------------------------------------------------------
\makeatletter
\newcommandx{\picTEST}[5][1=0.9, 2=0]
{
  \foreachpage{#4}
 {
   \begin{figure}[h!]
     \centering
     \makebox[\textwidth]{\includegraphics[width=#1\hsize,page=\value{imagepage},angle=#2]{#4}}
     \caption{#5 - Page \arabic{imagepage} of {\the\pdflastximagepages}}
     \label{#3\theimagepage}
   \end{figure}
   \clearpage
 }  
}
\makeatother


\begin{document}

\section{Some Text}
Here is reference to page \ref{Document1_Label_Page3} of the included PDF document.

\newpage
\section{Some insert of PDF document}
\picTEST{Document1_Label_Page}{quickcode.pdf}{Document1}

\end{document}

如果满足以下条件,则可以使用此上面引用的代码:

  1. 可以将多个 pdf 输出为整个 pdf 集中的“贝茨”编号。例如,对于两个 10 页的 pdf 文档,第一个 pdf 文档的编号为 1-10,第二个 pdf 文档的编号为 11-20,等等。

  2. 可以将“图形”一词替换为“记录”,并完全抑制 pdf 文件名的打印。

  3. 生成的 PDF 可以更大并且居中,而不是偏向右侧。

谢谢。

答案1

这不是答案,而只是评论

\documentclass[12pt,a4paper,fleqn,parskip=half]{scrartcl}

\usepackage{lscape}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[demo]{graphicx}
\usepackage[scaled]{helvet}
\usepackage{caption}
\usepackage[breaklinks=true,colorlinks=true,linkcolor=black,citecolor=black,urlcolor=black]{hyperref}
\usepackage{xargs}                                          

%---------------------------------------------------------------------
%   % Macro to include PDF document with page numbers in caption and label
%---------------------------------------------------------------------
\newcounter{imagepage}

\makeatletter
\newcommandx{\picTEST}[5][1=0.9, 2=0]
{\pdfximage{#4}
\setcounter{imagepage}{0} 
\@whilenum\value{imagepage}<\pdflastximagepages\do{%
    \stepcounter{imagepage}
    \begin{figure}[h!]
     \centering
     \includegraphics[width=#1\textwidth,page=\value{imagepage},angle=#2]{#4}
     \caption{#5 - Page \arabic{imagepage} of {\the\pdflastximagepages}}
     \label{#3\theimagepage}
    \end{figure}
    \clearpage}}
\makeatother


\begin{document}

\section{Some Text}
Here is reference to page \ref{Document1_Label_Page3} of the included PDF document.


\clearpage
\begingroup
\areaset{\paperwidth}{\paperheight}
\renewcommand{\figurename}{Record}
\section{Some insert of PDF document}
\picTEST{Document1_Label_Page}{quickcode.pdf}{Document1}


\picTEST{Document2_Label_Page}{quick.pdf}{MTDocument}
\endgroup


\end{document}

我稍微修改了你的命令。

  1. 我不太清楚(抱歉)请参阅更新:-)
  2. 使用\renewcommand{\figurename}{Record}
  3. 使用\areaset{\paperwidth}{\paperheight}此选项将边距设置为 0,并允许使用整页。如果这还不够,您可以尝试使用选项trim

例子

\makeatletter
\newcommandx{\picTEST}[5][1=1, 2=0]
{\pdfximage{#4}
\setcounter{imagepage}{0} 
\@whilenum\value{imagepage}<\pdflastximagepages\do{%
    \stepcounter{imagepage}
    \begin{figure}[h!]
     \centering
     \includegraphics[width=#1\textwidth,page=\value{imagepage},angle=#2,trim=0mm 30mm 0mm 15mm,clip]{#4}
     \caption{#5 - Page \arabic{imagepage} of {\the\pdflastximagepages}}
     \label{#3\theimagepage}
    \end{figure}
    \clearpage}}
\makeatother

更新如果我理解正确的话,1)我们需要的代码是

\newcounter{imagepage}
\newcommand*\sumpages{0}

\makeatletter
\newcommandx{\picTEST}[5][1=1, 2=0]
{\pdfximage{#4}
\setcounter{imagepage}{0} 
\@whilenum\value{imagepage}<\pdflastximagepages\do{%
    \stepcounter{imagepage}
    \begin{figure}[h!]
     \centering
     \includegraphics[width=#1\textwidth,page=\value{imagepage},angle=#2,trim=0mm 30mm 0mm 15mm,clip]{#4}
     \caption{#5 - Page \the\numexpr\value{imagepage}+\sumpages\relax\ of {\the\numexpr\pdflastximagepages+\sumpages\relax}}
     \label{#3\theimagepage}
    \end{figure}
    \clearpage}
    \xdef\sumpages{\the\pdflastximagepages}}
\makeatother

问:你需要吗angle


更新(适用于 xelatex、lualatex)来自 egreg 的回答

\usepackage{ifxetex} 
\usepackage{ifluatex} 

\ifluatex 
\usepackage{luatextra}
\usepackage{unicode-math} 
\usepackage[utf8]{luainputenc} 
\else\ifxetex 
\usepackage{xltxtra} % also loads fontspec, xunicode 
\usepackage{unicode-math} 
\XeTeXinputencoding utf8 

\newcount\pdflastximagepages
\def\pdfximage#1{\pdflastximagepages=\XeTeXpdfpagecount"#1"\relax}
\else 
\usepackage[utf8]{inputenc} 
\usepackage[T1]{fontenc} 
\fi\fi 

平均能量损失

\documentclass[12pt,a4paper,fleqn,parskip=half]{scrartcl}

\usepackage{lscape}

\usepackage{ifxetex} 
\usepackage{ifluatex} 

\ifluatex 
\usepackage{luatextra}
\usepackage{unicode-math} 
\usepackage[utf8]{luainputenc} 
\else\ifxetex 
\usepackage{xltxtra} % also loads fontspec, xunicode 
\usepackage{unicode-math} 
\XeTeXinputencoding utf8 

\newcount\pdflastximagepages
\def\pdfximage#1{\pdflastximagepages=\XeTeXpdfpagecount"#1"\relax}
\else 
\usepackage[utf8]{inputenc} 
\usepackage[T1]{fontenc} 
\fi\fi 
\usepackage[scaled]{helvet}
\usepackage{caption}
\usepackage[breaklinks=true,colorlinks=true,linkcolor=black,citecolor=black,urlcolor=black]{hyperref}
\usepackage{xargs}                                          

%---------------------------------------------------------------------
%   % Macro to include PDF document with page numbers in caption and label
%---------------------------------------------------------------------
\newcounter{imagepage}
\newcommand*\sumpages{0}

\makeatletter
\newcommandx{\picTEST}[5][1=1, 2=0]
{\pdfximage{#4}
\setcounter{imagepage}{0} 
\@whilenum\value{imagepage}<\pdflastximagepages\do{%
    \stepcounter{imagepage}
    \begin{figure}[h!]
     \centering
     \includegraphics[width=#1\textwidth,page=\value{imagepage},angle=#2,trim=0mm 30mm 0mm 15mm,clip]{#4}
     \caption{#5 - Page \the\numexpr\value{imagepage}+\sumpages\relax\ of {\the\numexpr\pdflastximagepages+\sumpages\relax}}
     \label{#3\theimagepage}
    \end{figure}
    \clearpage}
    \xdef\sumpages{\the\pdflastximagepages}}
\makeatother

\begin{document}

\section{Some Text}
Here is reference to page \ref{Document1_Label_Page3} of the included PDF document.

\clearpage
\begingroup
\areaset{\paperwidth}{\paperheight}
\renewcommand{\figurename}{Record}
\section{Some insert of PDF document}
\picTEST{Document1_Label_Page}{quickcode.pdf}{Document1}


\picTEST{Document2_Label_Page}{quick.pdf}{MTDocument}
\endgroup


\end{document}

相关内容