8

I need to indent every \subsubsection element in my thesis.

I think that the solution is something like this

\renewcommand{\subsubsection}{some-magic-here}

but i'm new of Latex and I have no idea in what kind of magic. ;)

Could anyone help me?

8
  • 1
    What document class are you using?
    – egreg
    Jan 13, 2014 at 14:41
  • \documentclass[a4paper, 10pt]{article}
    – RikyTres
    Jan 13, 2014 at 14:44
  • 1
    Do you need to indent both the subsubsection header and the associated material (i.e., until a higher-level sectioning header is encountered), or just the header, or just the material? I guess I'm not sure what you mean by "element".
    – Mico
    Jan 13, 2014 at 14:46
  • 1
    I need to indent both header of subsubsection and its content.
    – RikyTres
    Jan 13, 2014 at 14:47
  • 2
    @RikyTres It's awful nonetheless.
    – egreg
    Jan 13, 2014 at 15:00

2 Answers 2

9

The result is awful and I can see no reason for wanting this. But the document is yours.

\documentclass{article}
\usepackage{changepage}

\usepackage{lipsum} % just for the example

\newenvironment{subs}
  {\adjustwidth{3em}{0pt}}
  {\endadjustwidth}

\begin{document}

\section{A section}

\lipsum[1]

\subsection{A subsection}

\lipsum[2]

\begin{subs}
\subsubsection{One}

\lipsum[3]

\subsubsection{Two}

\lipsum[4]

\end{subs}

\lipsum[5]

\end{document}

enter image description here

With the following change, the subsubsection titles will be flush with the left margin. The result is even more awful than before.

\documentclass{article}
\usepackage{changepage}

\usepackage{lipsum} % just for the example

\newenvironment{subs}
  {\adjustwidth{2pc}{0pt}}
  {\endadjustwidth}
\makeatletter
\renewcommand\subsubsection{%
  \@startsection{subsubsection}{3}
  {-2pc}% <------- The opposite of what we set for subs
  {-3.25ex\@plus -1ex \@minus -.2ex}%
  {1.5ex \@plus .2ex}%
  {\normalfont\normalsize\bfseries}}
\makeatother

\begin{document}

\section{A section}

\lipsum[1]

\subsection{A subsection}

\lipsum[2]

\begin{subs}
\subsubsection{One}

\lipsum[3]

\subsubsection{Two}

\lipsum[4]

\end{subs}

\lipsum[5]

\end{document}
5
  • If i want to leave the header of the sub subsection in its position?
    – RikyTres
    Jan 13, 2014 at 15:14
  • 3
    @RikyTres It's even worse. I'll add the code, but not a picture.
    – egreg
    Jan 13, 2014 at 15:19
  • The \adjustwidth seems not working with \titleformat{\subsubsection}[runin], it generates a weird error: "perhaps a missing \item". Nov 8, 2017 at 17:54
  • 1
    @YanKingYin That’s a very different problem, I believe. Please, ask a new question with all details.
    – egreg
    Nov 8, 2017 at 17:57
  • New question is here: tex.stackexchange.com/questions/400416/… Nov 9, 2017 at 0:13
4
\documentclass{article}
\usepackage{lipsum}
\makeatletter
\renewcommand\section{\leftskip 0pt\@startsection {section}{1}{\z@}%
                                   {-3.5ex \@plus -1ex \@minus -.2ex}%
                                   {2.3ex \@plus.2ex}%
                                   {\normalfont\Large\bfseries}}
\renewcommand\subsection{\leftskip 0pt\@startsection{subsection}{2}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {1.5ex \@plus .2ex}%
                                     {\normalfont\large\bfseries}}
\newcommand\Xsubsubsection{\@startsection{subsubsection}{3}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {1.5ex \@plus .2ex}%
                                     {\normalfont\normalsize\bfseries\leftskip 3ex}}
\renewcommand\subsubsection[1]{\Xsubsubsection{#1}\leftskip 3ex}
\makeatother
\begin{document}
\section{My section}

\lipsum[4]

\subsection{My subsection}

\lipsum[4]

\subsubsection{My subsubsection\label{xxx}}

In subsection \ref{xxx}, we have the indent.

\subsection{Next subsection}

\lipsum[4]

\section{next section}

\lipsum[4]
\end{document}

enter image description here

2
  • I've implemented this, but itemize lists within the subsections are not having the indent. Do you know how to fix that? Apr 16, 2021 at 10:59
  • @MosheSteinberg Without more information, it is tough to say. Apr 16, 2021 at 11:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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