3

I am using the titlesec package to adjust the spacing between paragraph-s. My command overwrites the whitespace in the runin part, however, and I don't know how to retrieve it. Compare the two parts of this image.

enter image description here

It is generated by the MWE below. I have happy with the vertical spacing in the second case---it uses medskipamount. However, I would like the default gap between the number and the text in the paragraph.

The titlesec documentation (Section 3.2) isn't so helpful on this matter. Any help from people here would be most appreciated!

I'd also like to know how to add a fullstop after the number automatically. I am not 100% decided on whether to include this or not, so I'd like an answer which explains both options.

MWE below.

\documentclass[]{article}

\usepackage{titlesec}

\begin{document}

    \section{Default Behaviour}
    
    \paragraph*{Paragraph 1}
    with runin
    
    \paragraph*{Paragraph 2}
    with runin
    
    \paragraph*{Paragraph 3}
    with runin
    
    
    \section{New Behaviour}
    
    \titlespacing{\paragraph}
    {0pt}{\medskipamount}{\smallskipamount}[what do I write in here?]
    
    \paragraph*{Paragraph 1}
    with runin
    
    \paragraph*{Paragraph 2}
    with runin
    
    \paragraph*{Paragraph 3}
    with runin

\end{document}

Update. The solution is super easy. The length before-sep is the vertical space before the paragraph but, very confusingly, after-sep is not the vertical space after the paragraph! Instead, it's the horizontal space after the title.

Pretty crazy use of terminology, but hey, hopefully this question will now be helpful to others!

1 Answer 1

3

How about this?

\documentclass{article}
\usepackage{titlesec}
\begin{document}

    \section{Default Behaviour}
    \paragraph*{Paragraph 1}
    with runin
    
    \paragraph*{Paragraph 2}
    with runin
    
    \paragraph*{Paragraph 3}
    with runin
    
    \section{New Behaviour}
    \titlespacing{\paragraph}{0pt}{\medskipamount}{*2.5}
    \paragraph*{Paragraph 1}
    with runin
    
    \paragraph*{Paragraph 2}
    with runin
    
    \paragraph*{Paragraph 3}
    with runin
\end{document}

enter image description here

See Add a period after each paragraph title for information about attaching a period to each paragraph title.

3
  • Ah, I'm dumb! I assumed that before-sep and after-sep were complimentary, since the names suggest this, and didn't read them carefully. But they aren't: the former is vertical spacing and the latter horizontal. It is much more natural for right to mean "spacing to the right", but oh well. Thanks for pointing this out!
    – Sam OT
    Jul 13, 2021 at 11:42
  • @SamOT, you are welcome!
    – citsahcots
    Jul 13, 2021 at 11:43
  • Incidentally, is *2.5, ie 2.5ex plus 0.25ex, the default? One thing that I hate about so many latex packages is that the authors forget to write what the defaults are...
    – Sam OT
    Jul 13, 2021 at 11:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .