How does one change the \paragraph formatting in LaTeX

Brian M. Hunt picture Brian M. Hunt · Feb 13, 2009 · Viewed 31.9k times · Source

This stems out of How can one number paragraphs in LaTeX?, which I asked earlier today:

Running with Brent.Longborough's suggestion for how to number paragraphs in a document:

\setcounter{secnumdepth}{5}
...
\paragraph{If we want to}
\paragraph{do something}

This results in LaTeX producing something likeso:

0.0.0.1 If we want to 
0.0.0.2 do something

How can one change the numbering scheme of \paragraph{} to produce something like:

1. If we want to
2. do something

or alternatively

A. If we want to
B. do something

Thank you.

Answer

Will Robertson picture Will Robertson · Feb 13, 2009

To change the number referenced when referring to paragraphs, you want to change \theparagraph. Here's an example:

\documentclass[12pt]{article}
\setcounter{secnumdepth}{5}
\renewcommand\theparagraph{\roman{paragraph}}
\usepackage{lipsum}
\begin{document}
\paragraph{foo} \lipsum[1]
\paragraph{bar} \lipsum[2]
\end{document}

Instead of \roman you can also use \Roman, \arabic, \alph, \Alph. Although if you have lots of paragraphs you'll want to use the alphalph package and use \alphalph to get more than 26 paragraphs.

Note that \paragraph takes an argument for the "paragraph title". If you never want that, you'll probably want to define your own command to simplify things:

\newcommand\PARA{\paragraph{}}

You'll also probably want to remove the way that paragraphs are numbered "within" sections; i.e., they reset from "1" for every new section. You can get around this with something like

\usepackage{remreset}
\makeatletter
\@removefromreset{paragraph}{section}
\makeatother