Text FormattingCustom section headings

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
tkemeny
Posts: 2
Joined: Tue Oct 27, 2009 5:32 pm

Custom section headings

Post by tkemeny »

Hi there. I'm submitting to a journal that wants me to format my sections as follows:

Sections - arabic numbered, all caps, centered
Subsections - alpha (bracketed), sentence case, centered
Subsubsections - roman (bracketed), sentence case, left aligned

I tried defining sections as follows:

Code: Select all

\def\thesection{\arabic{section}}
\def\thesubsection{(\alph{subsection})}
\def\thesubsubsection{(\roman{subsubsection})}
But this only gets me some of the way there. I get a period after the sub and subsubsections. For example, I get:

(a). title

instead of:

(a) title

So, first, how can I get rid of the unwanted period?

Second, how can I handle the centering without specifying it for each section?

Thanks very much.
Tom

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

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

User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Custom section headings

Post by frabjous »

You could use something like the titlesec package, e.g.:

Code: Select all

\usepackage{titlesec}
\renewcommand{\thesubsection}{(\alph{subsection})}
\renewcommand{\thesubsubsection}{(\roman{subsubsection})}
\titleformat{\section}%
  {\centering\uppercase}{\thesection}{0.5em}{}
\titleformat{\subsection}%
  {\centering}{\thesubsection}{0.5em}{}
\titleformat{\subsubsection}%
         {\raggedright}{\thesubsubsection}{0.5em}{}
Study its manual above for more info.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Custom section headings

Post by localghost »

Use the titlesec package and modify the standard formats as shown in Section 9.2 (Standard Classes, p. 26f). Here is a complete example.

Code: Select all

\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{babel}
\usepackage{titlesec}
\usepackage{blindtext}

\pagestyle{plain}

\titleformat{\section}{\normalfont\Large\filcenter\bfseries}{\thesection}{1em}{\uppercase}
\renewcommand{\thesubsection}{\alph{subsection}}
\titleformat{\subsection}{\normalfont\large\filcenter\bfseries}{(\thesubsection)}{1em}{}
\renewcommand{\thesubsubsection}{\roman{subsubsection}}
\titleformat{\subsubsection}{\normalfont\normalsize\bfseries}{(\thesubsubsection)}{1em}{}

\begin{document}
  \section{First Section}
    \blindtext

    \subsection{First Subsection}
      \blindtext

      \subsubsection{First Subsubsection}
        \blindtext
\end{document}
In opposite to frabjous I used a command provided by the package to center the section headings in order to avoid possible side effects. Moreover font sizes and series remain as in the standard formats.


Best regards and welcome to the board
Thorsten¹
tkemeny
Posts: 2
Joined: Tue Oct 27, 2009 5:32 pm

Re: Custom section headings

Post by tkemeny »

Thank you both for your comments. Thorsten, I followed your advice and it worked perfectly. This was a big help!

Tom
Post Reply