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
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
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}
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.
sectsty
is not included in the report
-class. It is a separate package, certainly included in most modern distributions.
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.