Center-justify with hrule above and below
Pilfering from @egreg's answer... You could modify the inter-word spacing or just add a couple of \hfill
s inbetween:
\documentclass{article}
\usepackage{booktabs}% http://ctan.org/pkg/booktabs
\begin{document}
\mbox{\huge\bfseries
\begin{tabular}{@{}c@{}}
\toprule[.25mm]
This is my title, it is somewhat\\
long\hfill and\hfill split\hfill over\hfill two\hfill lines!\\
\bottomrule[.25mm]
\end{tabular}%
}
\end{document}
On its own, \hfill
will do nothing inside a tabular
if there isn't enough room to stretch. However, since the first line is longer than the second, there is room to stretch.
\makebox[<len>][<justification>]{<stuff>}
can also be used with <justification>
given by [s]
(for s
tretch) if you know the <len>
that <stuff>
should be spread over:
\documentclass{article}
\usepackage{booktabs}% http://ctan.org/pkg/booktabs
\begin{document}
\newlength{\mylen}
\noindent{\huge\bfseries
\settowidth{\mylen}{This is my title, it is somewhat}%
\begin{tabular}{@{}c@{}}
\toprule[.25mm]
This is my title, it is somewhat\\
\makebox[\mylen][s]{long and split over two lines!}\\
\bottomrule[.25mm]
\end{tabular}%
}
\end{document}
Use a tabular
environment:
\documentclass{article}
\usepackage{booktabs}
\begin{document}
\mbox{\huge\bfseries
\begin{tabular}{@{}c@{}}
\toprule[.25mm]
This is my title, it is somewhat\\
long and split over two lines!\\
\bottomrule[.25mm]
\end{tabular}%
}
\end{document}