我如何创建如下所示的 PDF 索引?

我如何创建如下所示的 PDF 索引?

我已生成如下 PDF。现在我想创建指数该页面应列出所有包含的论文名称,即部分,整个 pdf 中的每篇论文都应该有一行。我该如何实现这一点?最好是XeTeX。

\documentclass[landscape,a4paper]{article}
\usepackage{pdfpages}
\usepackage{pgfmath}
%\usepackage[margin=1cm,showframe]{geometry}% MWE only

\pgfmathsetmacro{\scale}{(\paperheight-2cm)/(\paperwidth-3cm)}% 1cm margin
\pgfmathsetlengthmacro{\delta}{\paperwidth-2cm-2*\scale*(\paperheight-3cm)-4mm}% 4mm fudge factor

 
\usepackage[footwidth=paper]{scrlayer-scrpage}
\pagestyle{plain}




\usepackage{polyglossia}
\usepackage{fontspec}
\setotherlanguage{hebrew}
\newfontfamily\hebrewfont{Arial}

\robustify{\thepage}
\renewcommand{\thepage}{\arabic{page} \ \roman{page}\ \texthebrew{\hebrewnumeral{\value{page}}}}

 

\newcommand\gettitle[1]{%
  \directlua{%
    local filename = kpse.find_file("#1", 'graphic/figure')
    doc = pdfe.open(filename)
    info = pdfe.getinfo(doc)
    title = info['Title']
    tex.print(title)
  }}

\begin{document}

%  \includepdf[scale=1.02, nup=2x1,pages=1-8,trim=2.5cm 2.5cm 5.5cm 7.0cmB]{sh1.pdf}

%pagecommand={\thispagestyle{plain}}

  \includepdf[scale=\scale,noautoscale,nup=2x1,pages=1-,delta={\delta} 0pt,offset=0pt -3mm,% offset in reverse order
  trim=2.5cm 2.5cm 5.5cm 7.0cm,picturecommand={\put(.15\paperwidth,3.3cm){\thepage}}]{example-image-a4-numbered.pdf}


  \includepdf[scale=\scale,noautoscale,nup=2x1,pages=1-,delta={\delta} 0pt,offset=0pt -3mm,% offset in reverse order
  trim=2.5cm 2.5cm 5.5cm 7.0cm,picturecommand={\put(.15\paperwidth,3.3cm){\thepage}}]{example-image-a4-numbered.pdf}

  \includepdf[scale=\scale,noautoscale,nup=2x1,pages=1-,delta={\delta} 0pt,offset=0pt -3mm,% offset in reverse order
  trim=2.5cm 2.5cm 5.5cm 7.0cm,picturecommand={\put(.15\paperwidth,3.3cm){\thepage}}]{example-image-a4-numbered.pdf}
\end{document}

答案1

考虑对代码示例进行补充。这会list of documents在单独的页面上生成一个,如list of tables

\documentclass[landscape,a4paper]{article}
\usepackage{pdfpages}
\usepackage{pgfmath}
%\usepackage[margin=1cm,showframe]{geometry}% MWE only

\pgfmathsetmacro{\scale}{(\paperheight-2cm)/(\paperwidth-3cm)}% 1cm margin
\pgfmathsetlengthmacro{\delta}{\paperwidth-2cm-2*\scale*(\paperheight-3cm)-4mm}% 4mm fudge factor

\usepackage[footwidth=paper]{scrlayer-scrpage}
\pagestyle{plain}

\usepackage{polyglossia}
\usepackage{fontspec}
\setotherlanguage{hebrew}
\newfontfamily\hebrewfont{Arial}

\robustify{\thepage}
\renewcommand{\thepage}{\arabic{page} \ \roman{page}\ \texthebrew{\hebrewnumeral{\value{page}}}}

% ======  added to the mwe code
\usepackage{xpatch}
\usepackage[titles]{tocloft}

\newlistof[section]{pdfdoc}{lop}{List of documents}

\newcommand{\pdfdoc}[1]{%
    \refstepcounter{pdfdoc}
    \addcontentsline{lop}{pdfdoc}{\protect\numberline{\thepdfdoc} \addvspace{1pt}\sffamily\small \textcolor{blue}{#1}}\par}

\xpatchcmd{\listofpdfdoc}{\chapter*}{\section*}{}{}
\cftsetindents{pdfdoc}{15mm}{10mm}

% ===== end of addition

\newcommand\gettitle[1]{%
    \directlua{%
    local filename = kpse.find_file("#1", 'graphic/figure')
    doc = pdfe.open(filename)
    info = pdfe.getinfo(doc)
    title = info['Title']
    tex.print(title)
    }}

\begin{document}
    
    %  \includepdf[scale=1.02, nup=2x1,pages=1-8,trim=2.5cm 2.5cm 5.5cm 7.0cmB]{sh1.pdf}
    
    %pagecommand={\thispagestyle{plain}}

% ===== added to print list of documents
    \listofpdfdoc
    \addcontentsline{toc}{section}{List of documents}
% ===== 
    
    \includepdf[scale=\scale,noautoscale,nup=2x1,pages=1-,delta={\delta} 0pt,offset=0pt -3mm,% offset in reverse order
    trim=2.5cm 2.5cm 5.5cm 7.0cm,picturecommand={\put(.15\paperwidth,3.3cm){\thepage}}]{example-image-a4-numbered.pdf}
    \addcontentsline{lop}{pdfdoc}{example-image-a4-numbered - 1} % <- puts document name into list of documents
    
    
    \includepdf[scale=\scale,noautoscale,nup=2x1,pages=1-,delta={\delta} 0pt,offset=0pt -3mm,% offset in reverse order
    trim=2.5cm 2.5cm 5.5cm 7.0cm,picturecommand={\put(.15\paperwidth,3.3cm){\thepage}}]{example-image-a4-numbered.pdf}
    \addcontentsline{lop}{pdfdoc}{example-image-a4-numbered - 2}
    
    \includepdf[scale=\scale,noautoscale,nup=2x1,pages=1-,delta={\delta} 0pt,offset=0pt -3mm,% offset in reverse order
    trim=2.5cm 2.5cm 5.5cm 7.0cm,picturecommand={\put(.15\paperwidth,3.3cm){\thepage}}]{example-image-a4-numbered.pdf}
    \addcontentsline{lop}{pdfdoc}{example-image-a4-numbered - 3} \phantom{end} % <- needed to add the last entry to the list of documents

\end{document}

笔记添加\phantom{end}到最后一个条目。不知何故,需要将最后一个条目添加到代码中的列表中。在我自己的文档中,使用代码获取不需要的包含文档列表。

pdf_lop_列表

相关内容