在 Latex 中将一些章节居中

在 Latex 中将一些章节居中

在下面的代码中,我尝试将致谢、献词和简历章节居中。但是,当我使用\usepackage{sectsty}减小简历中各部分的字体大小时,这些章节并没有居中。

\documentclass[12pt,a4paper,twoside]{report} 
\usepackage[top=2.54 cm, bottom=2.54 cm, left=2.54 cm, right=2.54 cm]{geometry}

\usepackage{sectsty} % section font size
\usepackage{etoolbox}% % remove spaces before and after paragraph
\usepackage{setspace} % reduce space

\begin{document}
\chapter*{\centering{\MakeUppercase{Dedication}}}% center and make uppercase the title of chapter 

\begin{center} 
To my parents
\end{center}

\chapter*{\centering\MakeUppercase{Acknowledgments}} 

\chapter{chapter1}
\section{Introduction}

\chapter{chapter2}
\section{Introduction}

\makeatletter
\patchcmd{\@makechapterhead}{\vspace*{50\p@}}{}{}{}% Removes space above \chapter head
\patchcmd{\@makeschapterhead}{\vspace*{50\p@}}{}{}{}% Removes space above \chapter* head
\chapter*{\centering{\small CV}}
{\setstretch{1.0}
\begin{center}
         %\MakeUppercase{\textbf{Abstract}}\\
        \MakeUppercase{\textbf{ABC}}\\
                {DEF}\\
{Email: [email protected]\\
}
\end{center}
\sectionfont{\fontsize{12}{15}\selectfont} % section font reduce

\section*{EDUCATION}
\vspace{0.1in} 
\textbf{Ph.D. in Physics}, ABC University, USA, 2012}


\end{document}

任何在这方面提供的帮助都将受到高度赞赏。

答案1

这基本上就是我在评论中所说的内容。我保留了一些内容,但注释掉了,并附上了我自己的元注释,试图解释原因。我希望一切都清楚了。(如果没有,请告诉我。)

\documentclass[12pt,a4paper,twoside]{report}
\usepackage[top=2.54cm, bottom=2.54cm, left=2.54cm, right=2.54cm]{geometry}

\usepackage{sectsty}  % section font size
\usepackage{etoolbox} % remove spaces before and after paragraph
\usepackage{setspace} % control linespacing


\begin{document}
\tableofcontents

\chapterfont{\centering}% center \chapter
\chapter*{DEDICATION}%

\begin{center}
To my parents
\end{center}

\chapter*{ACKNOWLEDGMENTS}


\chapterfont{\raggedright}% revert \chapter to ragged right
\chapter{First Chapter}
\section{Introduction}

\chapter{Second Chapter}
\section{Introduction}

\makeatletter
\patchcmd{\@makechapterhead}{\vspace*{50\p@}}{}{}{}% Removes space above \chapter head
\patchcmd{\@makeschapterhead}{\vspace*{50\p@}}{}{}{}% Removes space above \chapter* head
\chapterfont{\small\centering}
\chapter*{CV}

{%\singlespacing % <-- single spacing is the default...

\begin{center}
  \textbf{ABC}\\
  {DEF}\\
  Email: [email protected]\\
\end{center}


\sectionfont{\normalsize} % section font reduce
\section*{EDUCATION}

%\vspace{0.1in}% <-- this adds 2.54mm ... needed?
\textbf{Ph.D. in Physics}, ABC University, USA, 2012}

\end{document}

相关内容