Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does one change the \paragraph formatting in LaTeX

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.

like image 691
Brian M. Hunt Avatar asked Feb 12 '09 23:02

Brian M. Hunt


1 Answers

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
like image 68
Will Robertson Avatar answered Oct 08 '22 07:10

Will Robertson