[Tex/LaTex] Table cell height too small when wrapping text

heightlongtabletablestabuvertical alignment

I have the following problem with my table:

The height of the 2nd row is slightly too small and the text overlaps with the line at the bottom and the top of the cell.
My code is below:

\begin{longtabu} to \linewidth {| m{0.41\textwidth} | m{0.53\textwidth} |}
\hline
\multicolumn{1}{|c}{Static (stuff)} & \multicolumn{1}{|c|}{Dynamic (stuff)} \\ \hline
\endhead
\hline
\endfoot
\endlastfoot 
textetxtetxtexttext & textetxtetxtexttext$-$Buffer: X\textbackslash Y\textbackslash y\textbackslash G\textbackslash X\textbackslash H\textbackslash J\textbackslash x00$-$\\ \hline 
textetxtetxtexttext & textetxtetxtexttext$-$Information: XYZ\textbackslash x00 ???\\ \hline   
\caption{calls}
\label{tab:alls}% 
\end{longtabu}

Any help is appreciated. Using packages tabu, booktabs and longtable.
Thanks

Best Answer

You can add struts to the beginning and end of your columns as follows:

\documentclass{article}
\usepackage{tabu}
\usepackage{longtable}
\pagestyle{empty}
\newcommand{\aefrontstrut}{\rule{0pt}{0.8\baselineskip}}
\newcommand{\aebackstrut}{\rule[-0.6\baselineskip]{0pt}{0.8\baselineskip}}
\begin{document}

\begin{longtabu} to \linewidth {| m{0.41\textwidth} | >{\aefrontstrut}m{0.53\textwidth}<{\aebackstrut} |}
\hline
\multicolumn{1}{|c}{Static (stuff)} & \multicolumn{1}{|c|}{Dynamic (stuff)} \\ \hline
\endhead
\hline
\endfoot
\endlastfoot 
textetxtetxtexttext & textetxtetxtexttext$-$Buffer: X\textbackslash Y\textbackslash y\textbackslash G\textbackslash X\textbackslash H\textbackslash J\textbackslash x00$-$\\ \hline 
textetxtetxtexttext & textetxtetxtexttext$-$Information: XYZ\textbackslash x00 ???\\ \hline   
\caption{calls}
\label{tab:alls}% 
\end{longtabu}
\end{document}

You can use LaTeX's own \strut command, or you can make your own customized struts as I've done above. By using two different style struts and the > and < modifiers for columns, you can control the spacing above the first line and after the last line in that column.

enter image description here

By changing the height of the first strut and the depth of the second strut, you can finely control the spacing.

\rule[<raise>]{<width>}{<height>}

Technically, the optional argument to \rule is not the depth; it's a dimension by which the rule is raised or lowered. By using a negative value you are essentially setting the depth of the strut. Since the strut should not be visible, make sure the <width> is set to Opt.

UPDATE

As noted in the comments below, the alignment can be off if the last column contains some short text. To get around this, use the > < directives for both columns:

\begin{longtabu} to \linewidth {| >{\aefrontstrut}m{0.41\textwidth}<{\aebackstrut} | >{\aefrontstrut}m{0.53\textwidth}<{\aebackstrut} |}