0

I know that I can it with \mbox{}\\ (\paragraph{}\mbox{}\\) but that's kinda messy and using titlesec to redefine \paragraph{} doesn't cut it for me either, because I most of the time want to have text right after the \paragraph{}. Is there any other way?

1
  • 1
    all latex headings can be declared as run-in or block, the standard classes declare paragraph as run-in but you can redeclare them by copying the the line and changing it or using a package such as titlesec to redeclare the heading, but other classes like koma script or memoir have their own methods of declaring headings so the details depend on the class you are using May 2, 2020 at 16:40

2 Answers 2

4

All latex headings can be declared as run-in or block, the standard classes declare paragraph as run-in but you can redeclare them by copying the the line and changing it or using a package such as titlesec to redeclare the heading, but other classes like koma script or memoir have their own methods of declaring headings so the details depend on the class you are using.

If using the standard classes you can just copy the definition of \paragraph and change the signs of two arguments to make a display heading with no indent in the following text.

enter image description here

\documentclass{article}
\makeatletter
% original definitions
%\newcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
%                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
%                                     {1.5ex \@plus .2ex}%
%                                     {\normalfont\normalsize\bfseries}}

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

\newcommand\dparagraph{\@startsection{paragraph}{4}{\z@}%
                                    {-3.25ex \@plus-1ex \@minus-.2ex}% negative so no indent
                                    {1.5ex \@plus .2ex}% positive so display heading
                                    {\normalfont\normalsize\bfseries}}
\makeatother

\begin{document}

\dparagraph{Myparagraph} Some text.

\paragraph{Paragraph} Some text.

\end{document}
1

It seems that you want two different \paragraph formats. Try this:

% paraprob.tex SE 541902 newline or not after \paragraph
\documentclass{article}
\newcommand{\myparagraph}[1]{\paragraph{#1}\mbox{}\\}

\begin{document}

\myparagraph{Myparagraph} Some text.

\paragraph{Paragraph} Some text.

\end{document}
4
  • 1
    hmm this would allow page breaking after the heading, and not allow the common input form of having a blank line before the paragraph text May 2, 2020 at 17:23
  • @DavidCarlisle OK, I would go with your superior knowledge. May 3, 2020 at 18:23
  • @DavidCarlisle I just thought that my solution was simpler as it avoided messing with LaTeX internals. May 3, 2020 at 18:29
  • I need an additional level in my headings structure, so I use \paragraph. Unfortunately it does not look like my other headings - the horizontal space differs. Definition of my \subsubsection: \RedeclareSectionCommands[beforeskip=-.5\baselineskip,afterskip=.25\baselineskip]{subsubsection} Definition of my \myparagraph: \newcommand{\myparagraph}[1]{\paragraph{#1}\mbox{}\\ \hspace{0.25ex}} Alternative definition (does not work, too): \RedeclareSectionCommands[beforeskip=-.5\baselineskip,afterskip=.25\baselineskip]{myparagraph} Can anybody help, please?
    – TRJW
    Sep 13, 2020 at 8:42

You must log in to answer this question.

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