# Reduce spacing between two (custom) paragraphs in scrreprt

I have defined a custom paragraph named myparagraph to use it as a small, unnumbered headline within my document. The reason is that I like the font of the paragraph heading, which is not as bold as compared to \textbf{}.

Now I have just realized that each new use of myparagraph leaves a little bit too much vertical space, see the following picture with the gap in red:

I need to control this gap, either globally, or locally between these two myparagraphs (maybe use half the value which is used now, or something close, in order to save space) by redefining myparagraph somehow.

edit: If you got a different solution feel free to post it. It doesn't strictly have to be a redefinition of paragraph.

edit2: The headlines should not be part of the TOC. They are supposed to be very simple headlines on the lowest level so to say, nothing more.

The code is quite simple:

\documentclass[a4paper, 12pt, headsepline, headings=small,]{scrreprt}
\usepackage[onehalfspacing]{setspace}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{mathptmx}
\usepackage[a4paper,showframe]{geometry}
\geometry{left=2cm,right=5cm,top=2cm,bottom=2cm}
\usepackage[pangram]{blindtext}

\newcommand{\myparagraph}[1]{\paragraph{#1}\mbox{}\\[3pt]}

\begin{document}

\myparagraph{Test}
\Blindtext[1][1]
\myparagraph{Test}
\Blindtext[1][1]
\textbf{}
\end{document}


error log:

! Undefined control sequence.
<argument> \subparagraphnumdepth

-
Since you are using a KOMA-Script class: Why don’t you apply the specific macro \minisec? (Without testing: It may be though, the gap would be still too big for you.) –  Speravir Jan 10 at 22:24
@Speravir thanks for the hint. I tried it and the font seems to be the same as in paragraph which is good. The distance is also smaller which is even better. However I'd really like to set the distance to specific values, which might differ between cases. –  TomM Jan 10 at 22:33
Sans serif fonts are the default for every title level in KOMA-Script. What I’ve forgotten to mention: Minisecs aren’t by default thought to be listed in the table of contents (could be overruled with \addtocontents or \addcontentsline). –  Speravir Jan 10 at 22:41
@Speravir That's fine in my case as I don't want these headlines to be in the TOC :) They are supposed to be simple headlines on the lowest level. I will edit this in the description. –  TomM Jan 10 at 22:52
@TomM Update your Koma-Script suite. –  egreg Jan 11 at 16:19

A solution with \minisec, a specific KOMA-Script command, that probably suites better here for the assumed usage:

\documentclass[12pt, headsepline, headings=small,]{scrreprt}
\usepackage[onehalfspacing]{setspace}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{mathptmx}
\usepackage[a4paper,showframe]{geometry}
\geometry{left=2cm,right=5cm,top=2cm,bottom=2cm}

\usepackage{kantlipsum}% another package for dummy text

\let\OrigMinisec\minisec
\renewcommand{\minisec}[2][0pt]{\vspace{#1}\OrigMinisec{#2}}

\begin{document}

\kant[1]
\minisec{Minisection 1}
\kant[2]
\minisec[-1ex]{Minisection 2}
\kant[3]
\minisec[-0.75\baselineskip]{Minisection 3}
\kant[4]
\minisec[2ex]{Minisection 4}
\kant[5]
\end{document}


According to the definition in the class by default (i.e. when you leave out the optional argument of the redefined version) a vertical skip of 1.5ex is added above minisections.

-
Thanks, that's perfect for my purpose :) –  TomM Jan 10 at 23:15

Just redefine \paragraph to do what you want.

\documentclass[a4paper, 12pt, headsepline, headings=small,]{scrreprt}
\usepackage[onehalfspacing]{setspace}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{mathptmx}
\usepackage[a4paper,showframe]{geometry}
\geometry{left=2cm,right=5cm,top=2cm,bottom=2cm}
\usepackage[pangram]{blindtext}

\makeatletter
\renewcommand{\paragraph}{%
\@startsection{paragraph}{\paragraphnumdepth}%
{\z@}% title indentation
{-3pt \@plus -1pt \@minus -1pt }% negative values suppress indent on next paragraph
{3pt \@plus 1pt \@minus 1pt }% positive value makes a line break after the title
{\raggedsection\normalfont\sectfont\nobreak\size@paragraph}%
}
\makeatother

\begin{document}

\paragraph{Test}
\Blindtext[1][1]
\paragraph{Test}
\Blindtext[1][1]
\textbf{}
\end{document}


If you want to keep \paragraph, redefine \subparagraph:

\documentclass[a4paper, 12pt, headsepline, headings=small,]{scrreprt}
\usepackage[onehalfspacing]{setspace}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{mathptmx}
\usepackage[a4paper,showframe]{geometry}
\geometry{left=2cm,right=5cm,top=2cm,bottom=2cm}
\usepackage[pangram]{blindtext}

\makeatletter
\renewcommand{\subparagraph}{%
\@startsection{subparagraph}{\subparagraphnumdepth}%
{\z@}% title indentation
{-3pt \@plus -1pt \@minus -1pt }% negative values suppress indent on next paragraph
{3pt \@plus 1pt \@minus 1pt }% positive value makes a line break after the title
{\raggedsection\normalfont\sectfont\nobreak\size@paragraph}%
}
\makeatother

\begin{document}

\subparagraph{Test}
\Blindtext[1][1]
\subparagraph{Test}
\Blindtext[1][1]
\textbf{}
\end{document}


The output is just the same as before.

-
But thanks for your entry egreg. It's also good to know how to redefine paragraph globally –  TomM Jan 10 at 23:17
@TomM Do you plan to use \subparagraph? –  egreg Jan 10 at 23:22
@TomM Then redefine \subparagraph! Just add sub` everywhere. –  egreg Jan 10 at 23:30
@TomM I added the code. –  egreg Jan 11 at 0:23