[Tex/LaTex] How to merge cells in longtable

longtablemulticolumnmultirow

I need to create a table which looks like this using longtable :

enter image description here

How to create 5th column correctly?

Code which I have right now:

\documentclass[12pt]{article}
\usepackage{dcolumn,longtable,booktabs}
\usepackage[utf8]{inputenc}
\usepackage[russian]{babel} 
\begin{document}

\begin{center}
\begin{longtable}{|l|l|l|l|l|}

\hline \multicolumn{1}{|l|}{\textbf{№}} & \multicolumn{1}{c|}{\textbf{ОПИСАНИЕ ОТКЛОНЕНИЯ}} & \multicolumn{1}{c|}{\textbf{ДЕПАРТАМЕНТ}}  & \multicolumn{1}{c|}{\textbf{ИДЕНТИФИЦИРОВАННЫЙ РИСК} & \multicolumn{1}{c|}{\textbf{НЕ ИДЕНТИФИЦИРОВАННЫЙ РИСК}  }  \\ \hline 
\endfirsthead

\multicolumn{1}{|c|}{\textbf{№}} & \multicolumn{1}{c|}{\textbf{ОПИСАНИЕ ОТКЛОНЕНИЯ}} &
\multicolumn{1}{c|}{\textbf{ДЕПАРТАМЕНТ}} & \multicolumn{1}{c|}{\textbf{ИДЕНТИФИЦИРОВАННЫЙ РИСК} & \multicolumn{1}{c|}{\textbf{НЕ ИДЕНТИФИЦИРОВАННЫЙ РИСК} \\ \hline 
\endhead

\endfoot

\hline \hline
\endlastfoot

1 & ОТКЛОНЕНИЕ 1 & Департамент 1 & Риск 1 & ОПИСАНИЕ НЕ ИДЕНТИФИЦИРОВАННОГО РИСКА \\ 

\end{longtable}
\end{center}

\end{document}

Best Answer

Here is what i obtain (I put some English text due to my lack of expertise in russian) : enter image description here

The code :

\documentclass[12pt]{article}
\usepackage{dcolumn,longtable,booktabs}
\usepackage[utf8]{inputenc}
\usepackage[russian]{babel} 
\begin{document}

\begin{center}
\begin{longtable}{|l|l|l|l|l|l|}

\hline
1 & 2 & 3 & 4 & \multicolumn{2}{c|}{5-6} \\
\hline
text1   & text 2    & text3     & text4     & text5.1 & text6.1 \\
\cline{5-6}
        &           &           &           & Text5.2 & text5.2 \\
\hline        



\end{longtable}
\end{center}

\end{document}

Specifically, you generally want

  • to specify the maximum number of column there is in your table, and then use \multicolumn when needed
  • the command \cline{X-Y} creates a line only between columns X and Y
Related Question