# Default value for \addlinespace from booktabs

In the booktabs package documentation the command is described in the following:

Occasionally we want to put an extra space between certain rows of a table; for example, before the last row, if this is a total. This is simply a matter of inserting \addlinespace[width] after the \\ alignment marker.

Further the documentation says:

The default space before or after an adjacent rule is replaced by exactly \defaultaddspace or the amount of space speciﬁed in the optional argument.

I, however, do not know how to use this command, for instance

\defaultaddspace{10pt}


before or inside the tabular environment results in \defaultaddspace{10pt}

Missing number, treated as zero.

Followup:

\addlinespace works now, however, I cannot get the desired result:

\begin{tabular}{|c|p{0.66\textwidth}|}
\hline
\textbf{Title} & \textbf{A}\\
Row & B\\
\hline
\end{tabular}


The borders are broken when I insert \addlinespace. The space is added, but in this extra space there are no lined borders on the left and on the right.

-
\defaultaddspace 10pt works without compilation errors, however no changes are present. – user3348 Feb 5 '11 at 11:57
Welcome to tex.sx! A tip: you can use backticks  to mark your inline code as I did in my edit. – Hendrik Vogt Feb 5 '11 at 13:20

use it this way:

\documentclass{article}
\usepackage{array,booktabs}

\newcommand\myVSpace[1][10pt]{\rule[\normalbaselineskip]{0pt}{#1}}

\begin{document}

\begin{tabular}{|c|p{0.66\textwidth}|}\hline
Row & B\\\hline
\myVSpace[20pt]Row & B\\\hline
\end{tabular}

\end{document}


or do not use booktabs and then \\[10pt] instead.

The image shows how the optional argument of \rule works. I used \rule[...]{10pt}{#1} to make the box visible

-
Sweet, works like a charm. Thank you both of you. – user3348 Feb 5 '11 at 12:36
But where do you put the command if you want the default space right after the \hline? So the space is added before \textbf{Title} & \textbf{A} and after it? Because this way only space on bottom of the text is added! – user3348 Feb 5 '11 at 12:40
\[\defaultaddspace] only adds space after the row. Any idea how extra space is added BEFORE the row? – user3348 Feb 5 '11 at 12:50
@BrokenClockwork: see my edited example – Herbert Feb 5 '11 at 12:53

The \defaultaddspace is a dimension (=length). You have to set it either with: \setlength{\defaultaddspace}{10pt} (LaTeX) or \defaultaddspace=10pt (plainTeX syntax).

The error appears because \defaultaddspace looks for a number (or the optional = + number) but only finds the {.

You would either set it before the table or using \global\defaultaddspace=10pt. It will be grouped inside a table sell and the change is lost when \global is not used.

Note set \defaultaddspace will only be used when \addlinespace is used without the optional argument.

-
Thanks, but I can add as much pt as I want, there is no difference for my tabular. – user3348 Feb 5 '11 at 12:01
You are using \addlinespace as well, do you? Maybe you should post a minimal working example which shows the issue. – Martin Scharrer Feb 5 '11 at 12:06
I did not use \addlinespace, I hoped \defaultaddspace adds space at every row automatically, but I guess I have to do it manually, thanks! – user3348 Feb 5 '11 at 12:06
Yes, the name is a little confusing. It is the default value of \addlinespace` not the default added space. :-) – Martin Scharrer Feb 5 '11 at 12:15
Could you take a look at my followup in the original question post, I don't know if it clear what I mean. – user3348 Feb 5 '11 at 12:30