Allow [ characters in tables without entering math-mode (from R)
Your use of (snippet)
%...
[1, 5) & 2 \\
[5, 8) & 5 \\
%...
is interpreted (visually) as
%...
& 1 \\[1, 5)
& 2 \\[5, 8)
& 5 \\[5, 8)
%...
since LaTeX expects an optional argument after \\
to contain a length/dimension. The easiest work-around is to insert a non-[
after \\
, like {}
(an empty group). For example:
\begin{tabular}{D{.}{.}{7}D{.}{.}{7}}
\toprule
\multicolumn{1}{c}{x} & \multicolumn{1}{c}{y} \\
\midrule
{}[1, 5) & 1 \\
{}[1, 5) & 2 \\
{}[5, 8) & 5 \\
{}[5, 8) & 7 \\
{}[8,10] & 8 \\
{}[8,10] & 10 \\
\bottomrule
\end{tabular}
The first {}
is not needed, but I've inserted it for a consistent look in the code.