以表格形式列出

以表格形式列出

我正在创建一个包含两列的表。其中一列包含一个列表。以下是代码。

\begin{table}[] 
\resizebox{\textwidth}{!}{%
    \centering
    \begin{tabular}{|l|l|}
        \hline
        \textbf{Activity} & \textbf{Research Questions} \\ \hline
        \begin{tabular}[c]{@{}l@{}}Flower Specification \\and Interpretation~~~\end{tabular} & \begin{tabular}{@{\labelitemi\hspace{\dimexpr\labelsep+0.5\tabcolsep}}l@{}}What are the different types of Flowers?\\ What are the different fragrances to express or define the flowers?\\ What are the different flower plantation methods?\\ What are various attributes a flower can have?\\ What are various steps and methods/techniques to grow a flower into a hostile (extreme cold or hot) weather?\end{tabular} \\ \hline     
\end{tabular}}  
\end{table}
  1. 我想将虚线列表更改为编号列表。
  2. 我想将“问题 5”分成两行,同时保留列表结构(附件是预期的表格)。在此处输入图片描述

答案1

借助enumitem编号列表和tabularx列宽自动调整为文本宽度的表格:

在此处输入图片描述

\documentclass{article}
\usepackage{tabularx}

\usepackage{enumitem}
\newlist{tabenum}{enumerate}{1}
\setlist[tabenum]{label*=\arabic*.,
                  leftmargin=*,
                  nosep,
                  before=\begin{minipage}[t]{\hsize},
                  after=\end{minipage}}

% only used for second example:
\usepackage{booktabs}
\begin{document}

\begin{table}
    \begin{tabularx}{\linewidth}{|>{\raggedright\arraybackslash}p{3.25cm}|X|}
        \hline
        \textbf{Activity} & \textbf{Research Questions} \\ \hline
        Flower Specification and Interpretation 
        & \begin{tabenum}
        \item What are the different types of Flowers?
        \item What are the different fragrances to express or define the flowers?
        \item What are the different flower plantation methods?
        \item What are various attributes a flower can have?
        \item What are various steps and methods/techniques to grow a flower into a hostile (extreme cold or hot) weather?
        \end{tabenum} \\ \hline     
\end{tabularx}
\end{table}

\begin{table}
    \begin{tabularx}{\linewidth}{>{\raggedright\arraybackslash}p{3.25cm}X}
        \toprule
        Activity & Research Questions \\ \midrule
        Flower Specification and Interpretation 
        & \begin{tabenum}
        \item What are the different types of Flowers?
        \item What are the different fragrances to express or define the flowers?
        \item What are the different flower plantation methods?
        \item What are various attributes a flower can have?
        \item What are various steps and methods/techniques to grow a flower into a hostile (extreme cold or hot) weather?
        \end{tabenum} \\ \bottomrule     
\end{tabularx}
\end{table}

\end{document}

答案2

那这个呢?请注意,为了在 2 行中显示数字 5,我必须将表格宽度设置为 1.2 \textwidth。您应该将其更改为刚好\textwidth,但这样您就有 3 行了。

\documentclass{article}
\usepackage{enumitem}
\usepackage{tabularx}

\begin{document}
    \renewcommand{\arraystretch}{1.5}
    
    \begin{table}[]
        \centering

        \begin{tabularx}{1.2\textwidth}{|p{3cm}|X|}
            \hline
            \textbf{Activity} & \textbf{Research question}  \\ \hline
            Flower specification and Interpretation & \vspace{-6mm}\begin{enumerate} \item What are the different types of Flowers? \item What are the different fragrances to express or define the flowers? \item What are the different flower plantation methods? \item What are various attributes a flower can have? \item What are various steps and methods/techniques to grow a flower into a hostile (extreme cold or hot) weather? \end{enumerate} \\ \hline
        \end{tabularx}
    \end{table}


\end{document}

在此处输入图片描述

相关内容