[Tex/LaTex] Center text between horizontal lines

spacing

I'm trying to ensure that the text between the two horizontal lines is of equal distance from each one. To try and achieve this I've tried the following:

\documentclass[11pt]{article}
 \begin{document}
    \begin{titlepage}
        \begin{center}
        \line(1,0){400}\\[1mm]
        \Huge{Title}\\[1mm]
        \line(1,0){400}
        \end{center}
    \end{titlepage}
\end{document}

But this certainly isn't giving me the result I want. How can I fix this?

Best Answer

You can do that with a tabularx, the rules from booktabs and ensure vertical centring between the rules with the cellspace package, which lets you define a minimal vertical spacing at the top and bottom of a cell in a table:

\documentclass[11pt]{article}
\usepackage{cellspace, tabularx, booktabs}
\usepackage[x11names]{xcolor}
\usepackage{garamondx}
\addparagraphcolumntypes{X}

\begin{document}

\begin{titlepage}
  \setlength{\cellspacetoplimit}{11pt}
  \setlength{\cellspacebottomlimit}{12pt}
  \begin{center}
    \huge \textit{Edward Lear}\vspace{10ex}
    \Huge\bfseries
    \begin{tabularx}{\linewidth}{S{>{\centering\arraybackslash}X}}
      \toprule
      \color{IndianRed3} The Pobble Who Has No Toes \\
      \bottomrule
    \end{tabularx}
  \end{center}
\end{titlepage}

\end{document} 

enter image description here

Related Question