Graphics, Figures & TablesProblem with multicolumn

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
beiti
Posts: 2
Joined: Thu Sep 08, 2016 10:16 am

Problem with multicolumn

Post by beiti »

I'm trying to layout a grade sheet for teachers. However, multicolumn at "Oral Part." doesn't seem to work, and I can't figure out why.

Code: Select all

\documentclass[a4paper,10pt]{scrartcl}

\usepackage{tabularx}
\usepackage{multirow}
\usepackage{graphicx}
\usepackage[default]{lato}

\begin{document}
    \begin{tabularx}{\textwidth}{|p{2.9cm}||X|X|X|X||X|X|X||X|X||X||X|X|X||X|}
        \hline
        Name & \multicolumn{4}{X||}{Oral Part.} & \multicolumn{3}{X||}{Reading} & \multicolumn{2}{X||}{Essay} & \multirow{2}{*}{\rotatebox[origin=c]{270}{Total}} & \multirow{2}{*}{\rotatebox[origin=c]{270}{Quiz}} & \multirow{2}{*}{\rotatebox[origin=c]{270}{Test}} & \multirow{2}{*}{\rotatebox[origin=c]{270}{Total}} & \multirow{2}{*}{\rotatebox[origin=c]{270}{Final}} \\
        & 1 & 2 & 3 & 4 & 1 & 2 & 3 & 1 & 2 & &  & & & \\
        \hline
        \hline
        \vspace*{6mm}& & & & & & & & & & & & & & \\
        \hline
        \vspace*{6mm}& & & & & & & & & & & & & & \\
        \hline
    \end{tabularx}
\end{document}
Any idea?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Problem with multicolumn

Post by Johannes_B »

Welcome, very good minimal example.

Code: Select all

\documentclass[a4paper,10pt]{scrartcl}

\usepackage{tabularx}
\usepackage{multirow}
\usepackage{graphicx}
\usepackage[default]{lato}

\begin{document}
\noindent\begin{tabularx}{\textwidth}{|p{1.3cm}||X|X|X|X||X|X|X||X|X||X||X|X|X||X|}
	\hline
	Name & \multicolumn{4}{c||}{Oral Part.} & \multicolumn{3}{c||}{Reading} & \multicolumn{2}{c||}{Essay} & \multirow{2}{*}{\rotatebox[origin=c]{270}{Total}} & \multirow{2}{*}{\rotatebox[origin=c]{270}{Quiz}} & \multirow{2}{*}{\rotatebox[origin=c]{270}{Test}} & \multirow{2}{*}{\rotatebox[origin=c]{270}{Total}} & \multirow{2}{*}{\rotatebox[origin=c]{270}{Final}} \\
	& 1 & 2 & 3 & 4 & 1 & 2 & 3 & 1 & 2 & &  & & & \\
	\hline
	\hline
	\vspace*{6mm}& & & & & & & & & & & & & & \\
	\hline
	\vspace*{6mm}& & & & & & & & & & & & & & \\
	\hline
\end{tabularx}
\end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
beiti
Posts: 2
Joined: Thu Sep 08, 2016 10:16 am

Re: Problem with multicolumn

Post by beiti »

Thanks and understood.
Very logical, once you think about it.
Post Reply