我正在以累积的方式撰写论文,因此想通过 pdfpages 包包含已发表的论文。它很好地包含了它们,对于图表,条目被传递到列表中,可以使用 hyperref 访问。但是,对于章节和小节,“文本”没有被传递,即我得到了目录中的编号、缩进和页码,但没有得到文本。
我通常使用 XeLaTeX-->Biber-->XeLaTeX。
我尝试尽可能地减少代码(但保留了所有的类选项和超链接选项):
% ===== File mainthesis.tex - Dissertation ======
\documentclass[
version=last, %always uses the latest version of KOMA Script (currently 3.28)
draft=false, % draft option on, i.e. small black boxes on the end of paragraphs needing post processing and others.
overfullrule=false, % also lerading to black boxes, but no other effect compared to draft mode.
paper=a4, % size
oneside, % indicates two side printing, affects margins, as well as vertical stretching to achieve same level of bottom line.
open=any, % also enables chapters to start on the left page AND right page. Alternatively use "right" or "left".
fontsize=11pt, % main font size, which affects further sizing using large, huge, tiny etc.
numbers=noenddot, % title without dot
toc=bibliography, % bibliography in the table of content
listof=totoc,
BCOR=12mm, % binding correction, i.e. margin added to coorect for the amount of paper "lost" because of binding, ask the printer before how much this will be.
DIV=calc,
headings=big, %normal sized headings(chapter/section titles), default is "big"
headings=optiontohead, %uses the short statement in the chapter/section command for the running head. \chapter[short stement]{heading title} => work on the ones already created.
headinclude=false,
footinclude=false,
headsepline=true,
footnotes=multiple
]{scrbook} % KOMA -script class : scrbook
\usepackage{xcolor} % color
\definecolor{fh_blue}{cmyk}{0.62, 0.15, 0, 0.08}
\definecolor{fh_blue2}{cmyk}{0.82, 0.23, 0, 0}
\usepackage{pdflscape}
\usepackage[final]{pdfpages} % to import pdfs
\usepackage[german,english]{babel} % language packages included, English set as main language
% ====== Glossaries and indexes ======
\usepackage{makeidx}
\makeindex
% ====== Hyperref package !LAST TO BE LOADED! ======
\usepackage[draft=false,bookmarks=true]{hyperref}
\hypersetup{
% hyperindex=true, % Makes the page numbers of index entries into hyperlinks, not needed due to the linktocpage
linktoc=all, % Makes the page numbers and text to be link in the Table of content.
linktocpage=true, % Makes the page numbers only to be link in the Table of content etc.
breaklinks=true, % Allows links to be broken into multiple lines.
colorlinks=true, % Colours the text for links and anchors, these colors will appear in the printed version
linkcolor=fh_blue, % Colour for normal internal links
citecolor=fh_blue2, % color for citations
urlcolor=black, % Colour for linked URLs
anchorcolor=black, % Colour for anchor (target) text
frenchlinks=false, % Use small caps instead of colors for links
% ====== pdf specific hyperref options ======
pdftitle={title}, % Sets the .pdf Title
pdfauthor={who knowsi}, % Sets the document Author.
bookmarksopen=true, % Bookmarks are shown with all sub-trees expanded.
pdfhighlight=/N, % no change when selecting pdf links
pdfpagemode=UseOutlines, % open with open bookmarks
pdfstartpage=1, % Determines on which page the PDF file is opened.
pdfkeywords={x},
pdfdisplaydoctitle=true, % display document title instead of file name in title bar
pdftoolbar=false, % hides the pdf toolbar
pdfpagelayout=OneColumn % Displays the document in one column; continuous scrolling.s
}
\usepackage[all]{hypcap} % to make pdf jumps to the top of the element, not the caption (e.g. directly figure)
\begin{document}
\frontmatter % does roman numbering for starting pages
\setcounter{page}{1}
\tableofcontents % generates table of contents
\mainmatter % does arabic numbering for main part
\chapter{Results}
\includepdf[trim=25mm 25mm 25mm 30mm, clip, pagecommand={\thispagestyle{plain}}, offset=6mm 20mm, pages={1-}, scale=0.7,
addtotoc={
1, section, 1, {somuchtext}, {results:ijms},
1, subsection, 2, {Introduction}, ijmsIntro,
3, subsection, 2, {Results}, ijmsRes,
10, subsection, 2, {Discussion}, ijmsDis,
11, subsection, 2, {Material and Methods}, ijmsMnM
},
addtolist={
3, figure, {fig1}, ijmsFig1,
5, figure, {fig2}, ijmsFig2
}
]{publications/ijms.pdf}
\listoffigures
\end{document}
% ===== end of it =====
.toc 中的条目如下所示:
\babel@toc {english}{}
\contentsline {chapter}{\numberline {1}Results}{1}{chapter.1}%
\contentsline {section}{\numberline {1.1}}{2}{section.1.1}%
\contentsline {subsection}{\numberline {1.1.1}}{2}{subsection.1.1.1}%
\contentsline {subsection}{\numberline {1.1.2}}{4}{subsection.1.1.2}%
\contentsline {subsection}{\numberline {1.1.3}}{11}{subsection.1.1.3}%
\contentsline {subsection}{\numberline {1.1.4}}{12}{subsection.1.1.4}%
\contentsline {chapter}{\nonumberline List of Figures}{17}{chapter*.2}%
当我手动修改目录并重新编译时,它们可以在目录中工作,但不能在 pdf 书签中工作。
\contentsline {section}{\numberline {1.1}somuchtext}{2}{section.1.1}%
是的,我知道此功能仍被称为“实验性的”,但是任何提示都非常感谢!:)
最好的,克里斯
答案1
pdfpages 被 搞糊涂了heading=optiontohead
。在本地将其更改为标准 optiontoheadandtoc
:
\documentclass[
headings=optiontohead,
]{scrbook} % KOMA -script class : scrbook
\usepackage[final]{pdfpages}
\usepackage[german,english]{babel}
\usepackage{hyperref}
\begin{document}
\frontmatter
\tableofcontents
\mainmatter
\chapter{Results}
\KOMAoptions{headings=optiontoheadandtoc}
\includepdf[pages={1},
addtotoc={
1, section, 1, {somuchtext}, {results:ijms}
}
]{example-image-duck}
\listoffigures
\end{document}