Any package documentation that looks like this:


is considerably less helpful for the newbie (like me) than examples. It does not give the newbie reader much of a clue as to what exactly ought to be typed into a real document. Do I type in those angle braces? Curly braces? Square braces? What, precisely, goes inside any or all of these delimiters?

Examples are the way to document.

The titlesec documention does have examples at the end, but they are too few, and do not cover the case I'm interested in.

My question is this: what is a simple, straight-forward way to format section titles? There are several design requirements for my output:

  1. The section number should not be indented at all.
  2. The entire body of the section text should be indented similarly to what the enumerate package does, except that I would prefer normal prose paragraph indenting instead of newlines. That is, the first lines of paragraphs in the section are indented "twice", while the subsequent lines are only indented "once". Here "once" and "twice" mean relative to the section number.

I'm sure there's a way to do this, but my searching here and elsewhere has failed to uncover it. I'd be grateful for any assistance. Thanks in advance!

Here is a minimal almost-working example using the enumerate package. I could almost do it with this package, except for wanting bold section titles and so forth.



\item Section Title

This level has a great spacing from the 1. on the left to the first word ``This''. And then, if I want 
a hierarchy, the heading there, an `A.' in this case,
\item Subsection Title

is nicely lined up with the indented text above. However, I would like to change
this indenting to use normal prose paragraph indenting, such as

Normal paragraph prose indenting, where the first line is indented, and the rest of the paragraph is not. 
However, the non-indented text needs to be at the indentation of the ``This'' above, and the first lines need
to be indented one more slot, of the same width.


And here's a minimal working example I typed in in MS Word (naturally, I had to man-handle the indenting to be what I wanted):

Minimal Working Example in MS Word

  • 3
    You noticed titlesec has an appendix with examples, right? – Johannes_B Aug 9 '16 at 16:17
  • 3
    Completely unrelated and off-topic? Have you ever had a look at the tabu documentation? Or the lengthy TikZ manual? Or a nice ConTeXt reference? – Johannes_B Aug 9 '16 at 16:23
  • 5
    Ranting about software provided to you for free by people who were not paid for their effort is surely not a very practical way to get help. And speaking of examples, I don't see you having provided one so that people could perhaps help you with your problem. – Alan Munn Aug 9 '16 at 16:26
  • 3
    Please understand that almost everything related to LaTeX including packages, was made by voulanteers, and did it just to be kind to others. Please do not piss over somebodys attempt at making the life of others easier, especially when the attempt in question is one of the most used packages out there. If you feel that the documentation needs improvements, there are other ways to say this. The examples are in the documentation, along with information about using them, allthough they it might be better for them to be located along with the \titleformat-macro. – Runar Aug 9 '16 at 16:31
  • 4
    I think this question can easily be re-written without the initial documentation rant. Just ask what you want, period. – Werner Aug 9 '16 at 18:38

I am a bit unsure of how exactly you want these indentations to be, So I've created one where the section title would be at the same indentation-point across. The code is based on the example of a section given in the documentation section 9.1 A full example:


To get the same indentation-point, we need to calculate the width of the section-number, as these vary in width, depending on which number is being printed. (8 is wider than 1 in most fonts, and a 100 is ofcourse wider). This can be done with the command \widthof{content} from the calc-package. Then we set the length for the intendation to two \parindents, which is the length of a normal indent, minus the width of the section number.

But as the \parindent is not the same everywhere, and is zero within the \titleformat-macro, we need to calculate it outside of that. Therefore a new length is created, \anIndent, which captures that length.

To get the indentation you want, I grabbed the answer by Werner posted in Indent an entire paragraph / section?. This works across pages, and is easier to use that a minipage. It would ofcourse be great if there was some solution which worked without setting these macroes manually for every section.

Also, do you really want indentation of the first line? I don't think that is a very common way to do it. Normally, the first paragraph is not indented, only subsequent ones.

EDIT: I've now made a new environment, to make the syntax a bit better. It is based upon the adjustwidth-environment from the changepage-package. The new environment is called indentedSection and takes one argument, the number of indentations. 1 for section 2 for subsection and 3 for subsubsection. I also added support for subsubsection


enter image description here







    %Input #1: Level of indentation
        \hspace{\anIndent}% Indent first line
        \ignorespaces% Ignor any space at start of environment

| improve this answer | |
  • after seeing you edit to the post, I see that this is not what you are looking for. – Runar Aug 9 '16 at 17:17
  • If you could get the Lorem ipsum text to line up with the B in Baz, except for the first line, which is indented yet again, like it is down at "Nam dui" near the bottom, that'd be exactly what I'm looking for. – Adrian Keister Aug 9 '16 at 17:20
  • I made an edit, just to show something of what you are looking for. I am really not sure how to do it without minipages, which you of course do not want. I'll look into it, and see if I can help you. – Runar Aug 9 '16 at 17:33
  • I notice that the Baz section doesn't have new paragraph indenting like the Foo section does. Can the Baz section indent, say, the second paragraph the same way as the Foo section? – Adrian Keister Aug 9 '16 at 17:41
  • 2
    subsections are now working. I think this answer could be approved, to give a much better syntax, so you don't need to write \begin{adjustwidth}{3\anIndent}{} \hspace{\anIndent} \end{adjustwidth} every time. Dont use minipage for this, that was just a bad idea on my part. use the new code with adjustwidth. As explained in my answer, minipage doesn't work when the content is bigger than remaining space of the page. – Runar Aug 9 '16 at 17:51

Okay, here is a 27 page document explaining titlesec. (If that link doesn't work, try this one.) I'm reading it myself, now that I found it. It has your abominations, but it explains the abominations. That makes it all okay, right? There's also this website that also has an online LaTeX editor; it includes working examples you can open. I'm working on fixing the first link.

Example (direct quote): <command> is the sectioning command to be redefined, i. e., \part, \chapter, \section, \subsection, \subsubsection, \paragraph or \subparagraph.

Hope this helps! I'll keep looking for other resources.

Other Resources

Oh, and in light of Johannes_B's comment, here is the TikZ manual. Very lengthy, and extremely helpful (I just started learning TikZ/LaTeX and that manual is awesome. As well as the wikibook for LaTeX.) Here and here are two more LaTeX resources that are very handy. Here is documentation for Tabu. Finally, here is a TeX stack exchange question about documentation/resources for ConTeXt.

Note: This was posted before the OP updated his question to make it clear that he wanted a problem to be solved; not documentation.

| improve this answer | |

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.