# What does this custom section command do?

I'm trying to custom the sections of a paper. Each major section must begin with a Heading in 10 point Times New Romana font centered within the column and numbered using Roman numerals followed by a period, two spaces, and the title using an initial capital letter for each word. The remaining letters must be in small capitals (8 points).

Until now, I've done this configuration:

\def\thesubsection{\mbox{\Alph{subsection}.}}
\def\thesection{\Roman{section}.}


Looking for examples, I've found the following custom command:

\def\section{\@startsection{section}{1}{\z@}{3.0ex plus 1.5ex minus 1.5ex}
{0.7ex plus 1ex minus 0ex}{\normalfont\normalsize\centering\scshape}}


But I have no idea what this command does. My idea is to adapt it to the requirements I have. But, firstly, I must understand it. Could you someone help me to understand what does exactly this command do?

• I see no reason for the \mbox in the first definition (it's actually wrong, for a few reasons). – egreg Oct 31 '17 at 17:07
• Search is your friend: tex.stackexchange.com/questions/31780/… – Steven B. Segletes Oct 31 '17 at 17:09
• Which document class do you use? KOMA-Script, for example, has separate commands for changing the way the headings look like. – Matthias Oct 31 '17 at 17:10
• The first definition I've copied from IEEEtran class. Actually, I don't know why it is using the \mbox – tnas Oct 31 '17 at 17:13
• @Matthias: I'm writing my own class. These configurations have been added to my class. – tnas Oct 31 '17 at 17:17

Note that the first group of macros you've posted -- \thesection and \thesubsection -- starts with \the. The second group, which features just \section in your query, but which presumably could show \subsection as well, determines the way sectioning headers are displayed. The \@startsection macro, which shows up in the definition of \section (and \subsection too), is a very versatile low-level LaTeX macro.

The first group of macros, in contrast, determines solely the way the section and subsection "numbers" are displayed. The section numbers will be displayed as uppercase-Roman numerals followed by a . (dot), i.e., as I., II., III., etc. The subsection numbers will be displayed as uppercase-Alphabetic characters followed by a ., i.e., as A., B., C., etc.

I would argue that the definitions of both \thesection and \thesubsection contain a subtle but significant error: the presence of .. This is going to make generating cross-references to sections and subsections a miserable and unsightly affair. A separate comment: There simply cannot be a decent justification for the \mbox wrapper.

You also wrote:

Each major section must begin with a Heading in 10 point Times New Romana font centered within the column and numbered using Roman numerals followed by a period, two spaces, and the title using an initial capital letter for each word. The remaining letters must be in small capitals (8 points).

It is grossly inefficient to try to achieve your formatting objectives by modifying low-level LaTeX macros. Instead, load a package such as sectsty. Then, assuming the main document font is Times Roman and the main font size is 10pt, issue the instruction

\sectionfont{\centering\mdseries\scshape\normalsize\}


in the preamble.

To take care of the stipulation that the section- and subsection-level "numbers" -- uppercase-Roman numerals and uppercase-Alphabetic letters, really -- must be terminated by a . inside the sectioning headers, followed by two spaces, I suggest you provide the following code (also in the preamble):

\makeatletter
\def\@seccntformat#1{\@ifundefined{#1@cntformat}%

detailed documentation for \@startsection can be found in the file classes.pdf, accessible with texdoc classes, in section 7.2.
this formulation is used by all the "basic" latex classes, and by some other document classes that adhere to the basic structures. (the ams classes follow this structure, but i am not sure about the koma classes, for instance, nor the IEEEtran class.)
the actual definition is in the file ltsect.dtx (in the directory TEXMF/source/latex/base in a tex live distribution), but i haven't succeeded in finding the pdf file that makes that easily readable by a human.