TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
    \section*{\textcolor{blue}{Ukaaranta }}
    \subsection*{Shabhu Harivat}
    \addcontentsline{toc}{subsection}{shambhu harivat} 
    \section*{\textcolor{blue}{Krostru Shabda}}

I have a need to create something like this, however when I run this program, it gives error at the second "\end{center}" Funny but the same command works above. did not do anything different just copy pasted and changed the text. Similar commands on elsewhere in the document work just fine. I have no clue why its behaving like this. Hit ? and R - enter and it gives the desired output but its a pain to do that every-time. Thanks for your help

share|improve this question
up vote 20 down vote accepted

If you want to centre your titles and make them blue, them 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:

    \subsection{Shabhu Harivat}
    \section{Krostru Shabda}

(You can adjust the vertical spacing of the titles also with titlesec using the \titlespacing command.)

share|improve this answer

\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

\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.

share|improve this answer
Worked like a charm – Aku Jan 9 '11 at 13:20
Instead of "\section*{\centering\textcolor{blue}{Ukaaranta }}", can we use – Groups Nov 17 '15 at 12:02

Your Answer


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.