# Set margins / make box for the section title with titlesec

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.

\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}


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}