0

i am new here. i am writing my thesis and i would like to make a table like this:

enter image description here

I am using the template "classicthesis" for my thesis. My code for the table so far looks like this:

\begin{table}
    \myfloatalign
    \noindent
    \begin{tabularx}{\textwidth}{lrrrrr} \toprule
        \tableheadline{Model}
        & \tableheadline{Size (pixels)}
        & \tableheadline{$mAP^{val}$ 0.5:0.95}
        & \tableheadline{$mAP^{val}$ 0.5}
        & \tableheadline{Speed CPU b1 (ms)}
        & \tableheadline{Speed V100 b1 (ms)} \\ \midrule
                
        YOLOv5n & 640 & 28.0 & 45.7 & 45 & 6.3 \\
        YOLOv5s & 640 & 37.4 & 56.8 & 98 & 6.4 \\
        YOLOv5m & 640 & 45.4 & 64.1 & 224 & 8.2 \\
        YOLOv5l & 640 & 49.0 & 67.3 & 430 & 10.1 \\
        YOLOv5x & 640 & 50.7 & 68.9 & 766 & 12.1 \\
        \midrule
        YOLOv5n6 & 1280 & 36.0 & 54.4 & 153 & 8.1 \\
        YOLOv5s6 & 1280 & 44.8 & 63.7 & 385 & 8.2 \\
        YOLOv5m6 & 1280 & 51.3 & 69.3 & 887 & 11.1 \\
        YOLOv5l6 & 1280 & 53.7 & 71.3 & 1784 & 15.8 \\
        YOLOv5x6 & 1280 & 55.0 & 72.7 & 3136 & 26.2 \\
        \bottomrule
    \end{tabularx}
    \caption{Network performance}
\end{table}

This is the result:

enter image description here

It would be awesome if you could show me how to fix the headers.

Thank You so much!

6
  • For a start, you shouldn't use tabularx if you don't have any X column specifier. Second, give a complete working example, including all necessary packages. Don't use unknown commands, like \myfloatalign and \tableheadline. Mar 28, 2022 at 18:03
  • Thank You very much for your help!
    – robspa
    Mar 28, 2022 at 20:18
  • Is it possible to have "Model", "Size", "mAP" and "speed" as headlines like on my second image?
    – robspa
    Mar 28, 2022 at 20:28
  • Do you mean the font? You can define the headline font with something like \renewcommand\theadfont{\scshape} Mar 29, 2022 at 5:48
  • Thank you for your reply again. yes i mean the font. And "\renewcommand\theadfont{\scshape}" works. But my aim is to differentiate between the first row of the headings and the others (like in the first image/original image) i tried \textbf{} but that doesnt work with formula like $mAP^{val}$. And i much prefer (\renewcommand\theadfont{\scshape}) as fontstyle. i dont know how to implement it only for the first headingrow. thank you so much for your help
    – robspa
    Mar 29, 2022 at 7:58

1 Answer 1

0

Here is a solution. I have used class report but this should also work with other classes.

\documentclass{report}

\usepackage{makecell}
\usepackage{booktabs}

\begin{document}

\begin{table}
    %\myfloatalign
    \noindent
    \begin{tabular}{lrrrrr} \toprule
        \thead{Model}
        & \thead{Size\\(pixels)}
        & \thead{$mAP^{val}$\\0.5:0.95}
        & \thead{$mAP^{val}$\\0.5}
        & \thead{Speed\\CPU b1\\(ms)}
        & \thead{Speed\\V100 b1\\(ms)} \\ \midrule
                
        YOLOv5n & 640 & 28.0 & 45.7 & 45 & 6.3 \\
        YOLOv5s & 640 & 37.4 & 56.8 & 98 & 6.4 \\
        YOLOv5m & 640 & 45.4 & 64.1 & 224 & 8.2 \\
        YOLOv5l & 640 & 49.0 & 67.3 & 430 & 10.1 \\
        YOLOv5x & 640 & 50.7 & 68.9 & 766 & 12.1 \\
        \midrule
        YOLOv5n6 & 1280 & 36.0 & 54.4 & 153 & 8.1 \\
        YOLOv5s6 & 1280 & 44.8 & 63.7 & 385 & 8.2 \\
        YOLOv5m6 & 1280 & 51.3 & 69.3 & 887 & 11.1 \\
        YOLOv5l6 & 1280 & 53.7 & 71.3 & 1784 & 15.8 \\
        YOLOv5x6 & 1280 & 55.0 & 72.7 & 3136 & 26.2 \\
        \bottomrule
    \end{tabular}
    \caption{Network performance}
\end{table}

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .