[Tex/LaTex] Spacing between lines differs when using tabbing and parbox

spacing

I'm writing a budget report for personal use to help me keep track of how much I'm spending in various categories and where exactly I'm spending it. I'm trying to get these reports to take less space on the page so I can get one page for each month. Also, I'm generating this automatically so as you'll see, generating extra code for each line isn't a big deal, though if there is a better way altogether, I'm open to it.

I'm currently using the tabbing environment to line up the monthly and YTD (year to date) numbers for each category (sample code and output below), and an indented parbox below to hold where exactly I spent the money in that category. I'm using a parbox so that the text doesn't go below the numbers, which would make the numbers hard to read.

My issue: When I have less space between the lines when there's only one line in the parbox than when there's more than one. In the example below, you can see that the lines below "Groceries" are tighter than the line below "Out To Eat". I'd like to tighten this up so it is more likely to fit on one page.

Also, my eye is distracted by the different spacing, and so I spend time thinking about how to fix it instead of about how I'm spending my money.

I've tried lineskip=0pt as suggested here in this answer: https://tex.stackexchange.com/a/44497/2823 but it had no visual effect that I could see,
and adding \strut as suggested in this answer: https://tex.stackexchange.com/a/45044/2823, though the \strut seemed to be for adding space for descenders, which it did (but isn't what I need.) I've also tried adding \par's at every place I can think of as I know that the linespacing for lines of differing sizes depends on what the size is when the paragraph starts or ends, but that has had no effect either.

Here's what I have; any suggestions about this specific issue, or better ways to do this altogether, are very welcome.

\documentclass{article}
\begin{document}
\begin{tabbing}
\hspace*{2.5in} \= \hspace{0.75in} \=.\kill
Groceries\>579.60\'\>1756.34\' \\ 
\hspace{10pt}\parbox{2in}{\scriptsize\raggedright Trader~Joe's,~216.71; Cub,~216.34; Whole~Foods,~101.40; Wuollet,~7.95} \\ 
Out To Eat\>36.30\'\>129.22\' \\ 
\hspace{10pt}\parbox{2in}{\scriptsize\raggedright Davanni's,~36.30} \\ 
Car\>7.00\'\>21.00\'\\
\hspace{10pt}\parbox{2in}{\raggedright\scriptsize Wash,~7.00}
\end{tabbing}
\end{document}

enter image description here

Best Answer

The default setting of \parbox is to make a box whose reference point is half way from the top to the bottom (not precisely, but the details are unimportant). This makes hard to place them in a tabbing environment.

A possible solution is to place the parbox with "top" alignment and add a fixed vertical space at its bottom.

\documentclass{article}

\newcommand{\goods}[1]{%
  \hspace{10pt}\parbox[t]{2in}{\scriptsize\raggedright#1\par
  \vspace{-\prevdepth} % remove the depth of the last line
  \vspace{2ex} % add a fixed vertical space
  }%
}

\begin{document}

\begin{tabbing}
\hspace*{2.5in} \= \hspace{0.75in} \=.\kill\showthe\lineskiplimit
Groceries\>579.60\'\>1756.34\' \\
\goods{Trader~Joe's,~216.71; Cub,~216.34; Whole~Foods,~101.40; Wuolletp,~7.95} \\
Groceries\>579.60\'\>1756.34\' \\
\goods{Trader~Joe's,~216.71; Cub,~216.34; Whole~Foods,~101.40; Wuollet,~7.95} \\
Groceries\>579.60\'\>1756.34\' \\
\goods{Trader~Joe's,~216.71; Cub,~216.34; Whole~Foods,~101.40; Wuollet,~7.95} \\
Out To Eat\>36.30\'\>129.22\' \\
\goods{Davanni's,~36.30} \\
Car\>7.00\'\>21.00\'\\
\goods{Wash,~7.00}
\end{tabbing}

\end{document}

Defining a personal command for the small entries makes it possible to act on each of them in a uniform way. So \parbox[t] will ensure constant distance from the line above; for the bottom I first remove the depth of the last line (I added a letter with a descender in the first block just to show the effect) and add a vertical skip at the bottom.

Adjust to suit.

enter image description here

In order to reduce the spacing between the main line and the \goods one, a small modification is sufficient:

\newcommand{\goods}[1]{%
  \hspace{10pt}\parbox[t]{2in}{
    \vspace{0pt} % sets the reference point to the top of the box
    \scriptsize\raggedright#1\par
    \vspace{-\prevdepth} % remove the depth of the last line
    \vspace{2ex} % add a fixed vertical space
  }%
}

One can also change the first \vspace into \vspace{-.2ex} or \vspace{2ex} or different length; experiment. It's best to use ex units, so the result will change accordingly when changing fonts or font size.