Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm trying to redefine the \subsubsection of the report class to behave like \paragraph and not have a linebreak after the title.

It's closely related to this question but I have no idea how to extrapolate the reverse effect from it.

I tried to get the code for paragraph using \show\paragraph and redifining \subsubsection with it as follows, but although it does compile, it doesn't work when I try to use it.

\renewcommand{\subsubsection}{\long macro :->\@startsection{subsubsection}{4}{\z@ }{3.25ex \@plus 1ex \@minus .2ex}{-1em}{\normalfont \normalsize \bfseries}}

I'm would like to know how to solve my original problem, but now, I'm also curious as to what I did wrong with that \renewcommand since it seems to me like I'd encounter it again with other problems I'd try to solve by modifying how latex does its thing.


\RequirePackage[l2tabu, orthodox]{nag}



%\renewcommand{\subsubsection}{\long macro :->\@startsection{subsubsection}{4}{\z@ }{3.25ex \@plus 1ex \@minus .2ex}{-1em}{\normalfont \normalsize \bfseries}}


\chapter{Chapter 1}

\section{Section 1}

\subsection{Subsection 1}

\subsubsection{\lstinline{<Upper|Lower> Triangular}} defines a triangular matrix ...

share|improve this question
Use the titlesec package to (re-)define macros like that. See Defining custom sectioning commands. –  Martin Scharrer Jul 7 '11 at 20:34
Also the \long macro :-> is part of the \show output and not part of the definition, i.e. you should delete it. –  Martin Scharrer Jul 7 '11 at 20:35
@Martin: Sorry, I saw your second comment only after I posted my answer. –  Michael Ummels Jul 7 '11 at 20:43
@Michael: No problem. –  Martin Scharrer Jul 7 '11 at 20:45
@Martin: I saw the titlesec package in the question I linked, and I guess I could (should?) have looked deeper into that packages. But at this point, my curiosity on how to redefine the code won over practicality :-/ –  Lexiel Jul 7 '11 at 20:55
add comment

3 Answers

up vote 7 down vote accepted

The output of \show cannot be used as you are trying. It says that \subsection is a "long" macro that has no arguments and the replacement text is what follows ->.

The right place where to look is report.cls, where you find

                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {1.5ex \@plus .2ex}%
                                    {3.25ex \@plus1ex \@minus.2ex}%

The key point that explain the different behavior are: the negative fourth argument of \@startsection for \subsubsection which suppresses indentation of the following paragraph; the positive fifth argument tells TeX that the title will not be "run-in". So

  \@startsection{subsubsection}{3}{\z@}{3.25ex \@plus1ex \@minus.2ex}%

The second argument to \@startsection tells LaTeX the level of the sectioning command for the purposes of secnumdepth and tocdepth and should stay 3.

Important note

The \makeatletter and \makeatother commands are necessary because we are doing stuff involving the internal command of LaTeX.

Every time a command containing @ in its name has to be used, the code must either be in a .sty file or surrounded by that pair. See What do \makeatletter and \makeatother do? for more information.

share|improve this answer
To see the definition you can also use texdef -t latex -c report subsubsection paragraph (or latexdef instead texdef -t latex if that symlink is installed). However, looking into the source file directly has the benefit that you see the code as it was formatted by the author. –  Martin Scharrer Jul 7 '11 at 20:46
@Martin: but it uses the same output as \show. I think that the main part of my answer is to explain what went wrong to begin with. –  egreg Jul 7 '11 at 20:47
Thanks a lot for all the details, I'm now a little less ignorant in the ways of latex :) –  Lexiel Jul 7 '11 at 20:51
@egreg: Indeed (I actually added that to my comment while you were responding ;-) ). I just wanted to point the possibility out, nothing against the answer. –  Martin Scharrer Jul 7 '11 at 20:51
add comment

\long macro :-> is not part of the definition of the macro, and you need to change the catcode of @ in the definition. The following should work:

  {3.25ex \@plus 1ex \@minus .2ex}{-1em}{\normalfont\normalsize\bfseries}}
share|improve this answer
add comment

If you prefered not to do things manually, you can use the titlesec package whose usage is described in this question: Defining custom sectioning commands

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.