我正在努力寻找一种方法来自动将“部分”、“章节”和“小节”的首字母大写......到目前为止,我已经使用了一种手动解决方法“\texorpdfstring{\MakeUppercase Xx}”,它可以在文档正文中完成工作,但例如在 pdfbookmark 中它不再显示首字母。
有没有办法自动更改“第 I、II、III、IV、V 部分...”,章节和小节都以大写字母开头(仅限第一句),并且 pdfbookmark 之后也会正确显示在 pdf 上?附录也是如此...
谢谢大家!
\documentclass[oneside,11pt, a4paper, footinclude=true, headinclude=true, cleardoublepage=empty]{scrbook}
\usepackage[linedheaders,parts,pdfspacing,dottedtoc]{classicthesis}
\usepackage{amsmath}
\usepackage{acronym}
\usepackage[a4paper, hmargin={2.8cm, 2.8cm}, vmargin={2.5cm, 2.5cm}]{geometry}
\usepackage{eso-pic} % \AddToShipoutPicture
\usepackage{graphicx} % \includegraphics
\graphicspath{
{Pics/PDFs/}
{Pics/JPGs/}
{Pics/PNGs/}
}
\usepackage{color, colortbl}
\definecolor{LightCyan}{rgb}{0.88,1,1}
\definecolor{Gray}{gray}{0.9}
%\usepackage{subfig}
\usepackage{subcaption}
\usepackage{textcomp}
\usepackage{footnote}
\usepackage{verse}
\usepackage{hyperref}
\usepackage{cmap}
\usepackage[T1, T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{csquotes}
\usepackage{bookmark}
\usepackage{longtable}
\usepackage{array}
\usepackage{multirow}
\usepackage{times}
\usepackage{lingmacros}
\usepackage{color, colortbl}
\usepackage{tabularx}
\usepackage{pdfpages}
\usepackage{footnote}
\definecolor{mygray}{rgb}{0.86,0.86,0.86}
\makesavenoteenv{tabular}
\makesavenoteenv{table}
\renewcommand{\baselinestretch}{2.0}
\def\signed #1{{\leavevmode\unskip\nobreak\hfil\penalty50\hskip2em
\hbox{}\nobreak\hfil(#1)%
\parfillskip=0pt \finalhyphendemerits=0 \endgraf}}
\newsavebox\mybox
\newenvironment{aquote}[1]
{\savebox\mybox{#1}\begin{quote}}
{\signed{\usebox\mybox}\end{quote}}
\renewcommand{\cfttabpresnum}{} % get rid of "table"
\renewcommand{\cftfigpresnum}{}
\newcolumntype{S}{>{\footnotesize}l} % define a new column type for \small
\usepackage{mdframed}
\usepackage{array}
\usepackage{threeparttable}
\usepackage{graphicx}
\newcommand{\tabhead}[1]{\textbf{#1}}
\newcommand{\rothead}[1]{\rotatebox{45}{\tabhead{#1}}}
\usepackage{tipa}
\usepackage{tabularx}
\newcolumntype{Y}{>{\centering\arraybackslash}X}
\usepackage{breqn}
\usepackage{setspace}
%\doublespacing
% or:
\onehalfspacing
\usepackage{ragged2e}
%for R code
\usepackage{listings}
\lstset{ language=R,
basicstyle=\footnotesize\ttfamily, numbers=left,
stepnumber=5,
numbersep=5pt, backgroundcolor=\color{white}, frame=single,
captionpos=b, keywordstyle=\color{blue},
commentstyle=\color{red},
breaklines=true,
postbreak=\mbox{\textcolor{red}{$\hookrightarrow$}\space}}
%Box around fig
\usepackage{wrapfig, framed, caption}
%\usepackage[backend=biber,style=nature,dashed=false,sorting=nty, maxcitenames=2]{biblatex}
\usepackage[%
backend=bibtex % biber or bibtex
,style=authoryear % Alphabeticalsch
%,style=numeric-comp % numerical-compressed
,sorting=nyt % no sorting
,sortcites=true % some other example options ...
,bibencoding=ascii
,block=none
,indexing=false
,citereset=none
,isbn=true
,url=true
,doi=true % prints doi
,natbib=true % if you need natbib functions
]{biblatex}
\addbibresource{references.bib} %Imports bibliography file
\def \ColourPDF {Images/ku-farve.pdf}
\def \TitlePDF {Images/ku-en.pdf}
\subject{
\vspace{2.5cm}
% \scriptsize{A thesis presented to the Faculty of Science in partial fulfillment of the requirements for the degree} \\
\Large{Master of Science in } \\}
\title{
\vspace{1.0cm}
\Large{Title}
\vspace{0.5cm} \\}
\author{
\Large\textbf{Name Surname} \\
\texttt{email address}
\vspace{4.5cm} \\
\large{Supervisors: }\\
\textbf{Name surname}\\
\large{Co-supervisors: }\\
{\textbf{Name surname}\\\vspace{.01in}}
\textbf{Name surname}\\
\vspace{1cm} \\}
\date{October 20th, 2020}
\begin{document}
\pagenumbering{roman}
\AddToShipoutPicture*{\put(0,0){\includegraphics*[viewport=0 0 700 600]{\ColourPDF}}}
\AddToShipoutPicture*{\put(0,602){\includegraphics*[viewport=0 600 700 1600]{\ColourPDF}}}
\AddToShipoutPicture*{\put(0,0){\includegraphics*{\TitlePDF}}}
\clearpage\maketitle
\thispagestyle{empty}
\newpage
\include{FrontBackMatter/dedication}
\include{FrontBackMatter/acknowledgements}
\include{FrontBackMatter/abstract}
\include{FrontBackMatter/contents}
\include{FrontBackMatter/abbreviations}
%\include{FrontBackMatter/symbols}
\pagenumbering{arabic}
\part{Project description}\label{Part:I}
\include{Projectdescription/Introduction}
\include{Projectdescription/Background}
\part{\texorpdfstring{\MakeUppercase Da}ata validation and
\texorpdfstring{\MakeUppercase Li}ifetime Correction method}\label{Part:II}
\include{Datav_lifetime/Datavalidation} \label{chap:Datavalidation}
\include{Datav_lifetime/Methodology} \label{chap:Methodology}
\include{Datav_lifetime/Results0} \label{chap:Results0}
\part{\texorpdfstring{\MakeUppercase Pr}reliminary analysis}\label{part:III}
\include{PreliminaryAnalysis/Methodology1} \label{chap:Methodology1}
\include{PreliminaryAnalysis/CA} \label{chap:Results0}
\include{PreliminaryAnalysis/PCA} \label{chap:Results2}
\part{\texorpdfstring{\MakeUppercase Ap}ppendices} \label{part:VI}
\include{Appendices/AppendixA} \label{chap:appendixA}
\include{Appendices/AppendixB} \label{chap:appendixB}
\medskip
\printbibliography[
heading=bibintoc,
title={Bibliography}
]
\clearpage
\end{document}
答案1
你丢失了第一个字母,因为\texorpdfstring
它有两个参数,一个是文档的 tex 版本,另一个是 pdf 书签的版本,所以
\texorpdfstring{\MakeUppercase Li}ifetime
是
\texorpdfstring{\MakeUppercase{L}i}{i}fetime
并且用于书签的字符串中没有 L,您可以使用
\texorpdfstring{\MakeUppercase{L}i}{Li}fetime
但是(没有测试示例显示问题),这似乎相当于简单地使用
Lifetime
所以你\part
可以
\part{Data validation and Lifetime Correction method}