0
\begin{table}[ht]
\label{tab:intro}
\caption{Anonymized data - output example}
\begin{tabular}{llll}
\toprule    
      Age & SEX & ETHNIC & STUDIES \\
\midrule
    * &   * &      * &       * \\
   42 &   1 &      1 &       7 \\
   40 &   1 &      1 &       7 \\
   45 &   1 &      1 &       7 \\
 [48, 51[ &   2 &      1 &     <=3 \\
 [48, 51[ &   1 &      1 &     <=3 \\
    * &   * &      * &       * \\
 [60, 63[ &   2 &      6 &     <=6 \\
   58 &   1 &      1 &       5 \\
    * &   * &      * &       * \\
\bottomrule
\end{tabular}
\end{table}

Everything works fine if I remove [, but i need to put them.

This is the error:

! Paragraph ended before \@argarraycr was complete.

2 Answers2

2

As already explained in the answer to Error with table adding \relax to \\ before rows, that start with [, solves the problem:

\documentclass{article}
\usepackage{booktabs}
\begin{document}
\begin{table}[ht]
\label{tab:intro}
\caption{Anonymized data - output example}
\begin{tabular}{llll}
\toprule    
      Age & SEX & ETHNIC & STUDIES \\
\midrule
    * &   * &      * &       * \\
   42 &   1 &      1 &       7 \\
   40 &   1 &      1 &       7 \\
   45 &   1 &      1 &       7 \\\relax
 [48, 51[ &   2 &      1 &     <=3 \\\relax
 [48, 51[ &   1 &      1 &     <=3 \\
    * &   * &      * &       * \\\relax
 [60, 63[ &   2 &      6 &     <=6 \\
   58 &   1 &      1 &       5 \\
    * &   * &      * &       * \\
\bottomrule
\end{tabular}
\end{table}
\end{document}

enter image description here

BTW: As shown in the example < in text mode will not result in a <. You should either use \textless:

\documentclass{article}
\usepackage{booktabs}
\begin{document}
\begin{table}[ht]
\label{tab:intro}
\caption{Anonymized data - output example}
\begin{tabular}{llll}
\toprule    
      Age & SEX & ETHNIC & STUDIES \\
\midrule
    * &   * &      * &       * \\
   42 &   1 &      1 &       7 \\
   40 &   1 &      1 &       7 \\
   45 &   1 &      1 &       7 \\\relax
 [48, 51[ &   2 &      1 &     \textless=3 \\\relax
 [48, 51[ &   1 &      1 &     \textless=3 \\
    * &   * &      * &       * \\\relax
 [60, 63[ &   2 &      6 &     \textless=6 \\
   58 &   1 &      1 &       5 \\
    * &   * &      * &       * \\
\bottomrule
\end{tabular}
\end{table}
\end{document}

or math mode:

\documentclass{article}
\usepackage{booktabs}
\usepackage{amsmath}
\begin{document}
\begin{table}[ht]
\label{tab:intro}
\caption{Anonymized data - output example}
\[
\begin{array}{llll}
\toprule    
      \text{Age} & \text{SEX} & \text{ETHNIC} & \text{STUDIES} \\
\midrule
    * &   * &      * &       * \\
   42 &   1 &      1 &       7 \\
   40 &   1 &      1 &       7 \\
   45 &   1 &      1 &       7 \\\relax
 [48, 51[ &   2 &      1 &     \leq 3 \\\relax
 [48, 51[ &   1 &      1 &     \leq 3 \\
    * &   * &      * &       * \\\relax
 [60, 63[ &   2 &      6 &     \leq 6 \\
   58 &   1 &      1 &       5 \\
    * &   * &      * &       * \\
\bottomrule
\end{array}\]
\end{table}
\end{document}
Schweinebacke
  • 26,336
1

Thanks to user124577:

\begin{table}[ht]
\label{tab:intro}
\caption{Anonymized data - output example}
\begin{tabular}{llll}
\toprule
  Age & SEX & ETHNIC & STUDIES \\
\midrule
    * &   * &      * &       * \\
   42 &   1 &      1 &       7 \\
   40 &   1 &      1 &       7 \\
   45 &   1 &      1 &       7 \\[0pt]
 [48, 51[ &   2 &      1 &     <=3 \\[0pt]
[48, 51[ &   1 &      1 &     <=3 \\
    * &   * &      * &       * \\[0pt]
[60, 63[ &   2 &      6 &     <=6 \\
   58 &   1 &      1 &       5 \\
    * &   * &      * &       * \\
\bottomrule
\end{tabular}
\end{table}