# How will I right align the chapter/section/subsection? [duplicate]

Possible Duplicate:

-

## marked as duplicate by lockstep, Werner, Marco Daniel, Gonzalo Medina, MicoMay 21 '12 at 20:43

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

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}

-
I use documentclass{report}. How can I install the package? From where will I get the pacakge? –  Vidhya May 21 '12 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 May 21 '12 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 May 21 '12 at 11:33
@royce sectstyis not included in the report-class. It is a separate package, certainly included in most modern distributions. –  Sveinung May 21 '12 at 19:10

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

\documentclass{report}

\makeatletter
\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@
}}
\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.

-