我有一张使用以下代码的表格:
\documentclass{article}
\usepackage[table]{xcolor}
\usepackage{booktabs}% http://ctan.org/pkg/booktabs
\newcommand{\tabitem}{~~\llap{\textbullet}~~}
\setlength{\arrayrulewidth}{0.15mm}
\setlength{\tabcolsep}{18pt}
\renewcommand{\arraystretch}{0.2}
\usepackage[utf8]{inputenc}
\usepackage{enumitem}
\usepackage{setspace}
\usepackage{amsmath}
\usepackage{url}
\usepackage{ragged2e} % <---
\usepackage{lineno}
\usepackage{tabularx} % <---
\usepackage{amssymb}
\usepackage{booktabs}
\usepackage{graphicx}
\graphicspath{ {images/} }
\usepackage[font=normalsize,labelfont=bf]{caption}
\captionsetup{justification=raggedright, singlelinecheck=false }
\usepackage{enumitem, etoolbox}
\AtBeginEnvironment{table}{\setlist[itemize, 1]{wide=0pt, leftmargin= *, topsep=0pt, itemsep=0pt, labelsep=.333em,
before=\leavevmode\vspace*{-\baselineskip},after= \vspace*{-\baselineskip}}}
\newcolumntype{I}{ >{\itemize}X<{\enditemize}}
\usepackage{makecell}
\renewcommand\theadfont{\normalsize\bfseries}
\usepackage{xcolor}
\begin{document}
\begin{table}[!htb]
\centering%
\setlength{\tabcolsep}{1pt}
\caption{Title}
\tiny
\begin{tabularx}{\linewidth}{@{}l>{\RaggedRight}X>{\RaggedRight}X%
>{\RaggedRight}I}% The target layout does not centre the text so we don't want \centering
\toprule% nicer rules courtesy of booktabs - but then we need to drop the verticals
& \thead{Vulnerabilities} & \thead{Solution} & \multicolumn{1}{c}{\bfseries Comment}%
\tabularnewline\midrule%
\textbf{1} &Secrets are managed and deployed by k8s and runtime&
Offload the secret management and deployment to secret manager and the shield
% \begin{itemize}
% \item I would like this text to be bulleted with ragged right. I would also like this text to be bulleted with ragged right.
% \item I would also like this text to be bulleted with ragged right.
% \item I would also like this text to be bulleted with ragged right.
% \end{itemize}
&
\item Vulnerability resolved.
\item A demo can be found in section 3.
% \item I would also like this text to be bulleted with ragged right.
% \item I would also like this text to be bulleted with ragged right.
\tabularnewline
\addlinespace\midrule%
\textbf{2} &EXEC operation
\begin{enumerate}[label=(\alph*)]
\item Missing authentication and access control
\item Commands are transmitted by untrusted runtime
\end{enumerate}
& Add EXEC checker in Qkernel and cryptographic protection for privileged commands
&
\item Vulnerability resolved.
\item A demo can be found in section 3.
\tabularnewline
\addlinespace\midrule%
\textbf{3} & Lack of protection for STDIO of process
& Add STDIO shield in Qkernel
&
\item STDIO shield only encrypts STDOUT and STDERR (Demo in Section 3)
\item Protection for STDIO of interactive process (i.e., terminal) is out of the scope
\tabularnewline
\addlinespace\midrule%
\textbf{4(a)} & Lack of protection for data written to volume
& Add filesystem shield (Section 3)
&
\item Out of the scope
\tabularnewline
\addlinespace\midrule%
\textbf{4(b)} & Loading compromised binary and share library
& Add software measurement manager in Qkernel (Section 3)
&
\item Vulnerability resolved
\item Demo can be found in section 3 and 3.
\tabularnewline
\bottomrule
\end{tabularx}
\end{table}
\end{document}
问题 1:如何comment
使solution
问题 2:如何使列表与EXEC OPERATION
有什么想法可以修复桌子并使其变得更美观吗?
问题3:从图2可以看出,两根柱子靠得太近了。知道如何调整它们之间的距离吗?
图 2:
答案1
我的主要建议是不要使用\tiny
。而是加载rotating
包并将tabularx
环境放置在sidewaystable
表格将以横向格式呈现的环境中。
为了缓解列间间隙过窄的问题,请删除\setlength\tabcolsep{1pt}
紧接在 之前的指令\caption{Title}
。同时,请删除更早的指令。(对于和许多其他文档类,\setlength{\tabcolsep}{18pt}
此参数的默认值为。)article
6pt
为了让桌子看起来更加开放、更加吸引人,我接下来将\midrule
用\addlinespace
指令替换内部指令。
\documentclass{article}
\usepackage{booktabs,ragged2e,tabularx,rotating}
\newcolumntype{L}{>{\RaggedRight}X}
\usepackage{caption}
\captionsetup{%
justification=raggedright,
singlelinecheck=false,
labelfont=bf, % is this really needed?
skip=0.5\baselineskip}
\usepackage{enumitem} % for \newlist and \setlist macros
% Define compact forms of 'itemize' and 'enumerate'
% environments, for use in tables:
\newlist{tabitemize}{itemize}{1}
\setlist[tabitemize,1]{%
label= \textbullet, left=0pt, nosep,
before=\begin{minipage}[t]{\hsize},
after= \end{minipage}}
\newlist{tabenumerate}{enumerate}{1}
\setlist[tabenumerate,1]{%
label=(\alph*), left=0pt, nosep, align=left,
before=\begin{minipage}[t]{\hsize},
after= \end{minipage}}
\begin{document}
\begin{sidewaystable}
\caption{Title}
\begin{tabularx}{\linewidth}{@{} l LLL @{}}
\toprule
& Vulnerabilities & Solution & Comment \\
\midrule
\textbf{1}
& Secrets are managed and deployed by k8s and runtime
& Offload the secret management and deployment to secret manager and the shield
&
\begin{tabitemize}
\item Vulnerability resolved.
\item A demo can be found in section 3.
\end{tabitemize} \\
\addlinespace
\textbf{2}
& EXEC operation
\begin{tabenumerate}
\item Missing authentication and access control
\item Commands are transmitted by untrusted runtime
\end{tabenumerate}
& Add EXEC checker in Qkernel and cryptographic protection for privileged commands
&
\begin{tabitemize}
\item Vulnerability resolved.
\item A demo can be found in section~3.
\end{tabitemize} \\
\addlinespace
\textbf{3}
& Lack of protection for STDIO of process
& Add STDIO shield in Qkernel
&
\begin{tabitemize}
\item STDIO shield only encrypts STDOUT and STDERR (Demo in Section~3)
\item Protection for STDIO of interactive process (i.e., terminal) is out of the scope
\end{tabitemize} \\
\addlinespace
\textbf{4(a)}
& Lack of protection for data written to volume
& Add filesystem shield (Section~3)
&
\begin{tabitemize}
\item Out of the scope
\end{tabitemize} \\
\addlinespace
\textbf{4(b)}
& Loading compromised binary and share library
& Add software measurement manager in Qkernel (Section~3)
&
\begin{tabitemize}
\item Vulnerability resolved
\item Demo can be found in section 3 and 3.
\end{tabitemize} \\
\bottomrule
\end{tabularx}
\end{sidewaystable}
\end{document}