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

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

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: 10324
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