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 requested that my subsection titles look like this:

However, so far I didn't manage to achieve that. titlesec documentation didn't help much. The best I could get is something like this:

with \titleformat{\subsection[block]{\large\bfseries}{\thesubsection}{1ex}{}. I feel like I could remove indent of the block completely and then add \parindent to the title style, but that seems wrong to me.

I would really appreciate any help!


Edit. I managed to do this in a very ugly way:

\usepackage[compact]{titlesec}
\titleformat{\subsection}[block]
    {\large\bfseries}
    {\hspace{1cm}\thesubsection}
    {1ex}{}
\titlespacing*{\subsection}{0pt}{4em}{3em}

It somehow does what I need:

enter image description here

However, I feel bad for doing this. If there is any better way of doing this, it would be very helpful!

share|improve this question
1  
Why would it be bad? In my opinion, it is a valid and good way to do that. And me myself, I would not think about other variant but tweaking titlesec like this. –  tohecz Dec 24 '12 at 23:24
    
I don't know, it just doesn't seem right to me. I guess I should deal with it. Also, it's confusing that \hspace{\parindent} doesn't work, even though I did \setlength{\parindent}{1cm}. –  Kona-chan Dec 25 '12 at 12:42
add comment

1 Answer

Using the titlesec package, you can use your approach:

\titleformat{\subsection}[block]
    {\large\bfseries}
    {\hspace{1cm}\thesubsection}
    {1ex}{}

but I would like to present you another option, using the runin format (for a run-in title) and then, the first mandatory argument of \titleformat that allows you to specify (in the runin format) the indentation just before the title; a little example using some of your settings:

\documentclass{article}
\usepackage[compact]{titlesec}
\usepackage{lipsum}% just to generate some text for the example

\titleformat{\subsection}[runin]
  {\normalfont\Large\bfseries}{\thesubsection}{1em}{}[{\\[2em]}]
\titlespacing*{\subsection}{1cm}{4em}{0em}

\begin{document}

\section{Test Section}

\subsection{Test Subsection with a Long Title that Spans Two Lines}
\lipsum[4]

\end{document}

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

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.