我需要将章节名称在目录中显示为大写。我对 Latex 还不太熟悉,不太习惯使用此解决方案中介绍的补丁或宏目录中的大写章节和小节和这个解决方案大写章节标题 Tocstyle?。
因此,我想问一下是否有更简单的方法可以使目录中的章节标题大写,也许使用包tocloft
?
我还发现该hyperref
包会导致一些问题。请注意,我确实在主文档中使用了这个包,并且我也在我非常简单的 MWE 中加载了它(尽管没有专门使用它)。
妇女权利委员会:
\documentclass[a4paper,11pt,oneside]{book}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[T1]{fontenc} %help make sfdefault arial
\usepackage{hyperref}
\usepackage[auto]{chappg} %want to have page numbering per section this also works on equation numbering
\pagenumbering{bychapter}
\usepackage[titles]{tocloft}
\begin{document}
\tableofcontents
\addtocontents{toc}
\chapter{First chapter}
\section{first section}
\clearpage
\chapter{Second chapter}
\end{document}
编辑:
在尝试了 @fran 的解决方案后,我意识到我最初的问题并不完整。我还需要将目录中的参考资料和附录标题大写。似乎这里实现了相反的效果以大写形式打印参考书目标题,但在目录中将其显示为句子大小写但我的文档给出了环境错误apacite
。我在下面附上了更新的 MWE:
\documentclass[a4paper,11pt,oneside]{book}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[T1]{fontenc} %help make sfdefault arial
\usepackage{hyperref}
\usepackage[auto]{chappg} %want to have page numbering per section this also works on equation numbering
\pagenumbering{bychapter}
\usepackage[titles]{tocloft}
\usepackage[titletoc]{appendix} %want to display "appendix" before A,B,C etc. Use [title]
\usepackage[maxcitenames=2,
maxbibnames=99,
backend=biber,
citestyle=authoryear,
bibstyle=authoryear,
sorting=nyt, %sort by name title year
natbib=true,
giveninits=true,
hyperref
]{biblatex} % CustomBib
\begin{filecontents}{\jobname.bib}
@book{2000_adams_prob,
title={Urban stormwater management planning with analytical probabilistic models},
author={Adams, Barry J},
year={2000},
publisher={John Wiley and Sons, Inc., New York, NY (US)}
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\pagenumbering{roman}
\tableofcontents
\newpage
\pagenumbering{bychapter}
\chapter[CHAPS CHAPTER 2]{First chapter}
\section{first section}
\clearpage
\chapter[CHAPS CHAPTER 2]{Second chapter}
blabla bla \citep{2000_adams_prob}
\cleardoublepage
\printbibliography[heading=bibnumbered, title={References}]
\newpage
\begin{appendices}
\addtocontents{toc}{\cftpagenumbersoff{chapter}} %don't want to show the appendix page number in the Toc
\chapter[CHAPS FIRST APPENDIX]{First appendix}
\end{appendices}
\end{document}
答案1
像这样?
\documentclass[oneside]{book}
% small page, just for the screenshot
\usepackage[paperwidth=12cm,paperheight=9cm,margin=1cm,tmargin=-2cm]{geometry}
\usepackage{lipsum}
\usepackage[colorlinks]{hyperref}
\usepackage[auto]{chappg} %want to have page numbering per section this also works on equation numbering
\usepackage[titletoc]{appendix} %want to display "appendix" before A,B,C etc. Use [title]
\renewcommand\appendixtocname{APPENDICES}
\usepackage[style=authoryear, natbib=true ]{biblatex}
\begin{filecontents}{\jobname.bib}
@book{2000adams,
title={Urban stormwater management planning with analytical probabilistic models},
author={Adams, Barry J},
year={2000},
publisher={John Wiley and Sons, Inc., New York, NY (US)}}
\end{filecontents}
\addbibresource{\jobname.bib}
\def\mychapter#1{\chapter[\MakeUppercase{#1}]{#1}}
\pdfstringdefDisableCommands{\let\MakeUppercase\relax}
\defbibheading{xxx}[References]{\chapter*{References}
\addcontentsline{toc}{chapter}{REFERENCES}
\markboth{REFERENCES (twoside header)}{REFERENCES (oneside header)}}
\begin{document}
\frontmatter
\tableofcontents
\mainmatter
\mychapter{First chapter}
\section{first section}\lipsum[1][1-2]
\mychapter{Second chapter}\lipsum[2][1-2] \citep{2000adams}. \lipsum[3][1]
\printbibliography[heading=xxx]
% \newpage More bib ....\newpage Even more bib ... % just to test headers
\appendix\addappheadtotoc
\mychapter{First appendix} \lipsum[3][1-5]
\end{document}