0

While trying to use the titlesec package to format subsection headings, I have run into some trouble. I need subsection headings formatted so that they are indented using the value that is set with the command \setlength{\parindent}{[some length]}, where [some length] is an arbitrary length.

More specifically, I would like to use something similar to this:

...
\usepackage{titlesec}
\titleformat{\subsection}[runin]{}{}{}{}[.]
\titlespacing{\subsection}{0em}{0ex}{1em}
...
\subsection{[subsection title]} Subsection text ...

in order to produce subsection headings that look like this:

[parindent-length space][subsection title]. Subsection text that is
not indented just like you would expect in a regular paragraph
lowtex
  • 165

1 Answers1

3

The following MWE will show how to indent \subsection content by \parindent.

\documentclass{article}

\usepackage{lipsum}
\usepackage{titlesec}
\titleformat{\subsection}[runin]{\itshape}{\thesubsection.}{3pt}{\space}[.]
\titlespacing*{\subsection}{\parindent}{1ex}{1em}

\setlength{\parindent}{4pc} % exaggerated for the example

\begin{document}

\section{Section Title}
\lipsum[1-2]
\subsection{Subsection Title} 
Subsection text goes here.
Subsection text goes here.
Subsection text goes here.
Subsection text goes here.
Subsection text goes here.

\lipsum[1-2]

\end{document}

You can see that the second argument of \titlespacing* is set to \parindent.

enter image description here

Without the setting of \parindent (which in the above code was just to emphasize the indentation), you get

enter image description here

egreg
  • 1,121,712
Jagath
  • 4,287