1

What is wrong with multicolumn please? There are 8 cells, aren't?

\documentclass[12pt, a4paper]{report}

\usepackage[textwidth=145mm, textheight=247mm, nohead, showframe]{geometry}
\let\openright=\clearpage
%\usepackage[a-2u]{pdfx}
\usepackage[czech]{babel}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage[utf8]{inputenc}
\usepackage{amsmath, graphicx}
\usepackage{array}
\usepackage{caption}
\usepackage[output-decimal-marker={,}]{siunitx}
\NewDocumentCommand{\anote}{}{\makebox[0pt][l]{$^*$}}

\usepackage[usenames]{xcolor}


\usepackage{amsfonts}

\usepackage{makecell,threeparttable}
\usepackage{amssymb}
\usepackage{dcolumn}
%\setlength\heavyrulewidth{0.25ex}
\usepackage{multirow, tabularx}
\newcommand{\mc}[1]{\multicolumn{1}{c}{#1}}
\usepackage{ragged2e}
\newcolumntype{d}[1]{D{.}{,}{#1}}
\newcolumntype{L}{>{\RaggedRight\arraybackslash}X}
\newcommand\stack[1]{\multicolumn{1}{c}{\shortstack{#1}}}
\newcommand{\angstrom}{\mbox{\normalfont\AA}}

\newcolumntype{C}{>{\Centering\arraybackslash\hspace{0pt}}X}
\newcommand\mytab[1]{%
   \bgroup%
   \setlength\extrarowheight{0pt}%
   \smash{\begin{tabular}[t]{@{}c@{}} #1 \end{tabular}}%
   \egroup}
%%% code block to handle the OP's follow-up question -- see
%%% https://tex.stackexchange.com/a/112002/5001 for the source
\usepackage{regexpatch}
\makeatletter
% Change the `-` delimiter to an active character
\xpatchparametertext\@cline{-}{\cA-}{}{}
\makeatother
\hfuzz=99pt

\begin{document}

    \begin{table}[ht!]
    \scriptsize
    \renewcommand{\cellset}{\renewcommand{\arraystretch}{0.75}\scriptsize}
    \setlength\extrarowheight{2pt}
    \setlength\tabcolsep{2pt} % default: 6pt
    \begin{threeparttable}
    \begin{tabularx}{\textwidth}{C|*{2}{C} >{\hsize=0.7\hsize}C >{\hsize=1.3\hsize}Cc*{3}{C}}
    \Xhline{0.8pt}\noalign{\vskip 0.4ex}\Xhline{0.8pt}%
    \multirowcell{4}{Veličina} & \multicolumn{2}{c|}{[1]} & \multicolumn{2}{c|}{[2]} & \multicolumn{1}{c|}{[3]} & \multicolumn{3}{c|}{[4]} \\[0.4ex]
    \cline{2-9}
    \multicolumn{1}{c|}{} &\multicolumn{2}{c|}{\multirowcell{1.5}{PHOEBE fotometrie a RV}}
     &\multicolumn{1}{c|}{\multirowcell{3}{POWR\\ analýza}} & %
    \multicolumn{1}{c|}{\multirowcell{3}{Řešení\\ světelných\\ křivek a RV}} &
   \multicolumn{1}{c|}{ \multirowcell{3}{CFF }}&\multicolumn{1}{c|}{ \multirowcell{3}{Model\\malá\\ hmotnost}} & \multicolumn{1}{c|}{\multirowcell{3}{Model\\ střední\\ hmotnost}} & \multicolumn{1}{c|}{\multirowcell{3}{Model\\ velká\\ hmotnost}} \\[1ex]
    \cline{2-3}
    & \multicolumn{1}{c|}{\multirowcell{1.5}{Řešení II}} & \multicolumn{1}{c|}{\multirowcell{1.5}{Řešení III}} & \multicolumn{1}{c|}{}& \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} \\ [1.5ex]

    \Xhline{0.8pt}%
    &&&&&&\\[-10pt]

\makecell{$P$ \\ (dny)}&    \multicolumn{8}{c}{5,732436}&   &   &   &   &   &   &   \\

  \Xhline{0.8pt}%
     \end{tabularx}
    \end{document}
1
  • 3
    you are trying to create 16 cells in the last line (the makecell, 8 from the multicolumn and then all the &). Commented Dec 21, 2018 at 21:04

1 Answer 1

2

There are several errors in your code.

  1. You opened \begin{table}[ht!] but you did not end it!
  2. \end{threeparttable} is missing. I added it to the right place ...
  3. your last line in table should be build with \makecell{$P$ \\ (dny)}& \multicolumn{8}{c}{5,732436} \\

Please see the following corrected code

\documentclass[12pt, a4paper]{report}

\usepackage[textwidth=145mm, textheight=247mm, nohead, showframe]{geometry}
\let\openright=\clearpage
%\usepackage[a-2u]{pdfx}
\usepackage[czech]{babel}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage[utf8]{inputenc}
\usepackage{amsmath, graphicx}
\usepackage{array}
\usepackage{caption}
\usepackage[output-decimal-marker={,}]{siunitx}
\NewDocumentCommand{\anote}{}{\makebox[0pt][l]{$^*$}}

\usepackage[usenames]{xcolor}


\usepackage{amsfonts}

\usepackage{makecell,threeparttable}
\usepackage{amssymb}
\usepackage{dcolumn}
%\setlength\heavyrulewidth{0.25ex}
\usepackage{multirow, tabularx}
\newcommand{\mc}[1]{\multicolumn{1}{c}{#1}}
\usepackage{ragged2e}
\newcolumntype{d}[1]{D{.}{,}{#1}}
\newcolumntype{L}{>{\RaggedRight\arraybackslash}X}
\newcommand\stack[1]{\multicolumn{1}{c}{\shortstack{#1}}}
\newcommand{\angstrom}{\mbox{\normalfont\AA}}

\newcolumntype{C}{>{\Centering\arraybackslash\hspace{0pt}}X}
\newcommand\mytab[1]{%
   \bgroup%
   \setlength\extrarowheight{0pt}%
   \smash{\begin{tabular}[t]{@{}c@{}} #1 \end{tabular}}%
   \egroup}
%%% code block to handle the OP's follow-up question -- see
%%% https://tex.stackexchange.com/a/112002/5001 for the source
\usepackage{regexpatch}
\makeatletter
% Change the `-` delimiter to an active character
\xpatchparametertext\@cline{-}{\cA-}{}{}
\makeatother
\hfuzz=99pt

\begin{document}

%\begin{table}[ht!] % <=================================================
\scriptsize
\renewcommand{\cellset}{\renewcommand{\arraystretch}{0.75}\scriptsize}
    \setlength\extrarowheight{2pt}
    \setlength\tabcolsep{2pt} % default: 6pt
    \begin{threeparttable}
    \begin{tabularx}{\textwidth}{C|*{2}{C} >{\hsize=0.7\hsize}C >{\hsize=1.3\hsize}Cc*{3}{C}}
    \Xhline{0.8pt}\noalign{\vskip 0.4ex}\Xhline{0.8pt}%
    \multirowcell{4}{Veličina} & \multicolumn{2}{c|}{[1]} & \multicolumn{2}{c|}{[2]} & \multicolumn{1}{c|}{[3]} & \multicolumn{3}{c|}{[4]} \\[0.4ex]
    \cline{2-9}
    \multicolumn{1}{c|}{} &\multicolumn{2}{c|}{\multirowcell{1.5}{PHOEBE fotometrie a RV}}
     &\multicolumn{1}{c|}{\multirowcell{3}{POWR\\ analýza}} & %
    \multicolumn{1}{c|}{\multirowcell{3}{Řešení\\ světelných\\ křivek a RV}} &
   \multicolumn{1}{c|}{ \multirowcell{3}{CFF }}&\multicolumn{1}{c|}{ \multirowcell{3}{Model\\malá\\ hmotnost}} & \multicolumn{1}{c|}{\multirowcell{3}{Model\\ střední\\ hmotnost}} & \multicolumn{1}{c|}{\multirowcell{3}{Model\\ velká\\ hmotnost}} \\[1ex]
    \cline{2-3}
    & \multicolumn{1}{c|}{\multirowcell{1.5}{Řešení II}} & \multicolumn{1}{c|}{\multirowcell{1.5}{Řešení III}} & \multicolumn{1}{c|}{}& \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} \\ [1.5ex]

    \Xhline{0.8pt}%
    &&&&&&\\[-10pt]

%\makecell{$P$ \\ (dny)}&    \multicolumn{8}{c}{5,732436}&   &   &   &   &   &   &   \\
\makecell{$P$ \\ (dny)}&    \multicolumn{8}{c}{5,732436}   \\ % <=======

  \Xhline{0.8pt}%

\end{tabularx}
  \end{threeparttable} % <==============================================
\end{document}

and the result:

enter image description here

You must log in to answer this question.

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