Featured Book

LaTeX Beginners Guide

Who is online

In total there are 14 users online :: 0 registered, 0 hidden and 14 guests (based on users active over the past 5 minutes)
Most users ever online was 1327 on Tue Nov 05, 2013 7:11 pm

Users browsing this forum: No registered users and 14 guests

Partner Sites

TeXwelt - Fragen und Antworten goLaTeX
TeXblog
TeXnicCenter
TeXample

Custom section headings

Add tags Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)

Custom section headings

Postby tkemeny on Tue Oct 27th, 2009

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  •  Open in writeLaTeX
\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
tkemeny
 
Posts: 2
Joined: Tue Oct 27th, 2009

Re: Custom section headings

Postby frabjous on Tue Oct 27th, 2009

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

Code: Select all  •  Open in writeLaTeX
\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
frabjous
 
Posts: 2065
Joined: Fri Mar 6th, 2009
Location: Amherst, MA

Re: Custom section headings

Postby localghost on Tue Oct 27th, 2009

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  •  Open in writeLaTeX
\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¹
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 13.1 (Linux 3.11.10), TeX Live 2013 (vanilla), TeXworks 0.5 (r1351)
² Posting stopped indefinitely due to offenses
User avatar
localghost
Site Moderator
 
Posts: 9219
Joined: Fri Feb 2nd, 2007
Location: Braunschweig, Germany

Re: Custom section headings

Postby tkemeny on Tue Oct 27th, 2009

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

Tom
tkemeny
 
Posts: 2
Joined: Tue Oct 27th, 2009


Return to Text Formatting

Who is online

Users browsing this forum: No registered users and 14 guests