3

It seems a bit strange to me that when I write

\paragraph{Monkeys} Monkeys are non-hominoid simians ...

I get the word Monkeys twice. On the other hand if I write

\paragraph{Monkeys} are non-hominoid simians ...

There is an odd space between the words. paragraph example

Am I being crazy? Probably. But I would still appreciate advice on how to return that space to normal width. :)

MWE:

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage[latin1]{inputenc}

\begin{document}

\paragraph{Monkeys} are non-hominoid simians ...

\end{document}
  • 1
    An answer to this depends on the used document class, so please provide a complete minimal working example (MWE) that starts with \documentclass and ends with \end{document}. – Skillmon Sep 24 '18 at 18:19
  • @Skillmon Thanks for pointing that out. I've added an MWE. – Anonymous20DB28 Sep 24 '18 at 18:35
2

Without adding any packages, you could redefine \paragraph. The following is the original definition:

\renewcommand\paragraph
  {%
    \@startsection{paragraph}{4}{\z@}{3.25ex \@plus 1ex \@minus .2ex}{-1em}
      {\normalfont\normalsize\bfseries}
  }

The last argument of \@startsection in the first line controls the spacing (so the -1em). If it is negative the heading will be set in the same row as the start of the following text. And the value controls the horizontal space added after the title in that case. One could set it to -1ex for example to get reasonable output:

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage[latin1]{inputenc}

\makeatletter
\renewcommand\paragraph
  {%
    \@startsection{paragraph}{4}{\z@}{3.25ex \@plus 1ex \@minus .2ex}{-1ex}
      {\normalfont\normalsize\bfseries}
  }
\makeatother

\begin{document}

\paragraph{Monkeys} are non-hominoid simians ...

\end{document}

enter image description here

0

I'm not sure if this is a good case for (ab)using \paragraph.

Anyway, since you want a normal space after the heading, just tell it to LaTeX.

\documentclass[12pt]{article}

\makeatletter
\renewcommand\paragraph{%
  \@startsection{paragraph}% counter
  {4}% level
  {\z@}% indent
  {3.25ex \@plus 1ex \@minus .2ex}% space before
  {-\fontdimen2\font plus -\fontdimen3\font minus -\fontdimen4\font}% space after
  {\normalfont\normalsize\bfseries}% font
}
\makeatother

\begin{document}

\paragraph{Monkeys} are non-hominoid simians with some text after in order
to see whether the space participates to stretching or shrinking

\noindent\textbf{Monkeys} are non-hominoid simians with some text after in order
to see whether the space participates to stretching or shrinking

\paragraph{Monkeys} are non-hominoid simians ...

\noindent\textbf{Monkeys} are non-hominoid simians ...

\end{document}

enter image description here

In both cases, I have added a paragraph that emulates the preceding one with the \paragraph command, in order to see that the result is exactly the same.

Explanation: the “space after” parameter should be negative, to inform LaTeX we want an inline heading; the parameters \fontdimen2, \fontdimen3 and \fontdimen4 represent respectively the normal interword space, the amount of stretching and the amount of shrinking; with \font we refer to the current font (the one used after the heading).

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.