0

How can I please union of cells according to the picture? Thank you.

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[czech]{babel} 
\usepackage{indentfirst}
\usepackage{amsmath}
\usepackage[left=2cm,right=2cm,top=2.5cm,bottom=2.5cm]{geometry}
\usepackage{tabularx}
\usepackage{caption} 
\captionsetup[table]{skip=10pt}
\begin{document}

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

        \hline
        \end{tabular}

    \label{Csp}
\end{table}
\end{document}

enter image description here

Elisabeth
  • 1,009

1 Answers1

1

In order to achieve the desired alignment of a single cell being verttically centered over multiple row, you can make use of the \multirow{<number of rows>}{>width>}{>content>} command as shown in the following example:

\documentclass[12pt,a4paper]{article}
\usepackage[left=2cm,right=2cm,top=2.5cm,bottom=2.5cm]{geometry}
\usepackage{caption} 
\captionsetup[table]{skip=10pt}

\usepackage{multirow}
\begin{document}

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

        \hline
        \end{tabular}

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

enter image description here


In the following exmple, I have made some adjustments in order to improve the alignment of the numbers, and the overall readability of the table. (no vertical lines, horizontal lines from the booktabs package, S type columns from the siunitx package, white space to guide the eye...)

\documentclass[12pt,a4paper]{article}
\usepackage[left=2cm,right=2cm,top=2.5cm,bottom=2.5cm]{geometry}

\usepackage{caption} 
\captionsetup[table]{skip=10pt}
\usepackage{multirow}

\usepackage{booktabs}
\usepackage{siunitx}
\sisetup{output-decimal-marker = {,}}

\begin{document}

\begin{table}[h!]\footnotesize
    \caption{Zářič $^{137}$Cs - přirozené pozadí}
    \centering
        \begin{tabular}{S[table-format=4.2]
                        S[table-format=4.2]
                        c
                        S[table-format=1.2]
                        S[table-format=4]
                        S[table-format=5]}
        \toprule
{PEAK [\si{\kilo\electronvolt}]} &  {E\textsubscript{tab} [\si{\kilo\electronvolt}]]} &Zdroj& {FWHM [\si{\kilo\electronvolt}]]} & {NET} & {GROSS} \\ 
\midrule
609,35& 609,31& \multirow{4}{*}{$^{214}$Bi} & 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
1460,81&    1460,75&    $^{40}$K&   1,73&   422&    738\\ \addlinespace
74,71&  {\multirow{2}{*}{rtg}}&    \multirow{2}{*}{$^{214}$Pb} & 1,15&   2321&   34035\\
84,54&  &   &   1,22&   891&    16412\\
        \bottomrule

\end{tabular}
    \label{Cs}
\end{table}

\end{document}

enter image description here

leandriis
  • 62,593