即使格式正确,表格也不会显示

即使格式正确,表格也不会显示

我也构建了一个表格,但第二个表格没有出现。这是输出: https://i.stack.imgur.com/crapl.jpg 以下是表格:

\begin{tabular}{p{6cm}p{6cm}}
    \begin{tabular}{ll}
    \toprule
    \textbf{{Cognitive-intellectual field}} \\
    \midrule
    Thinking fluidly & Generating large amounts of ideas \\
    Thinking more... & Fast flow of thought \\
    & Number of relevant answers & \\
    \\
    Flexible thinking & Variety of types of ideas \\
    Take different approaches & Ability to move from one category to another \\
    & Change direction of thought by bypassing obstacles \\
    \\
    Original thought & Unusual answers \\
    Think in new or unique ways & Smart ideas \\
    & Mental production that deviates from the obvious \\
    \\
    Elaborative thinking & Embellish an idea or a simple answer to make it more elegant \\
    Add to... & Extend or expand reasoning or ideas
    \end{tabular}
    \\[10em]
    \begin{tabular}{lll}
    \toprule
    \textbf{Emotional setting (personality)} \\
    \midrule
    Availability to take risks & Expose to failure or criticism \\
    Have the courage to... & Try to guess \\
    & Work well even in unstructured conditions \\
    & Defend your ideas \\
    \\
    Complexity & Look for numerous alternatives \\
    Feeling challenged... & See the gap between how things are and how they should be \\
    & Restore order starting from chaos \\
    & Move into intricate ideas or problems \\
    \\
    Curiosity & Be inquisitive and fantasize \\
    Wanting to... & Play with an idea \\
    & Be open to bewildering situations \\
    & Meditate on the mystery of things \\
    \\
    Imagination & Visualize and build mental images \\
    To have the power of... & Dreaming of things that never happened \\
    & Feel intuitively \\
    & Go beyond sensory limits or real characteristics \\
    \noalign
    \end{tabular}
    \\[5em]
    % Colour for the rulings in tables:
    \makeatletter
       \def\rulecolor#1#{\CT@arc{#1}}
       \def\CT@arc#1#2{%
       \ifdim\baselineskip=\z@\noalign\fi
       {\gdef\CT@arc@{\color#1{#2}}}}
       \let\CT@arc@\relax
      \rulecolor{gray!50}
    \makeatother
\end{tabular}

答案1

您可能对以下内容更满意:

在此处输入图片描述

tabularx我对表格的两个部分都使用了单一环境。这可确保表格的宽度仅与当前文本宽度(或您指定的任何其他宽度)一样宽。我还对\multicolumn{2}{l}{...}“标题”使用了单一环境。这可确保左列与内容一样宽,而不考虑标题文本的宽度。因此,列之间未使用的空白空间会减少。我还用包\addlinespace中的命令替换了空booktabs行。垂直空白比空行略小,但仍在行之间提供足够的视觉分隔。最后,我还添加了一个更简单的表格线条着色变体。取消下面代码中的三行注释,表格将呈现灰色线条而不是黑色线条。

\documentclass{article}
\usepackage{booktabs}
\usepackage{tabularx}
%% \usepackage[table]{xcolor} % uncomment for light gray lines in table
\begin{document}

%%{\arrayrulecolor{gray!50} % uncomment for light gray lines in table
\noindent
    \begin{tabularx}{\textwidth}{lX}
    \toprule
    \multicolumn{2}{l}{\textbf{{Cognitive-intellectual field}}} \\
    \midrule
    Thinking fluidly & Generating large amounts of ideas \\
    Thinking more... & Fast flow of thought \\
    & Number of relevant answers  \\
    \addlinespace
    Flexible thinking & Variety of types of ideas \\
    Take different approaches & Ability to move from one category to another \\
    & Change direction of thought by bypassing obstacles \\
    \addlinespace
    Original thought & Unusual answers \\
    Think in new or unique ways & Smart ideas \\
    & Mental production that deviates from the obvious \\
    \addlinespace
    Elaborative thinking & Embellish an idea or a simple answer to make it more elegant \\
    Add to... & Extend or expand reasoning or ideas\\
    \\
    \midrule
    \multicolumn{2}{l}{\textbf{Emotional setting (personality)}} \\
    \midrule
    Availability to take risks & Expose to failure or criticism \\
    Have the courage to... & Try to guess \\
    & Work well even in unstructured conditions \\
    & Defend your ideas \\
    \addlinespace
    Complexity & Look for numerous alternatives \\
    Feeling challenged... & See the gap between how things are and how they should be \\
    & Restore order starting from chaos \\
    & Move into intricate ideas or problems \\
    \addlinespace
    Curiosity & Be inquisitive and fantasize \\
    Wanting to... & Play with an idea \\
    & Be open to bewildering situations \\
    & Meditate on the mystery of things \\
    \addlinespace
    Imagination & Visualize and build mental images \\
    To have the power of... & Dreaming of things that never happened \\
    & Feel intuitively \\
    & Go beyond sensory limits or real characteristics \\
   \bottomrule
    \end{tabularx}
%%} % uncomment for light gray lines in table
\end{document}

答案2

如果您确实希望两个子表中的第一列宽度不同...

这是您作为 MWE 的表格,但很难理解您想要实现什么。如您所见,两个嵌套表格进入主表格的第一列,在第二个嵌套表格中,您定义了三列,但使用了两列。

子表格比文档边距宽。可以通过减小边距来解决此问题,只需添加

\usepackage[left=2.5cm, right=2.5cm]{geometry} 

到 MWE 的序言。最后一个单元格中定义的命令似乎是尝试使用灰色规则。相反,使用

\arrayrulecolor{gray!50}

为了避免过满hboxes和复杂的列计算,我将主表转换为 tabularx-table 并将第二列设为 X 列。

在此处输入图片描述

\documentclass{article}
\usepackage{booktabs}
\usepackage[table]{xcolor}
 \arrayrulecolor{gray!50}
 \usepackage[left=2.5cm, right=2.5cm]{geometry}
 \usepackage{tabularx}


\begin{document}

\noindent\begin{tabularx}{\linewidth}{@{}lX@{}}
    \begin{tabular}{ll}
    \toprule
    \textbf{{Cognitive-intellectual field}} \\
    \midrule
    Thinking fluidly & Generating large amounts of ideas \\
    Thinking more... & Fast flow of thought \\
    & Number of relevant answers  \\
    \\
    Flexible thinking & Variety of types of ideas \\
    Take different approaches & Ability to move from one category to another \\
    & Change direction of thought by bypassing obstacles \\
    \\
    Original thought & Unusual answers \\
    Think in new or unique ways & Smart ideas \\
    & Mental production that deviates from the obvious \\
    \\
    Elaborative thinking & Embellish an idea or a simple answer to make it more elegant \\
    Add to... & Extend or expand reasoning or ideas
    \end{tabular}
    \\[10em]
    \begin{tabular}{lll}
    \toprule
    \textbf{Emotional setting (personality)} \\
    \midrule
    Availability to take risks & Expose to failure or criticism \\
    Have the courage to... & Try to guess \\
    & Work well even in unstructured conditions \\
    & Defend your ideas \\
    \\
    Complexity & Look for numerous alternatives \\
    Feeling challenged... & See the gap between how things are and how they should be \\
    & Restore order starting from chaos \\
    & Move into intricate ideas or problems \\
    \\
    Curiosity & Be inquisitive and fantasize \\
    Wanting to... & Play with an idea \\
    & Be open to bewildering situations \\
    & Meditate on the mystery of things \\
    \\
    Imagination & Visualize and build mental images \\
    To have the power of... & Dreaming of things that never happened \\
    & Feel intuitively \\
    & Go beyond sensory limits or real characteristics \\
 %   \noalign
    \end{tabular}
    \\[5em]
%    % Colour for the rulings in tables:
%    \makeatletter
%       \def\rulecolor#1#{\CT@arc{#1}}
%       \def\CT@arc#1#2{%
%       \ifdim\baselineskip=\z@\noalign\fi
%       {\gdef\CT@arc@{\color#1{#2}}}}
%       \let\CT@arc@\relax
%      \rulecolor{gray!50}
%    \makeatother
\end{tabularx}

\end{document}

相关内容