1

As a continue to this question: How to center headings at KOMA-Script I'm trying to center the parts...

MWE:

\documentclass{scrartcl}
\usepackage{adforn}

\setkomafont{part}{\itshape}
\renewcommand\partlineswithprefixformat[3]{ #2 \centering{\adforn{36}\hbox{#3\adforn{64}}}}

\begin{document}
\part{ABC}
\end{document}

The example above don't work:
enter image description here

I want that ABC will be at the center (the second line), without using the \hfill command....

Do you know how can I do it?
And if I want that also the Part I. will be centered - how can I do it?

Thank you!

1 Answer 1

2

This code works:

\documentclass{scrartcl}
\usepackage{adforn}

\setkomafont{part}{\itshape}
\let\raggedpart\centering
\renewcommand\partlineswithprefixformat[3]{#2\parbox{\textwidth}{\centering\adforn{36}\hbox{#3\adforn{64}}}}%

\begin{document}

\part{ABC}

\end{document}
5
  • And if I want both lines will be centered (at scrartcl only the second line centered, at scrbook both centered, but I'm using scrartcl )? Thank you!!
    – heblyx
    Commented Apr 22, 2019 at 22:25
  • Sorry, I had forgotten you used scrartcl. Please see my updated code.
    – Bernard
    Commented Apr 22, 2019 at 22:44
  • Thank you! But if I want that only the second line will be centered? This is possible?
    – heblyx
    Commented Apr 23, 2019 at 6:31
  • 1
    You've observed it yourself: remove the line \letraggedpart\centering. If you code instead: \let\raggedpart\raggedleft, you'll have the first line flushright, and the second line centred.
    – Bernard
    Commented Apr 23, 2019 at 8:37
  • Thank you!! Works!!
    – heblyx
    Commented Apr 23, 2019 at 10:36

You must log in to answer this question.

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