# Strange looking table

I am trying to print this rather odd looking table, below

I know there is an package called exam, though I sort of want to do this "my own style"

I did try to make the table below, but I was not even close in doing so.

Most importantly is that the table looks good, not that it is an exact replica of the table. Could anyone be so kind as to help me? I have started learning latex recently, and stumbling down the path of learning =)

EDIT: One could remove the vertical lines furthest to the left and right aswell, then the table would be more inline witht the standard of tables.

Edit2:

\documentclass[10pt,a4paper]{article}
\usepackage{mathtools}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{multicol}

\begin{document}
\noindent \begin{tabular*}{\textwidth}{@{}clccccccccccccccc@{}}
\toprule
& & &  & & & Sum \\
\cmidrule{1-1}\cmidrule(l){2-16}\cmidrule(l){17-17}
\multirow{2}{*}{Part 1} & Problem & 1a1) & 1a2) & 1b1) & 1b2) & 1c & 1d1) & 1d2) & 1e & 1f & 2a & 2b & 2c  \\
&  Score  & 2    & 2    & 2    & 2    & 2  & 2    & 2    & 2  & 2  & 2  &  2 & 2 &  24  \\
\midrule
\multirow{2}{*}{Part 1} & Problem & 1a1) & 1a2) & 1b1) & 1b2) & 1c & 1d1) & 1d2) & 1e & 1f & 2a & 2b & 2c  \\
&  Score  & 2    & 2    & 2    & 2    & 2  & 2    & 2    & 2  & 2  & 2  &  2 & 2 &  24 \\
\cmidrule{1-1}\cmidrule(l){2-17}\cmidrule(l){17-17}
& \multicolumn{5}{r}{Total number of points} & 14 \\
\bottomrule
\end{tabular*}
\end{document}

-
Can you post what you tried so we have something to start with. This should be compilable in that it should include the \documentclass and all the appropriate packages needed fir your version. –  Peter Grill Nov 19 '11 at 0:19
This table is not at all strange looking. :) –  Werner Nov 19 '11 at 0:19
I tried looking into the multirow and multicolumn packages as it seems this would work best. Will update with an minimal example. Reason why I did not do this, is as all my attempts to create the table would not even compile. Also using booktabs for extra nice tables. –  N3buchadnezzar Nov 19 '11 at 0:31
Updated again. Atleast it works for me now, but itss still broken. –  N3buchadnezzar Nov 19 '11 at 3:59
@N3buchadnezzar: what do you mean with "broken"? –  Gonzalo Medina Nov 19 '11 at 4:25

I would try changing the table layout, first of all, suppressing the vertical rules. Using the features provided by the booktabs package you can improve your tables layout. Here are two possibilities:

\documentclass{article}
\usepackage{multirow}
\usepackage{booktabs}

\begin{document}

\noindent\begin{tabular}{@{}clccccc@{}}
\toprule
& & &  & & & Sum \\
\cmidrule{1-1}\cmidrule(l){2-6}\cmidrule(l){7-7}
\multirow{2}{*}{Part 1} & Problem & 1a & 2b & 3a & 5b & \\
& Score  & 2 & 2 & 1 & 2 & 7  \\
\midrule
\multirow{2}{*}{Part 1} & Problem & 6a & 6b & 7a & 8b &  \\
&  Score & 2 & 2 & 1 & 2 & 7  \\
\cmidrule{1-1}\cmidrule(l){2-6}\cmidrule(l){7-7}
& \multicolumn{5}{r}{Total number of points} & 14 \\
\bottomrule
\end{tabular}

\vspace{2cm}

\noindent\begin{tabular}{@{}lccccccccc@{}}
\toprule
& \multicolumn{8}{c}{Part} & Total \\
\cmidrule{2-9}
& \multicolumn{4}{c}{1} & \multicolumn{4}{c}{2} \\
\cmidrule(r){1-1}\cmidrule(lr){2-5}\cmidrule(lr){6-9}\cmidrule(l){10-10}
Problem & 1a & 2b & 3a & 5b & 6a & 6b & 7a & 8b \\
Score & 2 & 2 & 1 & 2 & 2 & 2 & 1 & 2 \\
\cmidrule(r){1-1}\cmidrule(lr){2-5}\cmidrule(lr){6-9}\cmidrule(l){10-10}
Sum & \multicolumn{4}{c}{7} & \multicolumn{4}{c}{7} & 14 \\
\bottomrule
\end{tabular}

\end{document}


Here's a third variant:

\documentclass{article}
\usepackage{multirow}
\usepackage{booktabs}

\begin{document}

\noindent\begin{tabular}{@{}cccc@{}}
\toprule
Part & Problem & Score & Sum \\
\cmidrule(r){1-1}\cmidrule(lr){2-2}\cmidrule(lr){3-3}\cmidrule(l){4-4}
\multirow{4}{*}{1} & 1a & 2 & \multirow{4}{*}{7} \\
& 2b & 2 & \\
& 3a & 1 & \\
& 5b & 2 & \\
\midrule
\multirow{4}{*}{2} & 6a & 2 & \multirow{4}{*}{7} \\
& 6b & 2 & \\
& 7a & 1 & \\
& 8b & 2 & \\
\midrule
& \multicolumn{2}{c}{Total} & 14 \\
\bottomrule
\end{tabular}

\end{document}


-
That looks really good =) I think I will use the bottom one. I have tried for almost 30 minutes now to produce something good. Could you perhaps take a look at my code and tell me why it will not compile? If i remove the multicol arguments in the second row, it compiles. I guess I need to learn this stuff too and not just copy =) Great job once again! –  N3buchadnezzar Nov 19 '11 at 1:24
@N3buchadnezzar: the second argument of \multicolumn can only take one value: l, r, c, p{<length>} (or any other column type, but only one value). –  Gonzalo Medina Nov 19 '11 at 1:32
@N3buchadnezzar: also, the third argument of \multicolumn cannot contain alignment characters &. The third argument is used for the material (text, in most cases) that will span the selected number of columns. –  Gonzalo Medina Nov 19 '11 at 2:33
Gah! Your code breaks down, with the number of elements I need in that table... I updated my first post. Perhaps your last solution is the best? –  N3buchadnezzar Nov 19 '11 at 3:37
@N3buchadnezzar: there are some strategies to reduce a table width: 1) Change \tabcolsep (default value = 6pt); you can say, for example, \setlength\tabcolsep{3pt} just before \begin{tabular}. 2) Reduce the font size; for this, you can use one of th font switches \small, \footnotesize; again this goes right before \begin{tabular}. To keep those changes local, you can use a pair of braces: {\small\begin{tabular}{...}...\end{tabular}}`. Of course you can try one or both methods. –  Gonzalo Medina Nov 19 '11 at 3:59
show 1 more comment