1

I would like to set right and left margins for the section titles, so that they are a little less wide than the width of the text, and that in turn they remain centered. Basically, I want the width of the sections to be less than the width of the text (in fact, the text I'm working with has titles of 4 or 5 lines). I tried some possibilities with \parbox, but I did not succeed.

by default the section is adjusted to the width of the text

\documentclass[12pt,twoside,openright]{memoir}  
\usepackage[utf8]{inputenc}

\title{Ejemplo}
\author{julietamass}

\usepackage[paperwidth=130mm, paperheight=200mm,top=1.5cm,bottom=2cm,left=2cm,right=1.5cm]{geometry}
\usepackage{titlesec}

\titleformat*{\section}{\filcenter}


%-----------------------------
\begin{document}

\maketitle

\section*{The Title. \\Here is a really long title, yes, this title is quite long, it could be a bit summarized}
I would like to set right and left margins for the section titles, so that they are a little less wide than the width of the text, and that in turn they remain centered. Basically, I want the width of the sections to be less than the width of the text (in fact, the text I'm working with has titles of 4 or 5 lines).

\end{document}

1 Answer 1

1

The easiest solution is to put the title into a parbox. You could also put the \section* inside a minipage, but would lose \@afterheading.

\documentclass[12pt,twoside,openright]{memoir}  
\usepackage[utf8]{inputenc}

\title{Ejemplo}
\author{julietamass}

\usepackage[paperwidth=130mm, paperheight=200mm,top=1.5cm,bottom=2cm,left=2cm,right=1.5cm]{geometry}
\usepackage{titlesec}

\titleformat*{\section}{\filcenter}

%-----------------------------
\begin{document}

\maketitle

\section*{The Title. \parbox{\dimexpr \linewidth-1cm}{\centering Here is a really long title, yes, this title is quite long, it could be a bit summarized}}
I would like to set right and left margins for the section titles, so that they are a little less wide than the width of the text, and that in turn they remain centered. Basically, I want the width of the sections to be less than the width of the text (in fact, the text I'm working with has titles of 4 or 5 lines).

\end{document}

You must log in to answer this question.

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