Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am trying to change the formatting of my chapter. The class i am using is report. I want it to be bold centered. I used the following but no effect. .

\renewcommand{\@makechapterhead}[1]{%
\vspace*{50\p@}%
{\parindent \z@ \raggedright \normalfont
\hrule
\vspace{5pt}%
\ifnum \c@secnumdepth >\m@ne
\huge\scshape \@chapapp\space \thechapter
\par\nobreak
\vskip 20\p@
\fi
\interlinepenalty\@M
\Huge \scshape #1\par
\vspace{5pt}%
\hrule
\nobreak
\vskip 40\p@
}}
\renewcommand{\@makeschapterhead}[1]{%
\vspace*{50\p@}%
{\parindent \z@ \raggedright
\normalfont
\hrule
\vspace{5pt}%
\interlinepenalty\@M
\Huge \scshape #1\par
\vspace{5pt}%
\hrule
\nobreak
\vskip 40\p@
}}
share|improve this question
    
I'd recommend using the sectsty package. –  Count Zero May 28 '12 at 14:13
2  
You only said that you want the chapter titles to be boldfaced and centered (and my answer shows one option to achieve this), but your code shows some rules and additional formatting. What exactly is the format you are looking for? –  Gonzalo Medina May 28 '12 at 15:02
    
My real problem is not on how to achieve the formating. but whatever change i make in makechapterhead is not being applied in my document. However, when i execute the example of Mr.Micro from scratch it works!What might be the problem>? –  MAS May 29 '12 at 5:56
add comment

2 Answers

As suggested in a comment, you can use the sectsty package:

\documentclass{report}
\usepackage{sectsty}
\usepackage{lipsum}% just to generate some text

\chapterfont{\centering}

\begin{document}

\chapter{Test Chapter}
\lipsum[4]

\end{document}

enter image description here

share|improve this answer
add comment

The following MWE takes your code as the starting basis. I've provided examples of both numbered and unnumbered chapter headings. The main changes, relative to the code you provided, are: (i) the two \raggedright directives have been replaced with \centering directives, (ii) the three \scshape instructions have been replaced with \bfseries instructions, and (iii) there's a little bit more vertical whitespace below the first \hrule and above the second \hrule statements. (Your code provides only 5pt of vertical separation, but I think that 12pt and 10pt, respectively, may be easier on the reader's eye. This is obviously a subjective decision and you should feel free to tweak the code further.) Hope this is what you're looking for.

\documentclass{report}
\usepackage{lipsum} % for filler text
\makeatletter
\renewcommand{\@makechapterhead}[1]{%
    \vspace*{50\p@}%
    {\parindent \z@ \centering \normalfont
    \hrule
    \vspace{12pt}%
    \ifnum \c@secnumdepth >\m@ne
        \huge\bfseries \@chapapp\space \thechapter
        \par\nobreak
        \vskip 20\p@
    \fi
    \interlinepenalty\@M
    \Huge \bfseries #1\par
    \vspace{10pt}%
    \hrule
    \vskip 40\p@
}}
\renewcommand{\@makeschapterhead}[1]{%
    \vspace*{50\p@}%
    {\parindent \z@ \centering
    \normalfont
    \hrule
    \vspace{12pt}%
    \interlinepenalty\@M
    \Huge \bfseries #1\par
    \vspace{10pt}%
    \hrule
    \vskip 40\p@
}}
\makeatother
\begin{document}
\chapter{Hello There!}
\lipsum[1]
\chapter*{Good Bye}
\lipsum[2]
\end{document}

First the numbered chapter style:

enter image description here

Second, the unnumbered chapter style:

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.