Problems with \toprule and \midrule in a table

\midrule is a command defined by the Booktabs package. Include \usepackage{booktabs} in your preamble to typeset your table.


Adding

\usepackage{booktabs}

solved the problem :O


You should certainly load the booktabs package in order to enable the use of \toprule, \midrule, and \bottomrule.

You should also aim to improve the readability of the table. You could start by getting rid of all interior \midrule statements, which add lots of visual clutter without making the table easier to read. In addition, do consider (a) adding a bit of whitespace after the end of 10th and 20th row by inserting an \addlinespace statement, (b) formatting the entries in the first two columns more elegantly by assigning them type S instead of c, and (c) moving the shared \% elements from the cells in the second column to the corresponding header.

\documentclass{article}
\usepackage{booktabs,siunitx}
\begin{document}

\centering
\sisetup{output-decimal-marker={,}}
\begin{tabular}{S[table-format=3.0] 
                S[table-format=2.0] 
                S[table-format=4.0]}
\toprule
{Dimensione finestra} & {Perdita} & {Tempo}\\
{} & {(\%)} & {(secondi)}\\
\midrule
10                & 0        & 121\\
10                & 10       & 127\\
10                & 20       & 176\\
10                & 30       & 257\\
10                & 40       & 442\\
10                & 50       & 780\\
10                & 60       & 1226 \\
10                & 70       & 1469 \\
10                & 80       & 1904 \\
10                & 90       & 3234 \\
\addlinespace
50                & 0        & 46 \\
50                & 10       &109 \\
50                & 20       &146 \\
50                & 30       &202 \\
50                & 40       &257 \\
50                & 50       &373 \\
50                & 60       &544 \\
50                & 70       &760 \\
50                & 80       &1356 \\
50                & 90       &6588 \\
\addlinespace
100                & 0        & 76 \\
100                & 10       & 91 \\
100                & 20       &109 \\
100                & 30       &146 \\
100                & 40       &180 \\
100                & 50       &297 \\
100                & 60       &414 \\
100                & 70       &585 \\
100                & 80       &1355 \\
100                & 90       &4326 \\
\bottomrule
\end{tabular}
\end{document}

The following screenshot shows the tabular environment with the proposed modifications on the left, and without the modifications (i.e., what would result just from loading the required booktabs package) on the right. Note, inter alia, the better centering of the numbers in the third column, which was achieved by specifying S[table-format=4.0] instead of just S.

I hope you will agree that the table on the left is more readable than the one on the right.

enter image description here