# Problem with vertical space in Memoir title

I've been struggling with titlingpage and Memoir a few hours, trying to make the document title have equal linespacing between its lines when using \\.

The code is:

\documentclass[10pt,a4paper,oneside]{memoir}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[brazil]{babel} %Hifenização em português

\title{Estudo e modelagem de \\ soluções de otimização discreta para \\ grades horárias}

\newcommand{\subtitle}{
Trabalho de Conclusão do Curso de\\[-5pt]
Bacharelado em Ciência da Computação
}

%flushright alinha a direita
%DoubleSpacing, ver pag. 48 manual memoir
\pretitle {\begin{DoubleSpace} \begin{flushright} \begin{huge} \scshape}

%sffamily = sans serif
%tamanho grande = \Large
\posttitle {\end{huge} \\[1cm] \sffamily \Large \subtitle \end{flushright} \end{DoubleSpace}}

\begin{document}
\begin{titlingpage}
\maketitle
\end{titlingpage}
\end{document}


The result:

It has a small, but evident, difference in vertical space between lines, could you help me get rid of that ?

Thanks in advance.

EDIT (solved!):

After applying \strut as suggested!

-
I am not able to compile your MWE. You could try adding \strut on each line. This is a box of zero width and height that extends just above and below the baseline. –  Peter Grill Nov 29 '11 at 2:38
This really worked! But the space added is the one between the 1st and 2nd lines, and it's too big. I would like the second spacing to be applied. I will try the onehalf spacing in Memoir now. –  Niloct Nov 29 '11 at 3:12
Thanks Peter, we did it! Please formalize the answer so I can accept it. –  Niloct Nov 29 '11 at 3:22

## 2 Answers

Add \strut on each line. This is a box of zero width and height that extends just above and below the baseline which ensures that each line has the same vertical dimension.

Alternatively you could add a \vphantom so that each line has the same vertical dimension. This has the advantage of producing a tighter box, but the disadvantage that you need to specify paramterts which include the characters with the largest depth and height.

Here is a comparison of boxes with no adjustment, using \strut and \vphantom{}:

\documentclass{article}
\begin{document}
\begin{tabular}{c c c}
& strut & vphantom\\
\fbox{g}\fbox{f} &
\fbox{g\strut}\fbox{f\strut} &
\fbox{g\vphantom{f}}\fbox{f\vphantom{g}}
\end{tabular}
\end{document}

-
Please try \fbox{g}\fbox{\"A}\fbox{g\strut}\fbox{\"A\strut}\fbox{g\vphantom{\"A}}\fbox{\"A‌​\vphantom{g}}. \strut does not give the expected result. –  kiss my armpit Mar 31 '13 at 0:47
@Karl'sstudents: So, looks like \vphantom is better. Appears that \strut does not account for accents. –  Peter Grill Apr 1 '13 at 4:05

There's no huge environment; there's the switch \huge:

\documentclass[10pt,a4paper,oneside]{memoir}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[brazil]{babel}

\title{Estudo e modelagem de \\ soluções de otimização discreta para \\ grades horárias}

\newcommand{\subtitle}{
Trabalho de Conclusão do Curso de \\
Bacharelado em Ciência da Computação
}

\pretitle {\begin{OnehalfSpacing} \begin{flushright}\huge\scshape}
\posttitle {\\[1cm]\normalfont\sffamily\Large \subtitle\end{flushright}\end{OnehalfSpacing}}

\begin{document}
\begin{titlingpage}
\maketitle
\end{titlingpage}
\end{document}


-
Hi, your example worked, but when I added the subtitle it broke saying that "There's no line here to end." \posttitle {\par \\[1cm] \sffamily \Large \subtitle \end{flushright} \end{OnehalfSpacing}} (I am using OnehalfSpacing now). –  Niloct Nov 29 '11 at 3:28
(Obviously I defined the \subtitle as above). –  Niloct Nov 29 '11 at 3:35
@Niloct Yeah... obviously after you edited your question. Anyway, see my updated answer for a simple solution. –  Gonzalo Medina Nov 29 '11 at 3:59
I meant no offence man, I just said that I was aware that \subtitle needed and had a definition. Thank you for the answer, it is elegant but it was not the first working solution to the problem, therefore I reserve myself the right to grant the solution to another answer. +1 though, for sure. –  Niloct Nov 29 '11 at 4:45