273

3
+1  Q:

## How do you put a period after the section number using the article class?

I am using the article class with the code:

\documentclass[12pt]{article}

\begin{document}
\section{Foo}
This is an example of foo.
\section{Bar}
This is an example of bar.
\end{document}


This produces:

1 Foo

2 Bar

What I want is a period after the section number:

1. Foo

2. Bar

I cannot change away from the article class. How would I accomplish this?

A:

Not sure, since I have still no latex in my, reformatted, pc but it should be something like:

\def\thesection {\arabic{section}.}


You should put it in preamble of document. Absolutely not sure about correctness (no way to try it now).

Nope, this adds the period after a \ref{} as well.
+1  A:
\renewcommand{\thesection}{\arabic{section}.}

You do **NOT** want to do this! Definitely not the right answer: \documentclass{article} \begin{document} \renewcommand\thesection{\arabic{section}.} \section{foo}\label{foo} this is section~\ref{foo}.\end{document}
it worked, kind of. I wrote another line of code to remove the "." from the subsection command. Using just this line of code with the subsection command got me 2..1 Bar. I changed it though. it's hacky, but it worked.
+5  A:

Use the titlesec package and put in the preamble:

\titlelabel{\thetitle.\quad}

This is the right way to do it. I highly recommend titlesec.