# Auto-wrap title through *.sty file

I'm beginning to write my personal *.sty file and I would like it to be able to automatically wrap the document title in case it's too long (I'm not sure whether "wrap" is the correct term: I mean to automatically display it on more than one line if need be).

My *.sty file looks like this (I'm not a TeX\LaTeX expert, so it's based on another *.sty file with some slight modifications):

\NeedsTeXFormat{LaTeX2e}

% Some code
\newcommand{\@titolo}{Senza Titolo}
\renewcommand\maketitle{\begin{titlepage}
% Some code

{\vfil
\begin{LARGE}
{\bf\renewcommand{\\}{\cr}
\halign{\hbox to\textwidth{\strut\hfil##\hfil}\cr
\@titolo\cr}}
\end{LARGE}}

% Some code
\end{titlepage}
\endinput


So, the question is: is there a way to automatically display the title on more than one line? I've tried by inserting \@titolo inside a \minipage but wasn't able to succeed. Any kind of help or hint is appreciated.

• Welcome, \bf is obsolete for more than twenty years. Redefining \\  doesn't seem like a good idea either. LARGE is not an environment. hboxes cannot be broken in differente lines. Personally, i would not base my package on that package you are using. Sep 10, 2016 at 8:20
• How to customize my titlepage? Sep 10, 2016 at 8:20
• where did the code you start from come from? \vfil does nothing in that position, \bf shouldn't be used in latex (it's not defined by default) and using a primitive \halign rather than a latex construct such as tabular will have weird side effects. The title would wrap automatically if you did not put it in the halign. Sep 10, 2016 at 8:20
• @DavidCarlisle, I've rewritten the code using a tabular environment and it worked out just fine. The code dated back to 2006, but I didn't expect it to be obsolete, thanks for letting me know. @Johannes_B, I'll definetly take a look at that link in the future. Sep 10, 2016 at 14:19

Seems silly to answer to my own question, but as a reference I'll write a working solution that I was able to write thanks to the help received through the comments and some research on LaTeX book by wikibooks.org. I simply substituted the {\vfil ...} part with a \tabular environment:
\begin{tabular}{>{\centering}>{\bfseries}>{\huge}p{1\textwidth}<{\centering}}

The title (\@titolo) wraps just fine and it is bold.