4

I am using scrbook for my thesis (so no Titlesec) and would like to reformat the way paragraphs work in a very minor way: I need a symbol after the heading, with even spacing between the symbol and the following text. I am using this in a meaningful way (referring to sections within discussed works as I recap their contents), so resorting to other levels of sectioning is no good option.

Fooling around with various solutions for other related problems got me nowhere.

The result should look like:

Bacon is good | dolores has an ipsum in her amet ....

[with a bit more space around the "|"]

  • Welcome to TeX.SE. Just to make sure everyone is using the same terminology: By "paragraph", do you mean the LaTeX macro called \paragraph? Or are you referring to logical textual units called "paragraphs"? Please advise. – Mico Feb 3 '18 at 18:29
  • Sorry for the ambiguity - I meant the logical textual units, as in "one below \subsubsection". – Paul Burgh Feb 3 '18 at 19:12
3

I'm assuming that by the term "paragraph", you mean the LaTeX macro named \paragraph. Please advise if this is not what you have in mind.

Is the following close to what you had in mind?

enter image description here

\documentclass{scrbook}
\usepackage{letltxmacro}
\LetLtxMacro{\origpara}{\paragraph}
\renewcommand\paragraph[2][]{\origpara[#1]{#2}\quad\textbar\qquad}

\begin{document}
\paragraph{Bacon is good}Lorem ipsum \dots
\end{document}
  • 1
    The OP will probably want something smaller than \quad, but that is easily changed. +1 – ShreevatsaR Feb 3 '18 at 18:51
  • 1
    Thanks a lot - this was the easy solution I assumed existed and couldn't fathom. For completeness - I used hspaces now and it works perfectly. – Paul Burgh Feb 3 '18 at 19:09
4

You can redefine KOMA-Script command \sectioncatchphraseformat for paragraph:

\documentclass{scrbook}
\usepackage[T1]{fontenc}

\addtokomafont{paragraph}{\normalfont\itshape}% change font settings for paragraph heading
\RedeclareSectionCommand[afterskip=-.5em]{paragraph}% change horizontal skip after paragraph heading

\renewcommand{\sectioncatchphraseformat}[4]{%
  \ifstr{#1}{paragraph}
    {\hskip #2#3#4\hskip .5em{\normalfont\textbar}}% new definition for paragraph heading
    {\hskip #2#3#4}% orginal definition for other levels like subparagraph
}

\begin{document}
\paragraph{Bacon is good}Lorem ipsum \dots
\end{document}

Result: enter image description here

Note that the - in afterskip=-.5em means that the skip is horizontal. So there is a skip of .5em to the right of the paragraph heading. The default value for paragraph is afterskip=-1em.

  • Thanks! Good to have two different ways of achieving a similar result, in case there should be conflict etc. – Paul Burgh Feb 3 '18 at 22:05
1

For future reference: there was a bit of an oddity with the spacing, so I had to fiddle. The result I was looking for was achieved with the following:

\documentclass{scrbook}

\usepackage{letltxmacro}
\LetLtxMacro{\origpara}{\paragraph}
\renewcommand\paragraph[2][]{\origpara[#1]{#2}\hspace{-0.5em}$\mid$\hspace{0.em}}

\setkomafont{paragraph}{\normalfont\rmfamily\itshape}

\begin{document}
\paragraph{Bacon is good} \lipsum
\end{document}

enter image description here

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.