1

I followed previous examples on here, but could not eliminate the newline after the subsubsection (I want it to runin just like paragraph does)

\documentclass[oneside,openany,openbib,11pt]{memoir}
\usepackage{titlesec}

\titleformat{\subsubsection}[runin]{\bfseries}{}{}{}[]
\titleformat{\paragraph}[runin]{\normalsize\itshape}{}{}{}[]

\begin{document}
\subsection{testing}
blah blah blah
\subsubsection{subtesting}\paragraph{further testing}blah blah blah

\end{document}
7
  • 2
    It is runin style, but \paragraph starts a new paragraph anyway.
    – egreg
    Commented May 11, 2016 at 16:46
  • How do I achieve them both on the same line? I want the subsection heading "subtesting" and then immediately on the same line in the paragraph style defined above "further testing"
    – J M
    Commented May 11, 2016 at 16:59
  • I'm not sure why you'd want to do it.
    – egreg
    Commented May 11, 2016 at 17:00
  • Because that is the style dictated by the paper I am working on...
    – J M
    Commented May 11, 2016 at 17:02
  • 1
    @JM Then \paragraph is not the command you want to use. Define your own
    – egreg
    Commented May 11, 2016 at 17:35

1 Answer 1

3

You can define your own command that calls \paragraph only when not immediately \subsubsection.

\documentclass[oneside,openany,openbib,11pt]{memoir}
\usepackage{titlesec}

\titleformat{\subsubsection}[runin]{\bfseries}{}{}{}[]
\titleformat{\paragraph}[runin]{\normalsize\itshape}{}{}{}[]

\makeatletter
\newcommand{\prg}[1]{%
  \if@noskipsec\textit{#1}\quad\else\paragraph{#1}\fi
}
\makeatother


\begin{document}

\subsection{testing}
blah blah blah

\subsubsection{subtesting}
blah blah
\prg{further testing}blah blah blah

\subsubsection{subtesting}\prg{further testing}blah blah blah

\end{document}

enter image description here

You must log in to answer this question.

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