如何将项目拆分成表格中的列?

如何将项目拆分成表格中的列?

我正在尝试复制一个在两列中使用 itemize 的表格。另请注意,每个类别都在一列中。例如,“路线计划”类别不会泄漏到第二列中。

我正在尝试复制的表格

\begin{table}[]
    \centering
    \begin{tabular}{c}
        \begin{multicols}{2}
        Ship status
        \begin{itemize}
        \item Position
        \item speed
        \end{itemize}
        Equipment status
        \begin{itemize}
            \item Operational status of
            \begin{itemize}
                \item Navigation system
                \item Radio system
            \end{itemize}
        \end{itemize}
        \vfill\null
        \columnbreak
        Traffic and obstacles
        \begin{itemize}
        \item Location of targets
        \end{itemize}
        \vfill\null
        \end{multicols}
    \end{tabular}
    \caption{Caption}
    \label{tab:my_label}
\end{table}

这是我的尝试,但出现以下错误:

\prevdepth 不正确。LaTeX 错误:出现错误 - 可能缺少 \item。\prevdepth 不正确

答案1

像这样:

在此处输入图片描述

\documentclass{article}
\usepackage{enumitem}
\newlist{tabitem}{itemize}{2}% <-- defined new list
\setlist[tabitem]{  topsep=1ex,
                    noitemsep,
                    leftmargin = *,
                    label      = \textbullet,
                    }
\setlist[tabitem,2]{nosep,
                    label = $\circ$,
                    leftmargin=*}
 
 \usepackage{tabularx}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\NewDocumentCommand{\Par}{m}{\par\large #1\par\medskip}
\usepackage{booktabs}

\begin{document}
    \begin{table}[ht]   % <---
    \centering
\begin{tabularx}{\linewidth}{@{} LL @{}}
    \toprule
Ship status 

\begin{tabitem}
\item Position
\item Speed
\item Gyro Heading
\end{tabitem}

Equipment status
\begin{tabitem}
    \item Operational status of
    \begin{tabitem}
        \item Navigation system - GPS, ECDI)S, Radar,
              Automatic Identification System (AIS)  
        \item Radio system - VHF/MF
        \item Stearing system
    \end{tabitem}
\end{tabitem}   &   Traffic and obstacles
                    \begin{tabitem}
                    \item Location of targets
                    \item Number of targets
                    \item Traffic Separation Scheme (TTS) to be followed
                    \item Vessel Traffic Service (VTS) communication frequency
                    \end{tabitem}   \\[-1em]
    \bottomrule
\end{tabularx}
\caption{Caption}
\label{tab:my_label}
    \end{table}
\end{document}

相关内容