Text FormattingLaTeX Error: Something's wrong--perhaps a missing \item

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
GleasSpty
Posts: 5
Joined: Sat Nov 28, 2009 6:17 pm

LaTeX Error: Something's wrong--perhaps a missing \item

Post by GleasSpty »

Here is the code for a minimal working example:

Code: Select all

\documentclass{article}

\begin{document}

\begin{center}
\section*{First Section}
\end{center}

Stuff in first section.

\begin{center}
\section*{Second Section}
\end{center}

Stuff in second section.

\end{document}
It throws me the error: "! LaTeX Error: Something's wrong--perhaps a missing \item."
If I remove the three lines:

Code: Select all

\begin{center}
\section*{Second Section}
\end{center}
then everything typsets fine.

What's going on here?

Thanks much.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

josephwright
Site Moderator
Posts: 814
Joined: Tue Jul 01, 2008 2:19 pm

LaTeX Error: Something's wrong--perhaps a missing \item

Post by josephwright »

You don't alter section formatting by sticking arbitrary bits of formatting code around it. You'll need some package help, for example the sectsty package.
Joseph Wright
User avatar
Stefan Kottwitz
Site Admin
Posts: 10397
Joined: Mon Mar 10, 2008 9:44 pm

LaTeX Error: Something's wrong--perhaps a missing \item

Post by Stefan Kottwitz »

Alternatively you could use the titlesec package. titlesec can center the sections, there's no need to put \centering before or center around, for example:

Code: Select all

\usepackage{titlesec}
\titleformat{\section}{%
\centering\normalfont\Large\bfseries}{\thesection}{1em}{}
The titlesec package provides an extensive documentation.

Stefan
LaTeX.org admin
Post Reply