0

I would like to define the paragraph section such that it starts with the paragraph symbol. What is missing in the following?

\documentclass{book}
\usepackage{fontspec}
\usepackage{titlesec}
\titleformat{\paragraph}[runin]
{\normalfont}
{\P}{0pt}{}[]
\titlespacing{\paragraph}
{0pt}{1.5ex plus .1ex minus .2ex}{.5em}

\begin{document}
\paragraph{}
Test.
\end{document}

1 Answer 1

1

Let's review the syntax for \titleformat:

\titleformat{<level>}[<type>]
  {<general settings>}
  {<instructions for numbered titles>}
  {<separation between number and title>}
  {<actions on the title>}
  [<final additions>]

Since \paragraph isn't numbered (by default), what you specify in the third mandatory argument is ignored.

If your aim is to just add ¶ at the beginning of the line:

\documentclass{book}
%\usepackage{fontspec}
\usepackage{titlesec}

\usepackage{lipsum}

\titleformat{\paragraph}[runin]
  {\normalfont}
  {}
  {0pt}
  {\P}
\titlespacing{\paragraph}
  {0pt}
  {1.5ex plus 0.1ex minus 0.2ex}
  {0.5em}

\begin{document}

\lipsum[1][1-3]

\paragraph{}
\lipsum[2][1-3]

\end{document}

I commented out fontspec because it's not necessary for the code to work. Instead I added lipsum to get some context.

enter image description here

But you don't need titlesec for this.

\documentclass{book}
%\usepackage{fontspec}

\usepackage{lipsum}

\newcommand{\mypara}{%
  \par
  \addvspace{1.5ex plus 0.1ex minus 0.2ex}
  \noindent\P\hspace{0.5em}\ignorespaces
}

\begin{document}

\lipsum[1][1-3]

\mypara
\lipsum[2][1-3]

\end{document}

The only difference is that you're not allowed to leave blank lines in input between \mypara and the following text.

You must log in to answer this question.

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