[Tex/LaTex] newcommand for subsubsubsection

macrossectioning

I have created a command for the subsubsubsection like:

\newcommand{\subsubsubsection}[1]{\paragraph{#1}\mbox{}\\}
\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{4}

But now I have a title with a long text.

I now the command \paragraph have \paragraph[short title]{title} version.

How can I modify my declaration to use both \subsubsubsection{title} and \subsubsubsection[short title]{title}?

Best Answer

Look in the class file for the definition of \paragraph; for instance, in article.cls you find

\newcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {1.5ex \@plus .2ex}%
                                     {\normalfont\normalsize\bfseries}}
\newcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
                                    {3.25ex \@plus1ex \@minus.2ex}%
                                    {-1em}%
                                    {\normalfont\normalsize\bfseries}}

What you want is to change sign to the value in the fourth argument to \@startsection and possibly changing the fifth argument to give smaller vertical space, so you add to your preamble something like

\makeatletter
\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
                                    {-3.25ex \@plus-1ex \@minus-.2ex}%
                                    {0.5ex \@plus .1ex}%
                                    {\normalfont\normalsize\bfseries}}
\makeatother
\let\subsubsubsection\paragraph

Adding \mbox{}\\ is definitely the wrong thing to do.

Related Question