1

I would like to center the title of my \paragraph command to have a display like this : enter image description here

I tried to use the \paragraph{\centering paragraph's title} but it does not work. I am looking for a way to customize the \paragraphcommand without using ConTeXt.

Thank you for your help, have a good day.

2
  • @Christian ok so what is the correct name of the \section and \paragraph objects?
    – user178668
    Jan 2, 2019 at 17:25
  • You should take a look at the titlesec package.
    – Bernard
    Jan 2, 2019 at 17:46

2 Answers 2

1

Here's an easy way with titlesec:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{titlesec, lipsum}

\titleformat{\paragraph}[block]{\bfseries\filcenter}{}{0pt}{}

    \begin{document}
\lipsum[11]

\paragraph{Paragraph title}
\lipsum[1]

\end{document} 

enter image description here

5
  • I have tried this way but it does not work with my document, maybe there is a conflict with another package.
    – user178668
    Jan 2, 2019 at 18:05
  • Could you post a minimal full example that doesn't work this way?
    – Bernard
    Jan 2, 2019 at 18:10
  • I found the problem, there must have been a conflict between sectsty and titlesec: removing sectstyfrom my package list has solved the problem.
    – user178668
    Jan 2, 2019 at 18:11
  • Thank you for your help @Bernard, I will get deep look at the titlesecpackage.
    – user178668
    Jan 2, 2019 at 18:13
  • Oh yes. They operate on the same kind of objects, and this is not recommended.
    – Bernard
    Jan 2, 2019 at 18:26
0

Another way, you can use scrartcl class from koma-script

\documentclass{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lipsum}

% to have paragraph not in run-in format, afterskip has to be postive
\RedeclareSectionCommand[
afterskip = .5em,
]{paragraph}

%center title
\addtokomafont{paragraph}{\centering}

\begin{document}
\lipsum[11]

\paragraph{Paragraph title}
\lipsum[1]

\end{document} 

With koma-script

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy