# Styling an “article” document

I'm writing a document using the class article. There are some things I'd like to change, for example:

• Always center \section and \subsection titles without doing it manually each time using \begin{center} ... \end{center}
• decrease the spacing between list elements without writing \begin{enumerate}[itemsep=-1mm] each time.
• etc.

Where can I find instructions about this? I couldn't find a "manual" where I could look up all of the options and keys. In case there is not a manual, how could I achieve these results?

-
I'm afraid there's no comprehensive manual. The best approximation for a "do-it-all" is the documentation of memoir; indeed you can use memoir for an article. Simple changes to the section headings can be done with sectsty; more complex are done with titlesec. For lists the reference is enumitem (which you're already using). You might consult the "Breve guida" where some frequently used packages are described (in Italian). –  egreg Jun 8 '12 at 9:17
@egreg I've seen some quesitons about titlesec, it looks kind of complicated but I guess I'll have to look into it deeper now... :) –  Alenanno Jun 8 '12 at 9:22
I recommend to use the class scrartcl. It is well documented in the documentation scrguide (German) or scrguien (English). –  Marco Daniel Jun 8 '12 at 9:23
@MarcoDaniel I tried looking for the English guide, but I got this message: "Note: you requested the material at a path /macros/latex/contrib/koma-script/scrguien.pdf that doesn't exist. This is the closest directory." Where is it? –  Alenanno Jun 8 '12 at 9:32
@Alenanno: You can type texdoc scrguien –  Marco Daniel Jun 8 '12 at 10:31

For customizing sectional units you can use the sectsty package (for relatively "minor" changes) or the titlesec package; for customizing list-like environments, you can use the enumitem package; both enumitem and titlesec are very well documented and the documentations include numerous examples. Here's a little example illustrating the changes you mentioned in your question:

\documentclass{article}
\usepackage{titlesec}
\usepackage{enumitem}

\titleformat*{\section}{\centering\bfseries\Large}
\titleformat*{\subsection}{\centering\bfseries\large}

\setlist[enumerate]{itemsep=-1mm}

\begin{document}

\section{A test numbered section}
\begin{enumerate}
\item First item.
\item Second item.
\end{enumerate}
\subsection{A test numbered subsection}
\subsection*{A test unnumbered subsection}
\section*{A test unnumbered section}

\end{document}


The above approach applies mostly to standard document classes (book, article and report); other classes (memoir or the ones from the KOMA-Script bundle) have their own mechanisms; it should be noted, for example, that memoir or the KOMA-Script classes and titlesec are incompatible (See About memoir and titlesec incompatibility and About KOMA-Script and titlesec incompatibility).

Just for completeness's sake, I'll add one possible solution to both problems mentioned in the question but using the memoir document class. As I said before, now it's not advisable to use titlesec to customize the sectional unit headings, but to use the features provided by the class; I used the article class option and the prdedefined crosshead chapter style to get centered titles for sections (now produced using \chapter) and used \setsecheadstyle to center the subsection titles (now produced using \section); enumitem is still used to customize the enumerate environment:

\documentclass[article]{memoir}
\usepackage{enumitem}

\setlist[enumerate]{itemsep=-1mm}

\begin{document}

\chapter{A test numbered section}
\begin{enumerate}
\item First item.
\item Second item.
\end{enumerate}
\section{A test numbered subsection}
\section*{A test unnumbered subsection}
\chapter*{A test unnumbered section}

\end{document}


Using scrartcl from the KOMA-Script bundle, again using titlesec is not advisable, but you could use \sectfont instead:

\documentclass{scrartcl}
\usepackage{enumitem}

\renewcommand\sectfont{\centering\bfseries}
\setlist[enumerate]{itemsep=-1mm}

\begin{document}

\section{A test numbered section}
\begin{enumerate}
\item First item.
\item Second item.
\end{enumerate}
\subsection{A test numbered subsection}
\subsection*{A test unnumbered subsection}
\section*{A test unnumbered section}

\end{document}


As I used \sectfont, the changes will also affect subsubsections.

Finally, if you want to apply the changes to the amsart document class, you will only have to change the subsection formatting (section titles are centered by deafault in this class); the change can be done by redefining \subsection as implemented in amsart.cls, or using titlesec (as in the first example since titlesec is compatible with the AMS-family of document classes), or by patching this command with the help of, for example, the etoolbox package. A little example (lists have a more tight vertical spacing in this class so I left the modification commented):

\documentclass{amsart}
\usepackage{enumitem}

\makeatletter
\def\subsection{\@startsection{subsection}{2}%
\z@{.5\linespacing\@plus.7\linespacing}{.5\linespacing}%
{\normalfont\bfseries\centering}}
\makeatother
%\setlist[enumerate]{itemsep=-1mm}

\begin{document}

\section{A test numbered section}
\begin{enumerate}
\item First item.
\item Second item.
\end{enumerate}
\subsection{A test numbered subsection}
\subsection*{A test unnumbered subsection}
\section*{A test unnumbered section}

\end{document}


-
The list command is not working, weird... I am using \usepackage[shortlabels]{enumitem} if it means something. –  Alenanno Jun 8 '12 at 15:06
@Alenanno using the shortlabels option is not the cause of the problem (at least not with my example code); most probably you are using an outdated version of enumitem; the old syntax used \setenumerate, but this command is now deprecated and you should use the code as I posted it in my example. This is my version of enumitem (for comparison purposes): enumitem.sty 2011/09/28 v3.5.2 Customized lists. If outdated packages was not the problem, please edit your question adding a minimal, complete version of the problematic code. –  Gonzalo Medina Jun 8 '12 at 16:03
Err I hate to be a newbie, but where do I check the package version? :D Thank you for your patience! –  Alenanno Jun 8 '12 at 16:13
@Alenanno Add \listfiles somewhere in the preamble of your document; the only purpose of this command is to write a list of the files used and their versions in the output console and in the .log file. Process your document and then open the .log file and search for the section *File List*. –  Gonzalo Medina Jun 8 '12 at 16:17
Oh, yes mine is v2.2... Maybe I should update all of my packages. :) –  Alenanno Jun 8 '12 at 16:29