我有一个非常大的文档,其 main.tex 文件如下所示:
\documentclass[
bibliography=totoc, % Add the bibliography to the TOC
listof=totoc, % Add the "List of *" to the TOC
numbers=noenddot
%final % Set document status as FINAL
%draft % Set document status as DRAFT: Faster, skips some stuff (e.g. referencing)
]{scrbook} % scrbook defaults: a4paper, twoside, openright, 11pt
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Input encoding: UTF8
\usepackage[utf8]{inputenc}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Requirements
% Color \usepackage[table,xcdraw]{xcolor}
% Custom colors for TIKZ forests \colorlet{mygreen}{green!75!black} \colorlet{col1in}{red!30} \colorlet{col1out}{red!40} \colorlet{col2in}{mygreen!40} \colorlet{col2out}{mygreen!50} \colorlet{col3in}{blue!30} \colorlet{col3out}{blue!40} \colorlet{col4in}{mygreen!20} \colorlet{col4out}{mygreen!30} \colorlet{col5in}{blue!10} \colorlet{col5out}{blue!20}
\colorlet{col6in}{yellow!20}
\colorlet{col6out}{yellow!30}
\colorlet{col7out}{orange}
\colorlet{col7in}{orange!50}
\colorlet{col8out}{orange!40}
\colorlet{col8in}{orange!20}
\colorlet{linecol}{blue!60}
% TIKZ
\usepackage{tikz}
\usetikzlibrary{external} % Externalizes Tikz graphics - speeds up compilation if unchanged.
\usetikzlibrary{matrix,calc,positioning,shapes,shadows,arrows,fit,automata}
\usetikzlibrary{arrows.meta, shapes.geometric}
\usetikzlibrary{mindmap} % Used for the AI mindmap
\usetikzlibrary{chains,quotes,positioning} % Used for flowcharts
% If-Then statements
\usepackage{ifthen}
\newboolean{publicationversion}
\newboolean{DRing}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Page Geometry Layout
\usepackage[
a4paper,
top=35mm,
bottom=40mm,
inner=35mm,
outer=40mm,
bindingoffset=5mm,
marginparsep=5mm,
marginparwidth=40mm,
%showframe % Can be enabled to debug the page geometry
]{geometry}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Header & Footer
\usepackage[
headsepline,
footsepline,
draft=false % Draft mode adds "ruler" instead of header/footer, we never want that!
]{scrlayer-scrpage}
% Style
\renewcommand*{\chaptermarkformat}{\chapapp~\thechapter:\enskip} % Put "chapter" oder "appendix" in front of the chapter number in running head
\clearpairofpagestyles
\ohead{\headmark}
\automark[chapter]{chapter}
\automark*[section]{}
\ofoot*{\pagemark}
\pagestyle{scrheadings}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Fancy Chapter Titles (rectangle, large number,.. )
\usepackage[Lenny]{fncychap}
% Modify `Lenny` style to also cover Abstract/Appendicies/...
\makeatletter
\newlength{\backskip}
\renewcommand{\DOTIS}[1]{%
\settowidth{\px}{\CNV{#1}}
\addtolength{\px}{2pt}
\settoheight{\py}{\CNV{#1}}
\addtolength{\py}{1pt}
\settowidth{\mylen}{\CNV{#1}}
\addtolength{\mylen}{1pt}
\settoheight{\pyy}{\CNoV\thechapter}
\addtolength{\pyy}{-2pt}
\setlength{\myhi}{\pyy}
\addtolength{\myhi}{-1\py}
\par
\parbox[b]{\textwidth}{%
\rule[\py]{\RW}{\myhi}%
\hskip -\RW%
\rule[\pyy]{\px}{\RW}%TOP1
\hskip -\px%
\raggedright%
\CNV{#1}%
\hskip1pt%
\mghrulefill{\RW}%
\rule{\RW}{\pyy}\par\nobreak%
\vskip -\baselineskip%
\vskip -\pyy%
\hskip \mylen%
\mghrulefill{\RW}\par\nobreak%
\vskip \pyy}%
\vskip 20\p@}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Captions for Figures
\usepackage[
labelsep=colon,
font={small},
labelfont={small,bf}
]{caption}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% TOC: Mini TOC, e.g., at beginning of chapters.
\usepackage{etoc}
\newcommand{\chaptertoc}[1][Contents]{%
\etocsettocstyle{\addsec*{#1\\[-12pt]\rule{\textwidth}{0.4pt}}}{}%
\etocsetnexttocdepth{2}%
\localtableofcontents%
\noindent\rule{\textwidth}{0.4pt}%
\bigskip{}%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PDF Links
\usepackage[
bookmarksdepth=3, % bookmark levels in the PDF.
bookmarksnumbered % Show section numbering in bookmark
]{hyperref}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ToDo Notes
\usepackage[
colorinlistoftodos,
textsize=footnotesize,
obeyDraft
]{todonotes}
% ToDo style
\makeatletter
\tikzstyle{notestyleraw}=[
draw=\@todonotes@currentbordercolor,
fill=\@todonotes@currentbackgroundcolor,
line width=0.5pt,
text width=\@[email protected],
inner sep=0.8ex
]
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Glossary / Acronym List
\usepackage[nomain,
acronym,
shortcuts, % short commands: \Ac,\ac,\Acl,\acl,\Acs,\acs,\Acf,\acf
nopostdot, % no dot at end of each entry
nogroupskip % no spacing between groups (same first letter)
]{glossaries}
% Glossary style
\newglossarystyle{mylong}{%
\setglossarystyle{long}%
\renewenvironment{theglossary}{\begin{longtable}[l]{lp{.8\linewidth}}}{\end{longtable}}%
\renewcommand{\glsnamefont}[1]{\textbf{##1}}%
\renewcommand{\glossentry}[2]{%
\glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
\Glossentrydesc{##1}\glspostdescription\space ##2\tabularnewline
}%
}
% Additional commands that are safe to use in headlines & captions (Hyperref/TOC context).
\newcommand{\AcfHeadline}[1]{\texorpdfstring{\Glsentryfull{#1}}{#1}}
\newcommand{\acfHeadline}[1]{\texorpdfstring{\glsentryfull{#1}}{#1}}
\newcommand{\AclHeadline}[1]{\texorpdfstring{\Glsentrylong{#1}}{#1}}
\newcommand{\aclHeadline}[1]{\texorpdfstring{\glsentrylong{#1}}{#1}}
\newcommand{\acsHeadline}[1]{\texorpdfstring{\glsentryshort{#1}}{#1}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Bibliography / Citing
\usepackage[
backend=biber,
style=numeric, %alphabetic,
sorting=none,
minnames=4,
maxnames=10
]{biblatex}
% Cititation References
\addbibresource{content/references/references.bib}
% Citation style
\DeclareFieldFormat{labelalpha}{\thefield{entrykey}}
\DeclareFieldFormat{extraalpha}{}
% Custom packages
\usepackage{chronosys}
\usepackage{subfig}
\usepackage[super]{nth}
\usepackage{diagbox}
\usepackage{forest}
\usepackage{pgfplots}
\pgfplotsset{compat=1.7}
\usepackage{enumitem}
\usepackage{smartdiagram}
\usepackage{environ}
\usepackage{pgfplotstable}
\usepackage{varwidth}
\usepackage{multirow}
\usepackage{graphicx}
\usepackage{makecell}
\usepackage{longtable}
\usepackage{scrhack}
\usepackage{lmodern}
\usepackage{bookmark}
\usepackage{tabularray}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Content Stuff
\usepackage{float}
\usepackage{framed}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Math stuff
\usepackage{amsmath}
%\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{stmaryrd} % e.g. llbracket
\usepackage{MnSymbol} % e.g. llangle
% Theorem, Definition, etc. environments
\usepackage[framed]{ntheorem}
% Definition
\makeatletter
\newtheoremstyle{angularbreak}
{\item[\rlap{\vbox{\hbox{\hskip\labelsep \theorem@headerfont ##1\ ##2\theorem@separator}\hbox{\strut}}}]}%
{\item[\rlap{\vbox{\hbox{\hskip\labelsep \theorem@headerfont ##1\ ##2\ \textlangle\,##3\,\textrangle\theorem@separator}\hbox{\strut}}}]}
\makeatother
\theoremstyle{angularbreak}
\theoremsymbol{\ensuremath{\clubsuit}}
\newframedtheorem{definition}{Definition}[chapter]
% Lemma
\theoremstyle{plain}
\theoremsymbol{\ensuremath{\heartsuit}}
%\theoremseparator{:}
\newframedtheorem{lemma}{Lemma}[chapter]
% Theorem
\theoremstyle{plain}
\theoremheaderfont{\normalfont\bfseries}\theorembodyfont{\slshape}
\theoremsymbol{\ensuremath{\diamondsuit}}
%\theoremseparator{:}
\newframedtheorem{theorem}{Theorem}[chapter]
% Proof
\theoremstyle{nonumberplain}
\theoremheaderfont{\normalfont\bfseries}\theorembodyfont{\upshape}
\theoremsymbol{\rule{1ex}{1ex}}
\theoremseparator{}
\newtheorem{proof}{Proof}[chapter]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Code stuff
\usepackage{listings} % Code Listings
\usepackage{lstautogobble} % Automatically ignore white-space based on first line.
\usepackage[ruled,linesnumbered]{algorithm2e}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --------------------------------------------------------------------------- %
% --------------------------------------------------------------------------- %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Variables, Commands, Macros
\input{content/variables.tex}
%\input{content/commands.tex}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Set PDF attributes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\hypersetup{
pdftitle = {\@title},
pdfauthor= {\@author}
}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Glossaries / Acronym definitions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\input{content/glossary.tex}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --------------------------------------------------------------------------- %
% -MAIN DOCUMENT------------------------------------------------------------- %
% --------------------------------------------------------------------------- %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Custom distance settings
\setlength{\abovecaptionskip}{6pt plus 2pt minus 2pt}
\raggedbottom
% Custom environments
\makeatletter
\newsavebox{\measure@tikzpicture}
\NewEnviron{scaletikzpicturetowidth}[1]{%
\def\tikz@width{#1}%
\def\tikzscale{1}\begin{lrbox}{\measure@tikzpicture}%
\BODY
\end{lrbox}%
\pgfmathparse{#1/\wd\measure@tikzpicture}%
\edef\tikzscale{\pgfmathresult}%
\BODY
}
\makeatother
\newlist{tabitem}{itemize}{1}
\setlist[tabitem]{label=\textbullet, noitemsep,leftmargin=*,topsep=0pt,partopsep=0pt, nosep, before=\begin{minipage}[t]{\hsize}, after=\end{minipage}}
\begin{document}
\tolerance=1
\emergencystretch=\maxdimen
\hyphenpenalty=10000
\hbadness=10000
\frontmatter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Titlepage %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newgeometry{margin=1in}
\begin{titlepage}
MyTitlePage...
\end{titlepage}
\restoregeometry
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Todo List: Only shows in draft mode!
\listoftodos
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Abstract
\include{content/abstract}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Acknowledgments
\include{content/acknowledgements}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Table of Contents %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\DeclareTOCStyleEntry[
pagenumberbox=\linebelow
]{tocline}{part}
\newcommand*\linebelow[1]{\hfil \makebox[0pt][r]{\rule[-\dp\strutbox]{\textwidth}{.4pt}}}
\cleardoublepage % Open right (req. for bookmark)
\pdfbookmark[0]{\contentsname}{toc} % Add TOC to PDF bookmarks
\setcounter{tocdepth}{2} % Set maximum TOC depth
\setcounter{secnumdepth}{3} % Set maximum depth of numbered subsections
\tableofcontents % Print TOC
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% List of Algorithms / Figures / ... %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\listoffigures
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Glossary / Acronyms
{
\renewcommand*{\arraystretch}{1.2}
\printglossary[type=\acronymtype,nonumberlist,style=mylong]
}
% Acronyms/Glossary: Reset used status
\glsresetall
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Content %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\mainmatter
\input{content/content.tex}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Biliography %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\nocite{*}
\printbibliography
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Appendix %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\appendix
\input{content/appendix/appendix}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{document}
abstract.tex 文件如下所示:
\chapter*{Abstract} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pdfbookmark[0]{Abstract}{abstract}
...
完整的摘要只能放在一页上。为此,我想将摘要标题上移,因为目前页面开头和摘要矩形开头之间有很大空间:
但是,我想让其他章节标题不受影响。如何实现这一点?非常感谢您的帮助。
答案1
试试这个代码。它只会影响包含在内的章节,frontmatter
而不会影响带星号的章节。
\documentclass[
bibliography=totoc, % Add the bibliography to the TOC
listof=totoc, % Add the "List of *" to the TOC
numbers=noenddot
%final % Set document status as FINAL
%draft % Set document status as DRAFT: Faster, skips some stuff (e.g. referencing)
]{scrbook} % scrbook defaults: a4paper, twoside, openright, 11pt
\usepackage{showframe} % ONLY to show the margins
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Fancy Chapter Titles (rectangle, large number,.. )
\usepackage[Lenny]{fncychap}
% Modify `Lenny` style to also cover Abstract/Appendicies/...
\makeatletter
\renewcommand{\DOTIS}[1]{%
\settowidth{\px}{\CNV{#1}}
\addtolength{\px}{2pt}
\settoheight{\py}{\CNV{#1}}
\addtolength{\py}{1pt}
\settowidth{\mylen}{\CNV{#1}}
\addtolength{\mylen}{1pt}
\settoheight{\pyy}{\CNoV\thechapter}
\addtolength{\pyy}{-2pt}
\setlength{\myhi}{\pyy}
\addtolength{\myhi}{-1\py}
\par
\ifnum\thechapter=0\vspace*{-63pt}\fi% added <<<<<<<<<<<<<<<<<<<<<<
\parbox[b]{\textwidth}{%
\rule[\py]{\RW}{\myhi}%
\hskip -\RW%
\rule[\pyy]{\px}{\RW}%TOP1
\hskip -\px%
\raggedright%
\CNV{#1}%
\hskip1pt%
\mghrulefill{\RW}%
\rule{\RW}{\pyy}\par\nobreak%
\vskip -\baselineskip%
\vskip -\pyy%
\hskip \mylen%
\mghrulefill{\RW}\par\nobreak%
\vskip \pyy}%
\vskip 20\p@}
\makeatother
\DeclareOldFontCommand{\rm}{\normalfont}{\mathnormal} % added to supress scrbook Error: undefined old font command `\rm'.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\tolerance=1
\emergencystretch=\maxdimen
\hyphenpenalty=10000
\hbadness=10000
\frontmatter
\chapter{Acknowledgments}
\chapter{Abstract}
\mainmatter
\chapter{First}
\chapter*{Second}
\appendix
\chapter{Last}
\end{document}