如何创建包含多项内容的表格?

如何创建包含多项内容的表格?

我正在尝试为我的论文创建一个表格。但是它有很多项目。我该怎么做?如果它适合一页就更好了。另外,我如何才能删除表格行之间的空间以使其适合页面?

谢谢你!!

下面是我想要创建的表格:

在此处输入图片描述

答案1

下面是使用\compress宏(可在此站点上找到)的示例,它使 LaTeX 相信我们处于小页面的开头,因此列表不会添加垂直间距,并且使用包添加自定义列表enumitem

\documentclass{article}
\usepackage{caption, tabularx}
\usepackage{enumitem, ragged2e}
\usepackage[svgnames]{xcolor}

\makeatletter
\newcommand*{\compress}{\@minipagetrue}
\makeatother

\begin{document}

\begin{table}[!htb]
\centering
\setlist[itemize]{font= \color{DeepSkyBlue}, wide, leftmargin=*, noitemsep, after=\vspace*{-\topsep}}
\setlength{\extrarowheight}{3pt}
\setlength{\tabcolsep}{3pt}
\caption{Summary of advantages and disadvantages of HEP configurations}
\label{my-label}
\begin{tabularx}{\textwidth}{|p{15mm}|*{2}{>{\compress\RaggedRight\arraybackslash} X |}}
\hline
HEP con\-figuration & Advantages & Disadvantages \\
\hline
Turbo-electric
& \begin{itemize}
  \item Does not depend on ad\-van\-ces of energy storage technologies
\item High design freedom for pro\-pulsional-aircraft integration
\end{itemize}
& \begin{itemize}
  \item High weight and low efficiency
\item Gas turbine engine is sized for peak power conditions
\item Depends on advances in HTS maaterial technology
\end{itemize} \\
\hline
\end{tabularx}
\end{table}

\end{document} 

在此处输入图片描述

答案2

另一种选择(对于错过的 op 的 mwe 使用了很好的 Bernard 回答(+1)):

\documentclass{article}
\usepackage{geometry}
\usepackage{ragged2e}
\usepackage[svgnames]{xcolor}
\usepackage{makecell, tabularx}
    \setcellgapes{2pt}
    \makeatletter
    \newcommand*{\compress}{\@minipagetrue}
    \makeatother
    \newcolumntype{I}{ >{\RaggedRight\compress\itemize}X<{\enditemize}}
    \newcommand*{\mcl}[1]{\multicolumn{1}{l|}{#1}}
\usepackage[skip=1ex]{caption}
\usepackage{enumitem}

\begin{document}
    \begin{table}
    \caption{Parameter settings of the present study}
    \label{5.1}
    \makegapedcells
\setlist[itemize]{font=\color{DeepSkyBlue},
                  nosep,
                  leftmargin=*,
                  after=\vspace*{-\baselineskip}}
    \setlength{\tabcolsep}{3pt}
\begin{tabularx}{\linewidth}{|>{\RaggedRight}p{16mm}|*{2}{I |}}
    \hline
HEP con\-figuration
    &   \mcl{Advantages}    &   \mcl{Disadvantages}        \\
    \hline
Turbo-electric
    &   \item Does not depend on advances of energy storage technologies
        \item High design freedom for propulsion-aircraft integration
        &   \item High weight and low efficiency
            \item Gas turbine engine is sized for peak power conditions
            \item Depends on advances in HTS material technology
            \\
    \hline
Turbo-electric
    &   \item Does not depend on advances of energy storage technologies
        \item High design freedom for propulsion-aircraft integration
        &   \item High weight and low efficiency
            \item Gas turbine engine is sized for peak power conditions
            \item Depends on advances in HTS material technology
            \\
    \hline
\end{tabularx}
    \end{table}
\end{document}

在此处输入图片描述

相关内容