我试图为学校制作一张表格,必须按照 OCTAVE allegro 方法完成。在表格的最后一行,我有一个嵌套表格,但我的分隔符longtable
影响了嵌套tabular
,并且垂直线与我的文本相交。
\begin{longtable}{|p{10em}|p{14em}|p{14em}|}
\hline
Allegro Worksheet 8 &\multicolumn{2}{|c|}{Critical Information Asset Profile} \\
\hline
\makecell*[{{p{11em}}}]{\textbf{(1) Critical Asset} \\ \\
\textit{What is the critical information asset?}} &
\makecell*[{{p{14em}}}]{\textbf{(2) Rationale for Selection} \\ \\
\textit{Why is this information asset important to
the organization?}} &
\makecell*[{{p{11em}}}]{\textbf{(3) Description}\\ \\
\textit{What is the agreed-upon description of
this information asset?}} \\
\hline
\multicolumn{1}{|p{5cm}|}{\textbf{ text goes here}}
&
\multicolumn{1}{|p{4cm}|}{\textbf{Text goes here}}
&
\multicolumn{1}{|p{5cm}|}{\textbf{text goes here}} \\
\hline
\multicolumn{2}|{l|}{\makecell*[{{p{16em}}}]{\textbf{(4) Owner(s)}\\ \\
\textit{Who owns this information asset?}}} &\\
\hline
\multicolumn{2}|{l|}{\makecell*[{{p{16em}}}]{\textbf{ Answer goes here.................}}} &\\
\hline
\renewcommand\labelitemi{$\square$}
\begin{itemize}
\item \textbf{Confidentiality}
\end{itemize}
&
Only authorized personnel can view this information asset, as follows:
&
\\
\hline
\renewcommand\labelitemi{$\square$}
\begin{itemize}
\item \textbf{Integrity}
\end{itemize}
&
Only authorized personnel can view this information asset, as follows:
&
\\
\hline
\makecell*[{{p{14em}}}]{\renewcommand\labelitemi{$\square$}
\begin{itemize}
\item \textbf{Availability}
\end{itemize}}
&
\makecell*[{{p{14em}}}]{This asset must be available for these personnel to do their jobs, as follows:
\\ \\
This asset must be available for ... hours, ... days/week, ... weeks/year. }
&
\makecell*[{{p{14em}}}]{
\\ \\ }
\\ \hline
\renewcommand\labelitemi{$\square$}
\begin{itemize}
\item \textbf{Other}
\end{itemize}
&
Only authorized personnel can view this information asset, as follows:
&
\\
\hline
\multicolumn{2}|{l}{\makecell*[{{p{30em}}}]{\textbf{(6) Most important Security Requirement}\\ \\
\textit{What is the most important security requirement for this information asset.?}}} &\\
\hline
\begin{tabular}{p{10em}|p{10.65em}|p{10em}|p{10em}|}
\renewcommand\labelitemi{$\square$}
\begin{itemize}
\item \textbf{Confidentiality}
\end{itemize}
&
\renewcommand\labelitemi{$\square$}
\begin{itemize}
\item \textbf{Integrity}
\end{itemize}
&
\renewcommand\labelitemi{$\square$}
\begin{itemize}
\item \textbf{Availability}
\end{itemize}
&
\renewcommand\labelitemi{$\square$}
\begin{itemize}
\item \textbf{Other}
\end{itemize}
\end{tabular} \\
\hline
\end{longtable}
答案1
这是您的表格的改进版本:
\documentclass{article}
\usepackage{fullpage}
\usepackage{longtable}
\usepackage{makecell}
\usepackage{amssymb}
\usepackage{enumitem}
\newlist{checkbox}{itemize}{2}
\setlist[checkbox]{label=$\square$,
topsep = 0pt,
partopsep = 0pt,
before = \vspace{-0.6\baselineskip},
leftmargin=*}
\newenvironment{enumsquare}[1][]
{\begin{checkbox}[before=\bfseries,#1]}
{\end{checkbox}}
\begin{document}
\begin{longtable}{|m{4.7cm}|m{4.6cm}|m{4.7cm}|}
\hline
Allegro Worksheet 8 &\multicolumn{2}{c|}{Critical Information Asset Profile} \\
\hline
\textbf{(1) Critical Asset} & \textbf{(2) Rationale for Selection} & \textbf{(3) Description} \\[1ex]
\textit{What is the critical information asset?} &
\textit{Why is this information asset important to the organization?} &
\textit{What is the agreed-upon description of this information asset?} \\
\hline
\textbf{ text goes here}
&
\textbf{Text goes here}
&
\textbf{text goes here} \\
\hline
\multicolumn{3}{|l|}{\textbf{(4) Owner(s)}}\\[1ex]
\multicolumn{3}{|l|}{\textit{Who owns this information asset?}}\\
\hline
\multicolumn{3}{|l|}{\textbf{ Answer goes here.................}}\\
\hline
\begin{enumsquare}
\item Confidentiality
\end{enumsquare}
&
Only authorized personnel can view this information asset, as follows:
&
\\
\hline
\begin{enumsquare}
\item Integrity
\end{enumsquare}
&
Only authorized personnel can view this information asset, as follows:
&
\\
\hline
\begin{enumsquare}
\item Availability
\end{enumsquare}
&
\makecell[{{m{4.6cm}}}t]{This asset must be available for these personnel to do their jobs, as follows:
\\This asset must be available for ... hours, ... days/week, ... weeks/year. }
&
\\
\hline
\begin{enumsquare}
\item Other
\end{enumsquare}
&
Only authorized personnel can view this information asset, as follows:
&
\\
\hline
\multicolumn{3}{|l|}{\textbf{(6) Most important Security Requirement}}\\[1ex]
\multicolumn{3}{|l|}{\textit{What is the most important security requirement for this information asset.?}}\\
\hline
\multicolumn{3}{|l|}{
\begin{tabular}{m{10em}|m{10em}|m{10em}|m{10em}}
\begin{enumsquare}
\item Confidentiality
\end{enumsquare}
&
\begin{enumsquare}
\item Integrity
\end{enumsquare}
&
\begin{enumsquare}
\item Availability
\end{enumsquare}
&
\begin{enumsquare}
\item Other
\end{enumsquare}
\end{tabular} }\\
\hline
\end{longtable}
\end{document}
与原始代码相比我所做的更改:
- 将嵌套表格置于多列环境中以消除垂直线
- 删除了不必要的
\multicolumn
命令 - 定义新的自定义列表以摆脱重复的
\renewcommand\labelitemi{$\square$}
命令\textbf
- 删除了一些
|
导致线条粗细不一致的问题 - 删除了大部分
makecell
命令。 - ...
一般性评论:由于所有垂直和水平线,您的表格看起来非常拥挤。因此,在接下来的 MWE 中,我删除了所有线条,而是从booktabs
包中插入了一些水平线以及一些空白作为眼睛的引导:
\documentclass{article}
\usepackage{fullpage}
\usepackage{longtable}
\usepackage{makecell}
\usepackage{amssymb}
\usepackage{enumitem}
\newlist{checkbox}{itemize}{2}
\setlist[checkbox]{label=$\square$,
topsep = 0pt,
partopsep = 0pt,
before = \vspace{-0.6\baselineskip},
leftmargin=*}
\newenvironment{enumsquare}[1][]
{\begin{checkbox}[before=\bfseries,#1]}
{\end{checkbox}}
\usepackage{booktabs}
\begin{document}
\begin{longtable}{m{4.7cm}m{4.6cm}m{4.7cm}}
Allegro Worksheet 8 &\multicolumn{2}{c}{Critical Information Asset Profile} \\
\toprule
\textbf{(1) Critical Asset} & \textbf{(2) Rationale for Selection} & \textbf{(3) Description} \\[1ex]
\textit{What is the critical information asset?} &
\textit{Why is this information asset important to the organization?} &
\textit{What is the agreed-upon description of this information asset?} \\
\textbf{ text goes here}
&
\textbf{Text goes here}
&
\textbf{text goes here} \\
\midrule
\multicolumn{3}{l}{\textbf{(4) Owner(s)}}\\[1ex]
\multicolumn{3}{l}{\textit{Who owns this information asset?}}\\
\multicolumn{3}{l}{\textbf{ Answer goes here.................}}\\
\midrule
\begin{enumsquare}
\item Confidentiality
\end{enumsquare}
&
Only authorized personnel can view this information asset, as follows:
&
\\ \addlinespace
\begin{enumsquare}
\item Integrity
\end{enumsquare}
&
Only authorized personnel can view this information asset, as follows:
&
\\ \addlinespace
\begin{enumsquare}
\item Availability
\end{enumsquare}
&
\makecell[{{m{4.6cm}}}t]{This asset must be available for these personnel to do their jobs, as follows:
\\This asset must be available for ... hours, ... days/week, ... weeks/year. }
&
\\ \addlinespace
\begin{enumsquare}
\item Other
\end{enumsquare}
&
Only authorized personnel can view this information asset, as follows:
&
\\
\midrule
\multicolumn{3}{l}{\textbf{(6) Most important Security Requirement}}\\[1ex]
\multicolumn{3}{l}{\textit{What is the most important security requirement for this information asset.?}}\\
\multicolumn{3}{l}{
\begin{tabular}{m{10em}m{10em}m{10em}m{10em}}
\begin{enumsquare}
\item Confidentiality
\end{enumsquare}
&
\begin{enumsquare}
\item Integrity
\end{enumsquare}
&
\begin{enumsquare}
\item Availability
\end{enumsquare}
&
\begin{enumsquare}
\item Other
\end{enumsquare}
\end{tabular} }\\
\bottomrule
\end{longtable}
\end{document}