我的项目出了点问题,附录的最后一页没有保持预期的页码格式。我试过\cleardoublepage
命令,但我猜是其他故障(可能是我的错)。下面是我的序言和 MWE。对于序言的长度,我深表歉意,如果它与这里的选项有关。
\documentclass[12pt]{book}
\usepackage[spanish,es-nodecimaldot,es-lcroman,es-noquoting]{babel} %Hyphen
\addto\captionsspanish{\renewcommand\contentsname{ÍNDICE GENERAL}}
\addto\captionsspanish{\renewcommand\listfigurename{ÍNDICE DE FIGURAS}}
\addto\captionsspanish{\renewcommand{\listtablename}{ÍNDICE DE TABLAS}}
\addto\captionsspanish{\renewcommand{\figurename}{Figura}}
\addto\captionsspanish{\renewcommand{\tablename}{Tabla}}
\addto\captionsspanish{%
\renewcommand\appendixname{ANEXO}
\renewcommand\appendixpagename{Anexos}
}
\addto\captionsspanish{\renewcommand{\refname}{Referencias}}
\usepackage{wrapfig} %Texto alrededor de imágenes.
\usepackage{fancyhdr} %Encabezado.
%\usepackage[nottoc]{tocbibind} %Referencias no aparece numerada
\usepackage[titletoc,title]{appendix} %Simple modificacion apendices
\renewcommand{\addappheadtotoc}{%
\phantomsection\addcontentsline{toc}{chapter}{\appendixtocname}%
}
\usepackage{float} %Posiciona figuras en lugar deseado.
\setlength{\intextsep}{10pt} %Float environment spacing before and after.
\usepackage{etoolbox} %For Appendix page number A.1...D.1
\usepackage{tocloft}
\renewcommand\cftsubsecafterpnum{\vskip1pt}
\renewcommand\cftsecafterpnum{\vskip2pt}
\renewcommand\cftchapafterpnum{\vskip2pt}
\setlength{\cftbeforesecskip}{2pt}
\setlength{\cftbeforesubsecskip}{1pt}
\renewcommand\cftloftitlefont{\Large \bfseries}
\renewcommand\cftlottitlefont{\Large \bfseries}
\renewcommand\cfttoctitlefont{\Large \bfseries}
\setlength{\cftbeforetoctitleskip}{0em}
\setlength{\cftbeforelottitleskip}{0em}
\setlength{\cftbeforeloftitleskip}{0em}
\setlength{\cftaftertoctitleskip}{1.5em}
\setlength{\cftafterlottitleskip}{1.5em}
\setlength{\cftafterloftitleskip}{1.5em}
\cftsetindents{figure}{0em}{3.3em}
\cftsetindents{table}{0em}{3.3em}
%%% Patching the kernel \@sect command
\usepackage{regexpatch}
\makeatletter
\xpatchcmd*{\@sect}{\fi#7}{\fi\@nameuse{format#1}{#7}}{}{}
%%% for sections and subsections we want uppercase
\protected\def\formatsection{\MakeUppercase}
\protected\def\formatsubsection{\MakeUppercase}
%%% the other titles are left unchanged
\let\formatsubsubsection\@firstofone
\let\formatparagraph\@firstofone
\let\formatsubparagraph\@firstofone
%%% the following is necessary only if hyperref is used
\AtBeginDocument{%
\pdfstringdefDisableCommands{%
\let\formatsection\@firstofone
\let\formatsubsection\@firstofone
}%
}
\makeatother
%\renewcommand{\cfttoctitlefont}{\normalfont\normalsize\bfseries\MakeUppercase}
\usepackage[export]{adjustbox}
%\newcommand{\appendixpagenumbering}{
% \break
% \pagenumbering{arabic}
% \renewcommand{\thepage}{\thechapter-\arabic{page}}}
\usepackage{amsmath} %To write equations and math symbols.
\let\hbar\relax %Conflicting issue with fontspec and mtpro2.
\usepackage[mtpcal,subscriptcorrection,slantedGreek,nofontinfo,amssymbols]{mtpro2} %MathTime Professional 2 for fluency with Times font and Times math.
\usepackage{mathtools} %For equation with cases.
\usepackage{siunitx} %For SI units
\usepackage{caption} %All lines left aligned.
\captionsetup{format=hang}
\usepackage[bibstyle=apa,citestyle=authoryear-comp,maxcitenames=2,uniquelist=false,giveninits=true,uniquename=init,doi=false,isbn=false,url=false,dashed=true,sorting=nyt,backend=biber]{biblatex}
\DeclareNameAlias{sortname}{last-first}
\DeclareLanguageMapping{spanish}{spanish-apa}
\AtEveryBibitem{\clearfield{month}}
\usepackage{csquotes}
%\addbibresource{R.bib}
\DefineBibliographyStrings{spanish}{%
andothers = {et\addabbrvspace al\adddot},
bibliography = {Referencias},
}
\DeclareCiteCommand{\citeyearpar} %Use hyperef with citeryearpar command.
{}
{\mkbibparens{\bibhyperref{\printdate}}}
{\multicitedelim}
{}
\DefineBibliographyExtras{spanish}{\protected\def\bibrangedash{\textendash}}
\usepackage{rotating, booktabs} %Better hline commands.
\usepackage{enumitem} %Spacing in list items.
\renewcommand{\labelitemi}{$\circ$}
\usepackage{scrextend} %Margin indentation.
\usepackage{multicol,multirow} %Can make cells in tables with multiple rows or columns.
\usepackage{sectsty} %Hooks to change section header styles.
\sectionfont{\normalsize}
\subsectionfont{\normalsize}
\subsubsectionfont{\normalsize}
%\paragraphfont{\small \MakeUppercase}
\usepackage{subcaption}
\newtheorem{theorem}{Teorema}
\usepackage{listings}
\lstset{language=Matlab,numbers=left,numbersep=1.1em,xleftmargin=3em,frame=single,framexleftmargin=2.9em,columns=flexible,showstringspaces=false,breaklines=true}
\usepackage{matlab-prettifier}
\usepackage{arydshln}
\usepackage{chngcntr} %Per-section numbering in article class.
\counterwithin{figure}{section}
\counterwithin{table}{section}
\counterwithin{equation}{section}
\renewcommand{\theequation}{\arabic{chapter}.\arabic{section}.\arabic{equation}}
\usepackage{tablefootnote} %Footnotes in table environments
\usepackage{titlesec}
\titleformat{\chapter}[hang]
{\normalfont\Large\bfseries}{\chaptertitlename\ \thechapter:}{1em}{}
\titlespacing*{\chapter}{0pt}{-15pt}{25pt}
\setcounter{secnumdepth}{3} %Number to subsubsection and in TOC
\setcounter{tocdepth}{3}
\setlength\parindent{0.5in} %Paragraph indentation.
\captionsetup{belowskip=1pt,aboveskip=4pt}
\usepackage[bookmarks,hypertexnames=false,debug]{hyperref}
\usepackage[letterpaper,margin=1in,footskip=1.2cm,headheight=2cm,headsep=0.5cm]{geometry}
\usepackage{fancyhdr} %Encabezado.
\pagestyle{fancy}
\fancyhf{} % clear all header and footer fields
\fancyhead[LO,RE]{}
\fancyhead[LE]{School}
\fancyhead[RO]{Department}
\fancyfoot[LO,RE]{\small \thepage}
\fancyfoot[RO]{{\small\scshape\nouppercase{\leftmark}}}
\fancyfoot[LE]{{\small\scshape\nouppercase{\rightmark}}}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
\fancypagestyle{plain}{ % the preset of fancyhdr
\fancyhf{}
\fancyhead[LO]{}
\fancyhead[RO]{School}
\fancyfoot[C]{\small \thepage}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}}
\usepackage[spanish,tight]{minitoc} %Table of Contents per Chapter
%\addto{\captionsspanish}{\renewcommand{\mtctitle}{Another Title}}
\usepackage{bookmark}
\hypersetup{linkcolor=black}
\usepackage{fontspec} %Set a main font.
\setmainfont{Times New Roman}[SmallCapsFont=TeX Gyre Termes,SmallCapsFeatures={Letters=SmallCaps}]
\usepackage[spanish]{cleveref} %Fancy pantsy ref.
\Crefname{section}{Sección}{Secciones}
\Crefname{chapter}{Capítulo}{Capítulos}
\Crefname{table}{Tabla}{Tablas}
\Crefname{app}{Anexo}{Anexos}
\Crefname{graph}{Gráfico}{Gráficos}
%Hyphenation not included
\tolerance=1
\emergencystretch=\maxdimen
\hyphenpenalty=10000
\hbadness=10000
\usepackage{lipsum}
\begin{document}
\begin{appendices}
\pretocmd{\chapter}{%
\clearpage
\pagenumbering{arabic}%
\renewcommand*{\thepage}{\thechapter-\arabic{page}}%
}{}{}
\renewcommand\thetable{\thesection.\arabic{table}}
\renewcommand\thefigure{\thesection.\arabic{figure}}
\renewcommand\theequation{\thesection.\arabic{equation}}
\addtocontents{toc}{\cftpagenumbersoff{chapter}}
\chapter{Chapter 1}
\section{Section 1}
\lipsum[1-10]
\clearpage
\chapter{Chapter 2}
\section{Section 1}
\lipsum[10-30]
\end{appendices}
\end{document}
提前感谢您的帮助,问候。
答案1
您可以\clearpage
在发布之前添加\end{appendices}
。
只需执行\preto{\endappendices}{\clearpage}
,因为您已经在使用etoolbox
。
但是,minitoc
会添加一个虚假页面,而且我不知道除了在附录后添加材料(例如致谢等)外,还有什么可以补救。