Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm trying to change the format of a single section in my document.

The section is the introduction of my document, and therefore, I don't want it to be numbered.

I tried to define a new command

\newcommand{\ssection}[1]{%
  \section[#1]{\centering\normalfont\scshape #1}}

it works, however, I can't suppress the numbering.

share|improve this question
    
is there any reason you can't just use \section*? –  barbara beeton Jun 2 '12 at 14:35
    
I don't see why the section shouldn't be numbered, but I can understand if one wants it; however the heading should be in the same style as the others. So \section* with \addcontentsline should be all you need. –  egreg Jun 5 '12 at 9:12
add comment

2 Answers

With the help of the titlesec package you can define a command containing the format for special section(s) and another one for regular section(s) and change the formatting as required:

\documentclass{article} 
\usepackage{titlesec}

\newcommand\specialsection{%
  \titleformat*{\section}{\centering\scshape\Large}
}
\newcommand\regularsection{%
  \titleformat{\section}{\normalfont\Large\bfseries}{\thesection}{1em}{}
}

\begin{document}

\specialsection
\section*{Introduction}

\regularsection
\section{A Test Section} 
\section{Another Test Section} 

\end{document}

enter image description here

share|improve this answer
add comment

You can use \section* to set an unnumbered section. However, this also removes it from the ToC. To reinsert it, use \addcontentsline{toc}{section}{<name>}, like in the following minimal example:

enter image description here

\documentclass{article}
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\begin{document}
\tableofcontents
\section*{Introduction}\addcontentsline{toc}{section}{Introduction}
\lipsum[1-10]
\section{Another section} \lipsum[11-20]
\section{Yet another section} \lipsum[21-30]
\end{document}

The same would hold for other document classes (like book and report).

lipsum was used to generate dummy text, Lorem Ipsum style.

share|improve this answer
    
The question is not only about suppressing the section numbering; the section formatting also has to be changed. –  Gonzalo Medina Jun 5 '12 at 14:50
    
@GonzaloMedina: "Formatting" may be ambiguously used here. Depending on the users, \section* "formats" \section differently. –  Werner Jun 5 '12 at 15:54
1  
True, but if you look at the code snippet in the question, you'll see an attempt to center the title and a font change. –  Gonzalo Medina Jun 5 '12 at 15:57
    
@GonzaloMedina: Oh... –  Werner Jun 5 '12 at 15:58
add comment

Your Answer

 
discard

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.