4

Possible Duplicate:
Right-align chapter/section/subsection header

I need to align the chapter and its heading to the right. Please help me with it

2
  • Which documentclass do you use: book, memoir, scrbook, or something else?
    – Mico
    Commented May 21, 2012 at 10:17
  • I use report. I am writing a thesis
    – Vidhya
    Commented May 21, 2012 at 10:31

2 Answers 2

6

Assuming you're using a documentclass such as report or book, you could load the sectsty package with the command

\usepackage{sectsty}

and insert the instruction

\chapterfont{\raggedleft}

in the preamble to get chapter headers to be right-aligned. To get all levels of sectioning headers in this style, issue the command

\allsectionsfont{\raggedleft}
4
  • I use documentclass{report}. How can I install the package? From where will I get the pacakge?
    – Vidhya
    Commented May 21, 2012 at 10:32
  • Dont worry it is not a package.. It is included in the report class already.. Just run it. It should work..
    – royce
    Commented May 21, 2012 at 10:43
  • If you use a TeX distribution such as TeXLive, the sectsty package should already be loaded. If you use MiKTeX, its package autoloader should download and install the package the first time it's encountered. I've added an explanation of how to load the sectsty package to my answer.
    – Mico
    Commented May 21, 2012 at 11:33
  • @royce sectstyis not included in the report-class. It is a separate package, certainly included in most modern distributions.
    – Sveinung
    Commented May 21, 2012 at 19:10
2

If you cannot install the sectsty-package, you can also hack the definitions of \@makechapterhead and \@makeschapterhead:

\documentclass{report}

\makeatletter
\def\@makechapterhead#1{%
  \vspace*{50\p@}%
  {\parindent \z@ \raggedleft
    \normalfont
    \ifnum \c@secnumdepth >\m@ne
      \huge\bfseries \@chapapp\space \thechapter
      \par\nobreak
      \vskip 20\p@
    \fi
    \interlinepenalty\@M
    \Huge \bfseries #1\par\nobreak
    \vskip 40\p@
  }}
\def\@makeschapterhead#1{%
  \vspace*{50\p@}%
  {\parindent \z@ \raggedleft
    \normalfont
    \interlinepenalty\@M
    \Huge \bfseries  #1\par\nobreak
    \vskip 40\p@
  }}
\makeatother

\begin{document}
\chapter*{Test}
\chapter{Introduction}
\end{document}

The code is borrowed from Vincent Zoonekynd and slightly modified.

0

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