2

Default latex unfortunately is very limited, and it ends at 3 (for example 1.0.0). How to go one point further? (1.0.0.0)

There is solution somewhere on stackexchange that turns paragraph into subsubsubsections:

\setcounter{secnumdepth}{4}
\titleformat{\paragraph}
{\normalfont\normalsize\bfseries}{\theparagraph}{1em}{}
\titlespacing*{\paragraph}
{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}

But results are far from expected.

How it should look:

1.0.0.0 Title
Body of paragraphs is here and it works fine

How it looks in reality:

1.0.0.0 Title Body of paragraphs is here and 
it looks terrible

2 Answers2

7

Default latex unfortunately is very limited,

everything has limitations but latex is not as you describe

and it ends at 3 (for example 1.0.0).

The standard book and report class has 6 levels of heading (chapter (0) through to subparagraph (5)) and article has 5 levels (missing chapter)

The level at which latex stops numbering headings is set by the counter secnumdepth which article sets to 3 so you want

\setcounter{secnumdepth}{4}

Then as documented \paragraph uses a run-in style you could use a package such as titlesec to declare it as a display heading, or simply copy the defintions from article.cls but change the sign to denote a display.

\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
% display heading, like subsubsection
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {1.5ex \@plus .2ex}%
                                     {\normalfont\normalsize\bfseries}}

enter image description here

\documentclass{article}

\makeatletter \renewcommand\paragraph{@startsection{paragraph}{4}{\z@}% % display heading, like subsubsection {-3.25ex@plus -1ex @minus -.2ex}% {1.5ex @plus .2ex}% {\normalfont\normalsize\bfseries}} \setcounter{secnumdepth}{4} \makeatother

\begin{document}

\section{aaa} aaa

\subsection{aaa} aaa

\subsection{aaa} aaa

\paragraph{aaa} aaa

\end{document}

David Carlisle
  • 757,742
3

You could use one of the KOMA-classes. They have a number of tools to adapt the sectioning commands

\documentclass{scrartcl}
\setcounter{secnumdepth}{4}
\RedeclareSectionCommand[runin=false,afterskip=0pt,afterindent=false]{paragraph}
\begin{document}
\section{abc}
some text
\paragraph{paragraph} 
some text 
\end{document}

enter image description here

But you should stop to believe that everything that doesn't look like you want it is "terrible". run-in headers are used in many places.

Ulrike Fischer
  • 327,261
  • 2
    It won't compile with article document class. Yeah I should choose my words more carefully, but I have spent last 2 hours doing this, and in Word it can be done in 30 seconds, so I'm really close to moving to south america and becoming a farmer. – PeterParker Oct 13 '21 at 18:18
  • 3
    well it only took me a minute to write the code above. And I could do it in a minute in other classes too. But you didn't provide a complete example and so nobody knows which class you are actually using. Be aware that LaTeX has a 30 year history, and so there are often various methods to achieve a goal. – Ulrike Fischer Oct 13 '21 at 18:27
  • @PeterParker From your questions and your comments on them that sounds like a good idea to me --- GOM – Peter Wilson Oct 13 '21 at 18:44