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}
\newcommand{\titolo}[1]{\renewcommand{\@titolo}{#1}}
\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.
\bf
is obsolete for more than twenty years. Redefining\\
doesn't seem like a good idea either.LARGE
is not an environment.hbox
es cannot be broken in differente lines. Personally, i would not base my package on that package you are using.\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.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.