我使用 Adobe Illustrator 为我的零件标题页绘制了一些封面。尽管如此,如果书签指向“封面”页,我将不胜感激。原始零件标题页可以保留,但是,最好将自制封面作为零件的第一页。
平均能量损失
\documentclass[12pt,a4paper,headinclude,openright]{scrbook}
\usepackage[usenames,dvipsnames,svgnames,x11names,table]{xcolor}
\usepackage{afterpage}
\usepackage{pagecolor}
\usepackage[ilines]{scrlayer-scrpage}
\usepackage[top=3cm, bottom=4cm, outer=4cm, inner=3cm, heightrounded, marginparwidth=3cm, marginparsep=0.5cm, voffset=0cm]{geometry}
\usepackage{pdfpages}
\begin{document}
\frontmatter
\let\LaTeXStandardMaketitle\maketitle
\renewcommand{\maketitle}{%
\includepdf[openright=false]{Cover.pdf}
}%
\includepdf[openright=false]{CoverVol1.pdf} % this is where the cover should be
\thispagestyle{empty}
\part{Part ONE} % I would like to retain the text title as the same format as well
\end{document}
封面为 A4 尺寸,可根据要求提供。
答案1
我不确定我是否明白你想要什么:
\documentclass[12pt,a4paper,headinclude,openright]{scrbook}
\usepackage[usenames,dvipsnames,svgnames,x11names,table]{xcolor}
\usepackage{afterpage}
\usepackage{pagecolor}
\usepackage[ilines]{scrlayer-scrpage}
\usepackage[top=3cm, bottom=4cm, outer=4cm, inner=3cm, heightrounded, marginparwidth=3cm, marginparsep=0.5cm, voffset=0cm]{geometry}
\usepackage{pdfpages}
\newcommand*\pdfpart[2]{%
\cleardoublepage%
\includepdf[pagecommand=\thispagestyle{empty}%
\stepcounter{part}\addparttocentry{\thepart}{#2}%
\addtocounter{part}{-1}%
]{#1.pdf}%
\cleardoublepage%
\part[]{#2}%
}
\usepackage{mwe}% dummy text and example pdf
\begin{document}
\frontmatter
\tableofcontents
\mainmatter
\pdfpart{example-image-A}{Part ONE}
\blinddocument
\blinddocument
\part{Part TWO}
\blinddocument
\blinddocument
\pdfpart{example-image-B}{Part THREE}
\blinddocument
\blinddocument
\pdfpart{example-image-C}{Part FOUR}
\blinddocument
\blinddocument
\end{document}
注意:您必须加载hyperref
(您的 MWE 中缺少此包),并且如果您想使用书签,您必须\phantomsection
在之前添加。\addparttocentry
更新
如果图像应该位于普通部分页面的背景中,您可以定义并使用新的页面样式。
\documentclass[12pt]{scrbook}
\usepackage{xcolor}
\usepackage{scrlayer-scrpage}
%%%
\usepackage{etoolbox}
\newcommand*\partpagecolor[1][]{}
\newkomafont{partpage}{\normalcolor}
\addtokomafont{part}{\usekomafont{partpage}}
\addtokomafont{partnumber}{\usekomafont{partpage}}
\newpairofpagestyles{partpageimage}{
\clearpairofpagestyles
\ofoot{\pagemark}
\addtokomafont{pagenumber}{\usekomafont{partpage}}
}
\makeatletter
\newcommand*\@partpageimage{}
\newcommand*\partpageimage[2][]{%
\ifstr{#2}{}{%
\setkomafont{partpage}{\normalcolor}%
\def\@partpageimage{}%
}{%
\setkomafont{partpage}{\partpagecolor[#1]}%
\gdef\@partpageimage{\includegraphics[width=\paperwidth]{#2}}%
}}
\appto\partheademptypage{\partpageimage{}}
\DeclareNewLayer[background,area={.5\paperwidth}{.5\paperheight}{0pt}{0pt},
contents={\makebox[0pt]{\raisebox{0pt}[.5\height][.5\height]{\@partpageimage}}}
]{partpageimage.bg}
\makeatother
\AddLayersAtBeginOfPageStyle{partpageimage}{partpageimage.bg}
\colorlet{defaultpartpagecolor}{white}
% comment the following two lines to get normal part pages
\renewcommand*{\partpagestyle}{partpageimage}
\renewcommand*{\partpagecolor}[1][]{\ifstr{#1}{}{\color{defaultpartpagecolor}}{\color{#1}}}
%%%
\usepackage{hyperref}
\usepackage{mwe}% dummy text and example pdf
\begin{document}
\frontmatter
\tableofcontents
\mainmatter
\partpageimage{example-image-golden-upright}
\part{Part ONE}
\blinddocument
\part{Part TWO}
\blinddocument
\partpageimage[yellow]{example-grid-100x100bp}
\part{Part THREE}
\blinddocument
\partpageimage{example-image-A}
\part{Part FOUR}
\blinddocument
\end{document}
答案2
受到 esdd 回答的启发,经过反复尝试,我找到了我需要的东西。
\documentclass[12pt,a4paper,headinclude,openright]{scrbook}
\usepackage[usenames,dvipsnames,svgnames,x11names,table]{xcolor}
\usepackage{afterpage}
\usepackage{pagecolor}
\usepackage[ilines]{scrlayer-scrpage}
\usepackage[top=3cm, bottom=4cm, outer=4cm, inner=3cm, heightrounded, marginparwidth=3cm, marginparsep=0.5cm, voffset=0cm]{geometry}
\usepackage{pdfpages}
\begin{document}
\frontmatter
\let\LaTeXStandardMaketitle\maketitle
\renewcommand{\maketitle}{%
\includepdf[openright=false]{Cover.pdf}
}%
% ================================= part and chapter style ==================================
\newcommand*\pdfpart[2]{%
\cleardoublepage%
\phantomsection%
\stepcounter{part}%
\includepdf{#1.pdf}%
\addparttocentry{\thepart}{#2}%
\cleardoubleemptypage%
\part*{#2}%
}
\pdfpart{}{}
\end{document}
我知道你可能不知道我在做什么。我会在这里解释一下。
\phantonsection
创建一个隐藏部分以将书签重定向至封面。- 然后将计数器加 1
- 包含封面并将条目添加到目录中
- 页面结尾处
\cleardoublepage
- 用作
\part*
“幻影”部分 - 参数
\pdfpart
ONE 表示封面,TWO 表示零件名称。