# How to keep identical vertical spacing in a custom list environment regardless of descenders / ascenders?

I am currently defining a custom list environment for a CV. The environment works as desired, but it has one caveat. Namely, letters with ascenders and descenders affect the row width, thus making the output ugly. There goes a MWE:

\documentclass{article}

\pagestyle{empty}

\setlength{\tabcolsep}{0pt}
\newenvironment{entrylist}{%
\noindent
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}ll}
}{%
\end{tabular*}
}
\renewcommand{\bfseries}{}
\newcommand{\entry}[4]{%
\spaceskip0pt\xspaceskip0pt % for ragged2e document settting
#1\hspace*{0pt plus -1fil}\mbox{}&\parbox[t]{10.00cm}{%
\textbf{#2}%
\hfill%
{\footnotesize #3\par}%no!\\%
#4\vspace{\parsep}%
}\\}

\begin{document}

\begin{entrylist}

\entry
{A very fancy building in a very fancy place}
{}
{}

\entry
{www.somename.com}
{}
{}

\entry
{Pers email}
{somename a aaa}
{}
{}

\entry
{Work email}
{veryfancyname2 a aaa}
{}
{}

\entry
{UK phone}
{+00 0000 000000}
{}
{}

\entry
{SP phone}
{+00 000 000 000}
{}
{}

\end{entrylist}

\end{document}


I claim that the output is ugly because the empty space between rows 1 & 2 is greater than the empty space between lines 2 & 3, for example. It might be a bit tricky to see, but the different spacing I mention is there, and I am sure that the culprit of this is the use of letters with descenders.

I would like to find a way to make sure that the list environment defined above keeps the same amount of space between lines, regardless of letters with ascenders / descenders.

• Add a \strut as the first entry in the \parbox. Depending on whether these can become multi-line entries, you may also need to enter a \strut at the end of the \parbox, too. This might be problematic, as the value of #4 determines if you leave vertical mode or not after the \par (whereas the \strut will definitely force an exit from vertical mode). Sep 20 at 14:22
• Thank you very much for your useful comment. However, I have one question: when you write ‘multi-line entries’, what do you exactly mean? As you can see in the MWE, each \entry has four {}, although some of them are empty. There might bu up to four {} in each entry, but each {} will contain information that will span at most one single line (i.e., no {} is multi-lined). Will I have issues if I apply your suggestion? Sep 20 at 15:40
• I am referring to whether the content is long enough so that the \parbox wraps into multiple lines or not. Sep 20 at 15:52
• Then I won’t have a problem. Thank you very much for your answer —I tested it and works like a charm. Feel free to post it as answer for me to accept it. Sep 20 at 15:57

In a comment I suggested adding a \strut at the beginning of the \parbox, so that the "top" of the parbox would occupy the full vertical extent of a text-line. Normally, I might also advocate a \strut at the end of the \parbox (for cases where line wrapping occurs). However, in this case, because the parbox has, near the end, {...\par}#4\vspace{\parsep}, a \strut would take one out of vertical mode even when #4 was blank, which would not be the likely intent of the OP. The OP assured me that this approach, with the single \strut at the outset, works to his satisfaction.

\documentclass{article}

\pagestyle{empty}

\setlength{\tabcolsep}{0pt}
\newenvironment{entrylist}{%
\noindent
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}ll}
}{%
\end{tabular*}
}
\renewcommand{\bfseries}{}
\newcommand{\entry}[4]{%
\spaceskip0pt\xspaceskip0pt % for ragged2e document settting
#1\hspace*{0pt plus -1fil}\mbox{}&\parbox[t]{10.00cm}{\strut%
\textbf{#2}%
\hfill%
{\footnotesize #3\par}%no!\\%
#4\vspace{\parsep}%
}\\}

\begin{document}

\begin{entrylist}

\entry
{A very fancy building in a very fancy place}
{}
{}

\entry
{www.somename.com}
{}
{}

\entry
{Pers email}
{somename a aaa}
{}
{}

\entry
{Work email}
{veryfancyname2 a aaa}
{}
{}

\entry
{UK phone}
{+00 0000 000000}
{}
{}

\entry
{SP phone}
{+00 000 000 000}
{}
{}

\end{entrylist}

\end{document}


I'm not sure what the \parbox is for. You can exploit tabularx instead.

\documentclass{article}
\usepackage{tabularx}

\pagestyle{empty}

\newenvironment{entrylist}{%
\noindent
}{%
\endtabularx
}
\newcommand{\entry}[4]{%
#1&#2\hfill
\mbox{\footnotesize #3}%
\if\relax\detokenize{#4}\relax\else\\#4\fi
\\\noalign{\vspace{\parsep}}%
}

\begin{document}

\noindent X\dotfill X

% this is just to show the baselines
\noindent\makebox[0pt][l]{\hbox{\vrule\vtop{
\hbox{\strut\vrule height0.1pt depth 0.1pt width \textwidth}\vskip\parsep
\hbox{\strut\vrule height0.1pt depth 0.1pt width \textwidth}\vskip\parsep
\hbox{\strut\vrule height0.1pt depth 0.1pt width \textwidth}\vskip\parsep
\hbox{\strut\vrule height0.1pt depth 0.1pt width \textwidth}\vskip\parsep
\hbox{\strut\vrule height0.1pt depth 0.1pt width \textwidth}\vskip\parsep
\hbox{\strut\vrule height0.1pt depth 0.1pt width \textwidth}\vskip\parsep
\hbox{\strut\vrule height0.1pt depth 0.1pt width \textwidth}\vskip\parsep
\hbox{\strut\vrule height0.1pt depth 0.1pt width \textwidth}\vskip\parsep
}}}%
\begin{entrylist}

\entry
{A very fancy building in a very fancy place}
{}
{}

\entry
{www.somename.com}
{}
{}

\entry
{Pers email}
{somename a aaa}
{}
{}

\entry
{Work email}
{veryfancyname2 a aaa}
{}
{}

\entry
{UK phone}
{+00 0000 000000}
{}
{}

\entry
{SP phone}
{+00 000 000 000}
{}
{}

\end{entrylist}

\end{document}