2

In the following code, I am trying to center the acknowledgement, dedication, and cv chapters. However, when I use \usepackage{sectsty} to reduce the font size of sections in CV, these chapters donot get centered.

\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}

Any help in this regard will be highly appreciated.

1
  • 1
    I believe the command you want is \chapterfont{\centering} before the chapters that should be centered, and then \chapterfont{\raggedright} when you want to revert the behaviour. You are also using \centering wrong every time in the file you posted and should delete all occurrences (\centering is a "switch" not a command that takes an argument). Also delete your \MakeUppercase commands: If you are using \chapter*, then it is simpler to type the words in capitals directly. Other minor things could be improved on also: the \small, \vspace, e.g.
    – jon
    Feb 3, 2016 at 6:21

1 Answer 1

2

This is largely what I said in the comments. I left a few things "in" but commented out along with meta-comments of my own trying to explain why. I hope all's clear. (If not, let me know.)

\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}
2
  • I'd be inclined to use titlesec normally, but sectsty is certainly easier to use if it suits your needs.
    – jon
    Feb 4, 2016 at 4:41
  • 1
    @Metrics -- glad to help!
    – jon
    Feb 4, 2016 at 17:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .