3

How can I solve this graphical problem please?

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[czech]{babel} 
\usepackage{multicol}
\usepackage{enumitem}
\usepackage{tabularx}
\usepackage{caption} 
\usepackage{multirow}
\usepackage{array}
\newcolumntype{?}{!{\vrule width 1.5pt}}
\usepackage[table]{xcolor}
\usepackage{tabularx, makecell}
\usepackage{caption}
\usepackage{cellspace}
\usepackage{etoolbox}
\preto\tabular{\shorthandoff{-}}


\begin{document}


\begin{table}[h!]\footnotesize
    \caption{Zářič $^{137}$Cs - přirozené pozadí}
    \centering
        \begin{tabular}{?c|c|c|c|c|c?}
        \Xhline{4\arrayrulewidth}

\multicolumn{1}{?c?}{\cellcolor{gray!25}$PEAK$ [keV]} & \multicolumn{1}{c?}{\centering \cellcolor{gray!25}$E_{tab}$ [keV]} & \multicolumn{1}{c?}{\centering Zdroj \cellcolor{gray!25}} & \multicolumn{1}{c?}{\centering \cellcolor{gray!25}$FWHM$ [keV]} & \multicolumn{1}{m{1.2cm}?}{\centering $NET$ \cellcolor{gray!25}} & \multicolumn{1}{m{1.2cm}?}{$GROSS$ \cellcolor{gray!25}}\\         

\Xhline{4\arrayrulewidth}
&&&&&\\[-10pt]
609,35& 609,31& \multirow{4}{*}{$^{214}$Bi} & 1,38&   539&    4675\\ 
\cline{1-2} \cline{4-6}
&&&&&\\[-10pt]
1120,29&    1120,29&    &   1,95&   558&    1530\\  
\cline{1-2} \cline{4-6}
&&&&&\\[-10pt]
1764,57&    1764,49&    &   2,08&   451&    574\\
\cline{1-2} \cline{4-6}
&&&&&\\[-10pt]
2204,36&    2204,21&    &   1,86&   141&    188\\
\hline
&&&&&\\[-10pt]
1460,81&    1460,75&    $^{40}$K&   1,73&   422&    738\\
\hline
&&&&&\\[-10pt]
74,71&  \multirow{2}{*}{rtg}&    \multirow{2}{*}{$^{214}$Pb}& 1,15&   2321&   34035\\
\cline{1-1} \cline{4-6}
&&&&&\\[-10pt]
84,54&  &   &   1,22&   891&    16412\\

        \Xhline{4\arrayrulewidth}
        \end{tabular}

    \label{Cs}
\end{table}
\end{document}

enter image description here

EDIT

I tried according to Bernard's script another table and TeXMaker doesn't translate it, so I can't see where are mistakes. Do you know please where is a problem? Thank you

\begin{table}[h!]\footnotesize
    \caption{Zářič $^{137}$Cs}
    \centering
        \begin{tabular}{V{4}c|c|c|c|cV{4}}
        \Xhline{4\arrayrulewidth}        
       \rowcolor{gray!25}      
             \multicolumn{1}{V{4}cV{4.8}}|}{Pozorovaný objekt} & \multicolumn{1}{cV{3cm}|}{Určená hodnota $E$ [keV]} & \multicolumn{1}{cV{3.5cm}|}{Tabelovaná hodnota energie $E$ [keV]} & \multicolumn{1}{cV{1.5cm}|}{$\mathit{FWHM}$ [keV]} &\multicolumn{1}{V{1.5}m{1.2cm}V{4}}{\textit{NET}}\\

            \Xhline{4\arrayrulewidth}

&&&&\\[-10pt]
Energie $\gamma $-záření (FEP)& \centering  $661,68 \pm 0,02$& \centering   $661,66$& \centering    $1,5$&$70096$\\
\hline
Poloha comptonovy hrany& \centering $478 \pm 4$&\centering  477,34 (shoduje se s~teoretickou)&  &   \\
\hline
Hraniční energie dvojného comptonova rozptylu&\centering    $565 \pm 12$&\centering 554,58& &       \\
\hline
&&&&\\[-10pt]
Poloha píků zpětného rozptylu&\centering    $182 \pm 4$&\centering  184,32& &       \\

        \Xhline{4\arrayrulewidth}
        \end{tabular}

    \label{Cs}
