Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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 specified 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}\\
\addlinespace
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.

share|improve this question
    
\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
add comment

2 Answers 2

up vote 4 down vote accepted

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
\myVSpace\textbf{Title} & \textbf{A}\\[\defaultaddspace]
Row & B\\\hline
\myVSpace[20pt]Row & B\\\hline
\end{tabular}

\end{document}

or do not use booktabs and then \\[10pt] instead. enter image description here

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

share|improve this answer
    
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
add comment

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.

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.