如何在tabu中正确合并单元格?

如何在tabu中正确合并单元格?

我有一个禁忌表,我需要制作这样的表格:(
我不知道如何正确创建第五列)

在此处输入图片描述

现在我的代码如下所示:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[russian]{babel}  % Включаем пакет для поддержки русского
\usepackage{tabu}
\usepackage[a4paper, portrait, margin=1in, hmargin=2cm, top=4cm, bottom=4cm, headheight=3cm, footskip=2.5cm]{geometry}

{\small \begin{center}
\tabulinesep=0.5mm
\begin{tabu} to \textwidth { | X[0.1,l,p] | X[0.8,l,p] |  X[0.5,l,p] | X[0.8,l,p] | X[0.8,l,p] |   }
\hline
 \textbf{№} & \textbf{Описание отклонения:}  & \textbf{Департамент:} & \textbf{Идентифицированный риск} & \textbf{Не идентифицированный риск 1}     \\ \hline
  1 & Отклонение 1  & Департамент 1 & Риск 1 & Описание не идентифицированного риска  \\ \hline
 \end{tabu}
\end{center}
\end{document}

在此处输入图片描述

答案1

由于时间已经过去很久了,我不认为你仍然需要答案,但为了后人:

文档tabu:tabu 文档的第 12/101 页第 2.3 节提供了我与之结合的多列演示multirow。请原谅我糟糕的翻译,我不想与计算机上的字符映射作斗争。

我更喜欢longtable,所以我在下面包含了两者的粗略实现。

禁忌版本

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[russian]{babel}  % Включаем пакет для поддержки русского
\usepackage{tabu}
\usepackage[a4paper, portrait, margin=1in, hmargin=2cm, top=4cm, bottom=4cm, headheight=3cm, footskip=2.5cm]{geometry}

\usepackage{multirow}

\begin{document}

{\small \begin{center}
\tabulinesep=0.5mm

% DEMO from page 12/101 section 2.3 of tabu documentation
%\begin{tabu}{|X|X|X[2]|} \tabucline-
%   a & b & c \\ \tabucline-
%   \multicolumn2{|c|}{Hello} & World \\ \tabucline-
%   \tabuphantomline
%\end{tabu}


\begin{tabu} to \textwidth { | X[0.1,l,p] | X[0.8,l,p] |  X[0.5,l,p] | X[0.8,l,p] | X[0.8,l,p] |  X[0.8,l,p] | }
    \hline
    \textbf{№} & \textbf{Description of deviation:}  & \textbf{Department:} & \textbf{Identified risk} & \multicolumn2{|c|}{\textbf{Not Identified risk 1}}     \\ \hline
    \multirow{2}{*}{1} & \multirow{2}{*}{Deviation 1}  & \multirow{2}{*}{Department of 1} & \multirow{2}{*}{Risk 1} & Description no identified risk & Our Risk 1  \\ \cline{5-6}
    & & & & Objecct/Process during which risk appeared & Object 1  \\ \hline

  \tabuphantomline
\end{tabu}
\end{center}
\end{document}

在此处输入图片描述

长桌版

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[russian]{babel}  % Включаем пакет для поддержки русского
\usepackage[a4paper, portrait, margin=1in, hmargin=2cm, top=4cm, bottom=4cm, headheight=3cm, footskip=2.5cm]{geometry}

\usepackage{environ,longtable,threeparttablex,booktabs,multirow,array,adjustbox,supertabular}% table adjustment packages

% Wrapping text in multicolumn:  http://tex.stackexchange.com/questions/115668/wrapping-text-in-multicolumn
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}p{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}p{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}p{#1}}
%http://tex.stackexchange.com/questions/70919/vertical-aligning-in-longtable-environment

\begin{document}

{\small \begin{center}
\begin{longtable}[l]{| L{0.025\textwidth} | L{0.1\textwidth} | L{0.15\textwidth} | L{0.2\textwidth} | L{0.3\textwidth} | L{0.15\textwidth} |}

    \hline
    \textbf{№} & \textbf{Description of deviation:}  & \textbf{Department:} & \textbf{Identified risk} & \multicolumn2{|c|}{\textbf{Not Identified risk 1}}     \\ \hline
    \multirow{2}{*}{1} & \multirow{2}{*}{Deviation 1}  & \multirow{2}{*}{Department of 1} & \multirow{2}{*}{Risk 1} & Description no identified risk & Our Risk 1  \\ \cline{5-6}
    & & & & Objecct/Process during which risk appeared & Object 1  \\ \hline
\end{longtable}
\end{center}
\end{document}

在此处输入图片描述

相关内容