\end{table}
  • 1
    \centering does nothing in l c or r columns, but you have not said what the problem is with your table. You have marked the join of the thick and thin lines in blue, but have not said how you want them changed, they do not look nice but it is hard to make them look better if you want to change the line widths (I would not do that) Unrelated but do not use math italic for words, $GROSS$ should be $\mathrm{GROSS}$ (or simply GROSS) – David Carlisle Oct 27 '18 at 7:45
  • I would like to vertical thin lines go from the midle of vertical bold lines. $GROSS$ is wrong even if it is a name of quantity? – Elisabeth Oct 27 '18 at 7:51
  • 1
    the math italic font is designed to make adjacent letters not look like a word but like a product of variables, it should never be used for any multi-letter identifiers, you can use \mathit or \mathrm to get fonts designed for words in mathematics. Note $\mathit{GROSS}$ is not the same as $GROSS$ – David Carlisle Oct 27 '18 at 7:53
3

I propose this variant, with the boldline package (so needless to define a new column type): a vertical line specified in the table preamble with V{x} produces a line of width x times \arrayrulewidth. I simplified the code for colouring column heads with the \rowcolor command, and removed the unnecessary \centering directives in columns of type c. Finally, I removed every double package loading.

\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{-}}

\begin{document}

\begin{table}[h!]\footnotesize
\caption{Zářič $^{137}$Cs - přirozené pozadí}
\centering
    \begin{tabular}{V{4}c|c|c|c|c|cV{4}}
    \Xhline{4\arrayrulewidth}
    \rowcolor{gray!25}
    \multicolumn{1}{V{4}cV{2.5}}{\textit{PEAK} [keV]} & \multicolumn{1}{V{1.5}cV{2.5}}{\centering $E_{\text{tab}}$ [keV]} & \multicolumn{1}{V{1.5}cV{2.5}}{\centering Zdroj} & \multicolumn{1}{V{1.5}cV{2.5}}{\textit{FWHM} [keV]} & \multicolumn{1}{V{1.5}m{1.2cm}V{2.5}}{\centering \textit{NET} } & \multicolumn{1}{V{1.5}m{1.2cm}V{4}}{\textit{GROSS}}\\

    \Xhline{4\arrayrulewidth}
    &&&&&\\[-10pt]
    609,35& 609,31& \multirow{4}{*}{$^{214}$Bi} & 1,38& 539& 4675\\
    \cline{1-2} \cline{4-6}
    &&&&&\\[-10pt]
    1120,29& 1120,29& & 1,95& 558& 1530\\
    \cline{1-2} \cline{4-6}
    &&&&&\\[-10pt]
    1764,57& 1764,49& & 2,08& 451& 574\\
    \cline{1-2} \cline{4-6}
    &&&&&\\[-10pt]
    2204,36& 2204,21& & 1,86& 141& 188\\
    \hline
    &&&&&\\[-10pt]
    1460,81& 1460,75& $^{40}$K& 1,73& 422& 738\\
    \hline
    &&&&&\\[-10pt]
    74,71& \multirow{2}{*}{rtg}& \multirow{2}{*}{$^{214}$Pb}& 1,15& 2321& 34035\\
    \cline{1-1} \cline{4-6}
    &&&&&\\[-10pt]
    84,54& & & 1,22& 891& 16412\\
    \Xhline{4\arrayrulewidth}
    \end{tabular}
\label{Cs}
\end{table}

\end{document} 

enter image description here

  • Thank you very much for perfect question. Please the last question: what is an alternative of \multirow{4}{*}{$^{214}$Bi} for columns? – Elisabeth Oct 27 '18 at 9:07
  • Do you mean for typing the isotope of bismuth? or for \multirow? – Bernard Oct 27 '18 at 9:29
  • I mean: this [1]: i.stack.imgur.com/SNPbD.png to be one cell – Elisabeth Oct 27 '18 at 9:33
  • 1
    Oh! I see. It is \multicolumn{4}{specifier}{content}, where specifier should be c, l or r, depending on the alignment you want. – Bernard Oct 27 '18 at 9:37
  • Thank you I need to do more tables and I have problem with translating - I edited a question. Please can you help me? – Elisabeth Oct 27 '18 at 9:40
