0

Please how to repair errors in this table? Thank you

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[czech]{babel}
\usepackage{amsmath}
\usepackage{multicol}
\usepackage{enumitem}
\usepackage{multirow}
\usepackage{array}
\usepackage[table]{xcolor}
\usepackage{tabularx, makecell, boldline}
\usepackage{caption}
\usepackage{cellspace}
\usepackage{etoolbox}
\preto\tabular{\shorthandoff{-}}
\newcolumntype{C}[1]{>{\centering\arraybackslash}m{#1}}
\begin{document}


       \begin{table}[h!]
\footnotesize
\caption{Určování prvků na základě jejich charakteristického rentgenového záření}
\centering
\begin{tabular}{?C{0.8cm}|C{0.9cm}|C{1cm}|C{1cm}|C{1.6cm}|C{1cm}|C{1cm}|C{1.5cm}|C{0.8cm}|C{1cm}?}


    \Xhline{4\arrayrulewidth}
    \rowcolor{gray!25}
    \multicolumn{1}{V{4}C{0.8cm}V{2.5}}{Vzorek} & \multicolumn{1}{V{1.5}C{0.9cm}V{2.5}}{\centering $t$ [s] } & \multicolumn{1}{V{1.5}C{1cm}V{2.5}}{\centering $\mathit{PEAK}$ [keV]} & \multicolumn{1}{V{1.5}C{1.2cm}V{2.5}}{$\mathit{FWHM}$ [keV]} & \multicolumn{1}{V{1.5}C{1.6cm}V{2.5}}{$\mathit{NET}$ $\mathit{AREA}$} & \multicolumn{1}{V{1.5}C{1cm}V{2.5}}{\centering $\mathit{N. A. R.}$ [cps]} & \multicolumn{1}{V{1.5}C{1cm}V{2.5}}{\centering \%$\mathit{ERR}$ [cps]} & \multicolumn{1}{V{1.5}C{1.5cm}V{2.5}}{\centering Prvek} & \multicolumn{1}{V{1.5}C{0.8cm}V{2.5}}{\centering Přech.} &  \multicolumn{1}{V{1.5}C{1cm}V{4}}{$E_{\rm{pre}}$ [keV]}\\

\Xhline{4\arrayrulewidth}

\multirow{6}{*}{1}& \multirow{6}{*}{391,36}&    \multirow{6}{*}{8,23}&  \multirow{6}{*}{1,54}&  \multirow{6}{*}{$13138 \pm 184$}&   \multirow{6}{*}{42,90}& \multirow{6}{*}{1,4}&   \multirow{6}{*}{$^{29}$Cu}& kraj&   8,979\\
&   &   &   &   &   &   &   &   K$\beta $1& 8,904\\
&   &   &   &   &   &   &   &   K$\beta $2& 8,976\\
&   &   &   &   &   &   &   &   K$\beta $3& 8,904\\
&   &   &   &   &   &   &   &   K$\alpha $1&    8,046\\
&   &   &   &   &   &   &   &   K$\alpha $2&    8,026\\
\Xhline{4\arrayrulewidth}
\multirow{6}{*}{2}& \multirow{6}{*}{391,64}&    \multirow{4}{*}{28,58}& \multirow{4}{*}{1,43}&  \multirow{4}{*}{$6649 \pm 210$}&    \multirow{4}{*}{27,46}& \multirow{6}{*}{1,16}&  \multirow{6}{*}{$^{50}$Sn}& kraj&   29,200\\
&   &   &   &   &   &   &   &   K$\beta $1& 28,481\\
&   &   &   &   &   &   &   &   K$\beta $2& 29,104\\
&   &   &   &   &   &   &   &   K$\beta $3& 28,439\\
\cline{3-6} \cline{9-10}
&   &   \multirow{2}{*}{25,25}& \multirow{2}{*}{1,37}&  \multirow{2}{*}{$29684 \pm 343$ }&  \multirow{2}{*}{101,23}&    &   &   K$\alpha $1&    25,267\\
&   &   &   &   &   &   &   &   K$\alpha $2&    25,04\\
\Xhline{4\arrayrulewidth}
\multirow{6}{*}{3}& \multirow{6}{*}{391,46}&    \multirow{2}{*}{20,22}& \multirow{2}{*}{1,25}&  \multirow{2}{*}{$17689 \pm 310$}&   \multirow{2}{*}{72,61}& \multirow{6}{*}{1,75}&  \multirow{6}{*}{$^{45}$Rh}& K$\alpha $1&    20,213\\
&   &   &   &   &   &   &   &   K$\alpha $2&    20,070\\
\cline{3-6} \cline{9-10}
&   &   \multirow{4}{*}{22,80}& \multirow{4}{*}{1,08}&  \multirow{4}{*}{$2799 \pm 176$}&    \multirow{4}{*}{19,24}& &   &   K$\beta $1& 22,720\\
&   &   &   &   &   &   &   &   K$\beta $2& 23,169\\
&   &   &   &   &   &   &   &   K$\beta $3& 22,695\\
&   &   &   &   &   &   &   &   kraj&   23,224\\
\Xhline{4\arrayrulewidth}
\multirow{6}{*}{6}& \multirow{6}{*}{392,12}&    \multirow{2}{*}{15,80}& \multirow{2}{*}{1,19}&  \multirow{2}{*}{$14398 \pm 344$}&   \multirow{2}{*}{73,92}& \multirow{6}{*}{2,39}&  \multirow{6}{*}{$^{40}$Zr}& K$\alpha $1&    15,772\\
&   &   &   &   &   &   &   &   K$\alpha $2&    15,688\\
\cline{3-6} \cline{9-10}
&   &   \multirow{4}{*}{17,94}& \multirow{4}{*}{0,26}&  \multirow{4}{*}{$640 \pm 187$}& \multirow{4}{*}{20,51}& &   &   K$\beta $1& 17,665\\
&   &   &   &   &   &   &   &   K$\beta $2& 17,967\\
&   &   &   &   &   &   &   &   K$\beta $3& 17,651\\
&   &   &   &   &   &   &   &   kraj&   17,998\\
\Xhline{4\arrayrulewidth}
\multirow{5}{*}{4}& \multirow{5}{*}{486,7}& \multirow{2}{*}{10,57}& \multirow{2}{*}{1,15}&  \multirow{2}{*}{$6598 \pm 293$}&    \multirow{2}{*}{32,47}& \multirow{5}{*}{4,44}&  \multirow{5}{*}{$^{77}$Pb}& L$\alpha$1& 10,550\\
&   &   &   &   &   &   &   &   L$\alpha$2& 10,448\\
\cline{3-6} \cline{9-10}
&   &   \multirow{3}{*}{12,74}& \multirow{3}{*}{0,97}&  \multirow{3}{*}{$3857 \pm 229$}&    \multirow{3}{*}{27,30}& &   &   L$\beta$1&  12,612\\
&   &   &   &   &   &   &   &   L$\beta$2&  12,621\\
&   &   &   &   &   &   &   &   L$\beta$2&  12,791\\
\Xhline{4\arrayrulewidth}
\multirow{6}{*}{11}&    \multirow{6}{*}{420,52}&    \multirow{2}{*}{23,18}& \multirow{2}{*}{1,32}&  \multirow{2}{*}{$31332 \pm 380$}&   \multirow{2}{*}{106,91}&    \multirow{6}{*}{1,21}&  \multirow{6}{*}{$^{48}$Cd}& K$\alpha $1&    23,170\\
&   &   &   &   &   &   &   &   K$\alpha $2&    22,980\\
\cline{3-6} \cline{9-10}
&   &   \multirow{4}{*}{26,24}& \multirow{4}{*}{1,22}&  \multirow{4}{*}{$8108 \pm 234$}&    \multirow{4}{*}{32,64}& &   &   kraj&   26,711\\
&   &   &   &   &   &   &   &   K$\beta $1& 26,091\\
&   &   &   &   &   &   &   &   K$\beta $2& 26,639\\
&   &   &   &   &   &   &   &   K$\beta $3& 26,057\\
\Xhline{4\arrayrulewidth}
\multirow{11}{*}{13}&   \multirow{11}{*}{1573,08}&  \multirow{2}{*}{10,54}& \multirow{2}{*}{1,01}&  \multirow{2}{*}{$13512 \pm 428$}&   \multirow{2}{*}{23,32}& \multirow{10}{*}{0,82}& \multirow{10}{*}{$^{77}$Pb,$^{50}$Sn}&  L$\alpha$1& 10,550\\
&   &   &   &   &   &   &   &   L$\alpha$2& 10,448\\
\cline{3-6} \cline{9-10}
&   &   \multirow{3}{*}{12,81}& \multirow{3}{*}{1,55}&  \multirow{3}{*}{$14265 \pm 464$}&   \multirow{3}{*}{27,39}& &   &   L$\beta$1&  12,612\\
&   &   &   &   &   &   &   &   L$\beta$2&  12,621\\
&   &   &   &   &   &   &   &   L$\beta$2&  12,791\\
\cline{3-6} \cline{9-10}
&   &   \multirow{2}{*}{25,24}& \multirow{2}{*}{1,46}&  \multirow{2}{*}{$56756 \pm 467$}&   \multirow{2}{*}{43,10}& &   &   K$\alpha $1&    25,267\\
&   &   &   &   &   &   &   &   K$\alpha $2&    25,040\\
\cline{3-6} \cline{9-10}
&   &   \multirow{4}{*}{28,62}& \multirow{4}{*}{1,33}&  \multirow{4}{*}{$9802 \pm 275$}&    \multirow{4}{*}{11,59}& &   &   kraj&   29,200\\
&   &   &   &   &   &   &   &   K$\beta $1& 28,481\\
&   &   &   &   &   &   &   &   K$\beta $2& 29,104\\
&   &   &   &   &   &   &   &   K$\beta $3& 28,439\\
\Xhline{4\arrayrulewidth}
\multirow{6}{*}{9}& \multirow{6}{*}{311,00}&    \multirow{2}{*}{17,46}& \multirow{2}{*}{1,30}&  \multirow{2}{*}{$18650 \pm 323$}&   \multirow{2}{*}{93,80}& \multirow{6}{*}{1,73}&  \multirow{6}{*}{$^{42}$Mo}& K$\alpha $1&    17,476\\
&   &   &   &   &   &   &   &   K$\alpha $2&    17,371\\
\cline{3-6} \cline{9-10}
&   &   \multirow{4}{*}{19,84}& \multirow{4}{*}{0,76}&  \multirow{4}{*}{$1675 \pm 161 $}&   \multirow{4}{*}{21,11}& &   &   K$\beta $1& 19,605\\
&   &   &   &   &   &   &   &   K$\beta $2& 19,962\\
&   &   &   &   &   &   &   &   K$\beta $3& 19,587\\
&   &   &   &   &   &   &   &   kraj&   20,002\\



\Xhline{4\arrayrulewidth}

    \end{tabular}
\label{tab}
\end{table}


\end{document}
2

Three errors:

  1. Line 24 where you define the new column type C to take a single argument. However, in the column specification for the tabular, you use

    \begin{tabular}{V{4}C{0.8cm}|C{0.9cm}|C{1.1cm}|C{1.2cm}|C{1.6cm}|C{1.5cm}|C{1cm}|C{1.5cm}|C{1.3cm}|CV{4}{1.5cm}|}
    

    Note that the two last columns have a incorrect use of the new C column. You're probably after ...V{4}C{1.5cm}....

  2. Line 61 has 6598 \pm 293 not in math mode. Use $6598 \pm 293$.

  3. Line 63 has 3857 \pm 229 not in math mode. Use $3857 \pm 229$.

enter image description here

  • Thank you very much. Please, how can I give the content of cells in columns 7 and 8 to the center of the cell? I editted the code in question. – Elisabeth Oct 28 '18 at 7:33
  • 1
    @Elisabeth: In order to vertically center the contents of the 7th and 8th column, use \multicolumn{x}with x being the same number that is used for the multirow commands in the corresponding row of the first and second column. Example: For the last entry, you used \multirow{6}{*}{9}& \multirow{6}{*}{311} in the first and second row, so \multirow{6}{*}{1,73}& \multirow{6}{*}{$^{42}$Mo} will vertically center the corresponding entries in the 7th and 8th colmn as well – leandriis Oct 28 '18 at 9:38
  • And horizontal center please? It should be set here? \newcolumntype{C}[1]{>{\centering\arraybackslash}m{#1}} – Elisabeth Oct 28 '18 at 13:15
  • I don't know, why this command doesn't work. – Elisabeth Oct 28 '18 at 15:21
  • 1
    @Elisabeth: \newcolumntype in the way you defined it will centre the contents of a cell both vertically and horizontally. However, since you want to centre content across a number of cells, you need to use \multirow. Note though that your first row (7th column) centres content using \multirow{6}, while later (in the same column) you use \multirow{4} and then \multirow{2}`. These latter ones should change to cover the number of rows it should be spread over. – Werner Oct 28 '18 at 17:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.