Section Heading Centering problem
If you want to centre your titles and make them blue, then redefine the title format using a package like titlesec
. If all your sections and subsections are going to be unnumbered, redefine them that way, also with titlesec
. If you don't want numbers in your table of contents, set the secnumdepth
to 0. Here's an example:
\documentclass{article}
\usepackage{xcolor}
\usepackage{titlesec}
\titleformat{\section}[block]{\color{blue}\Large\bfseries\filcenter}{}{1em}{}
\titleformat{\subsection}[hang]{\bfseries}{}{1em}{}
\setcounter{secnumdepth}{0}
\begin{document}
\tableofcontents
\section{Ukaaranta}
\subsection{Shabhu Harivat}
\section{Krostru Shabda}
\end{document}
(You can adjust the vertical spacing of the titles also with titlesec
using the \titlespacing
command.)
\begin{center} ... \end{center}
creates a list with centered items. It should not be used for headings.
\centering
works here, because you use \section*
which doesn't process the argument for TOC or page headers. Your code could be changed to:
\section*{\centering\textcolor{blue}{Ukaaranta }}
\subsection*{Shabhu Harivat}
\addcontentsline{toc}{subsection}{shambhu harivat}
\section*{\centering\textcolor{blue}{Krostru Shabda}}
For a consistent document you should create macros for the style, such as
\newcommand*{\sectioncolor}{blue}
\newcommand*{\sectionformat}{\centering\color{\sectioncolor}}
...
\section*{\sectionformat Ukaaranta}
This way you could change the style of the whole document at just one place.
For more possibilities have a look at the titlesec
package which provides many features for customizing style and spacing of headings.
Add the following to your preamble:
\usepackage{sectsty}
\sectionfont{\centering}
(Source)