4
  • indicated graphical problem can not be solved.
  • use thick lines as you like to have to may not appear as nice table design. better is not used thick vertical lines

off-topic

  • it is sufficient to load each package only once
  • instead use \cellcolor in each cell in row is simpler use ˙\rowcolor`
  • vertical spacing of your cell is strange. why you not exploit loaded cellspace?
  • why you not use mchem package for writing chemical elements?

\documentclass[12pt,a4paper]{article}
\usepackage[table]{xcolor}
\usepackage{array, cellspace, makecell, multirow, tabularx}
\newcolumntype{?}{!{\vrule width 1.5pt}}
\setlength\cellspacetoplimit{4pt}
\setlength\cellspacebottomlimit{4pt}
\newcommand\mc[1]{\multicolumn{1}{Sc?}{#1}}
\usepackage{caption}
\usepackage{etoolbox}
%\preto\tabular{\shorthandoff{-}}

\begin{document}
    \begin{table}[ht!]
    \footnotesize
    \caption{Zářič $^{137}$Cs - přirozené pozadí}
    \label{Cs}
    \centering
        \begin{tabular}{?Sc? *{4}{Sc|}c?}
        \Xhline{4\arrayrulewidth}
        \rowcolor{gray!25}
\multicolumn{1}{?c?}{$PEAK$ [keV]}
    & \mc{$E_{tab}$ [keV]}
        & \mc{Zdroj}
            & \mc{$FWHM$ [keV]}
                & \mc{$NET$}
                    & \mc{$GROSS$}\\
        \Xhline{4\arrayrulewidth}
%    &&&&&\\[-10pt]
609,35  & 609,31& \multirow{5.2}{*}{$^{214}$Bi} & 1,38&   539&    4675\\
        \cline{1-2} \cline{4-6}
%&&&&&\\[-10pt]
1120,29&    1120,29&    &   1,95&   558&    1530\\
    \cline{1-2} \cline{4-6}
%&&&&&\\[-10pt]
1764,57&    1764,49&    &   2,08&   451&    574\\
        \cline{1-2} \cline{4-6}
%&&&&&\\[-10pt]
2204,36&    2204,21&    &   1,86&   141&    188\\
        \hline
%&&&&&\\[-10pt]
1460,81&    1460,75&    $^{40}$K&   1,73&   422&    738\\
        \hline
%&&&&&\\[-10pt]
74,71 &  \multirow{2}{*}{rtg} & \multirow{2.4}{*}{$^{214}$Pb}& 1,15&   2321&   34035\\
        \cline{1-1} \cline{4-6}
%&&&&&\\[-10pt]
84,54&  &   &   1,22&   891&    16412\\
        \Xhline{4\arrayrulewidth}
    \end{tabular}
\end{table}
\end{document}

enter image description here

addendum:

i would redesign your table to:

enter image description here

\documentclass[12pt,a4paper]{article}
\usepackage{booktabs, makecell, multirow}
\renewcommand\theadgape{}                       % <--- new
\usepackage[version=4]{mhchem}                  % <--- new
\usepackage[group-minimum-digits=4] {siunitx}   % <--- new
\usepackage[skip=1ex]{caption}

\begin{document}
    \begin{table}[ht!]
    \caption{Zářič \ce{^{137}Cs} - přirozené pozadí}    % <--- changed
    \label{Cs}
    \centering
\begin{tabular}{S[table-format=4.2] % <--- changed
                S[table-format=4.2] % <--- changed
                c
                S[table-format=1.2] % <--- changed
                S[table-format=4.0] % <--- changed
                S[table-format=5.0] % <--- changed
                }
    \toprule    % <--- changed
{\thead{\textit{PEAK}\\ {[keV]}}}   % <--- changed
            & {\thead{$E_{\text{tab}}$\\ {[keV]}}}  % <--- changed
                      & {\textit{Zdroj}}    % <--- changed
                            & {\thead{\textit{FWHM}\\ {[keV]}}} % <--- changed
                                    & {\textit{NET}}    % <--- changed
                                            & {\textit{GROSS}}\\    % <--- changed
        \midrule    % <--- changed
    609,35  &  609,31 & \multirow{4}{*}{\ce{^{214}Bi}}  % <--- changed
                            & 1,38  & 539   & 4675  \\
    1120,29 & 1120,29 &     & 1,95  & 558   & 1530  \\
    1764,57 & 1764,49 &     & 2,08  & 451   &  574  \\
    2204,36 & 2204,21 &     & 1,86  & 141   &  188  \\
        \addlinespace   % <--- new
    1460,81&    1460,75&    \ce{^{40}K}                 % <--- changed
                            & 1,73  & 422   &  738  \\
        \addlinespace   % <--- new
    74,71 &  {\multirow{2}{*}{rtg}}
                      & \multirow{2}{*}{\ce{^{214}Pb}}  % <--- changed
                            & 1,15  & 2321  & 34035 \\
    84,54 &           &     & 1.22  &  891  & 16412 \\
       \bottomrule  % <--- changed
\end{tabular}
    \end{table}
\end{document}
  • 1
    Very useful comments! (+1). However, the graphical problem can be solved, see my answer using boldline. – Bernard Oct 27 '18 at 8:43
  • 1
    @Bernard, thank you for comment! and +1 for boldline. in your answer. i wasn't aware for this package. – Zarko Oct 27 '18 at 10:05
1
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[czech]{babel} 
\usepackage{multicol}
\usepackage{enumitem}
\usepackage{tabularx}
\usepackage{caption} 
\usepackage{multirow}
\usepackage{array}
\newcolumntype{?}{!{\vrule width 1.5pt}}
\usepackage[table]{xcolor}
\usepackage{tabularx, makecell}
\usepackage{caption}
\usepackage{cellspace}
\usepackage{etoolbox}
\preto\tabular{\shorthandoff{-}}


\begin{document}


\begin{table}[h!]\footnotesize
    \caption{Zářič $^{137}$Cs - přirozené pozadí}
    \centering
\doublerulesepcolor{black}
        \begin{tabular}{?c||c|c|c|c|c?}
        \Xhline{4\arrayrulewidth}

\multicolumn{1}{?c|}{\cellcolor{gray!25}$PEAK$ [keV]} & \multicolumn{1}{c|}{\centering \cellcolor{gray!25}$E_{tab}$ [keV]} & \multicolumn{1}{c|}{\centering Zdroj \cellcolor{gray!25}} & \multicolumn{1}{c|}{\centering \cellcolor{gray!25}$FWHM$ [keV]} & \multicolumn{1}{m{1.2cm}|}{\centering $NET$ \cellcolor{gray!25}} & \multicolumn{1}{m{1.2cm}?}{$GROSS$ \cellcolor{gray!25}}\\         

\Xhline{4\arrayrulewidth}
&&&&&\\[-10pt]
609,35& 609,31& \multirow{4}{*}{$^{214}$Bi} & 1,38&   539&    4675\\ 
\cline{1-2} \cline{4-6}
&&&&&\\[-10pt]
1120,29&    1120,29&    &   1,95&   558&    1530\\  
\cline{1-2} \cline{4-6}
&&&&&\\[-10pt]
1764,57&    1764,49&    &   2,08&   451&    574\\
\cline{1-2} \cline{4-6}
&&&&&\\[-10pt]
2204,36&    2204,21&    &   1,86&   141&    188\\
\hline
&&&&&\\[-10pt]
1460,81&    1460,75&    $^{40}$K&   1,73&   422&    738\\
\hline
&&&&&\\[-10pt]
74,71&  \multirow{2}{*}{rtg}&    \multirow{2}{*}{$^{214}$Pb}& 1,15&   2321&   34035\\
\cline{1-1} \cline{4-6}
&&&&&\\[-10pt]
84,54&  &   &   1,22&   891&    16412\\

        \Xhline{4\arrayrulewidth}
        \end{tabular}

    \label{Cs}
\end{table}
\end{document}
  • Thank you, but it is possible to make vertical lines in the first row bold? – Elisabeth Oct 27 '18 at 7:55
  • Or... does it look better? – Elisabeth Oct 27 '18 at 8:03
  • There is a bold line now, try it and see how you like it. – LPH Oct 27 '18 at 8:09
  • If you'd like a thiner line it is possible. – LPH Oct 27 '18 at 8:18

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.