我正在使用 tabularx 创建一个简单的两列表格,其中包含长文本。第一列应占宽度的约 1/3,第二列应占剩余宽度。
我有两个问题:
表格是在输出中创建的,但如果我添加超过一定数量的文本(我猜这取决于高度?),表格就会消失,只剩下标题。我猜它应该仍然适合页面。对于某些行来说,这也不是问题。我尝试了不同的组合,如果我注释掉足够多的行,它就会起作用。
右侧垂直线未与表格框对齐。
\begin{table}[ht]
\label{tab:capitalism}
\caption{The grammar of the project-oriented justificatory regime~\autocite[123]{capitalism}.}
\begin{tabularx}{\linewidth}{|>{\hsize=.35\hsize}X|X|}
\hline
\multicolumn{2}{|X|}{Seventh justificatory regime} \tabularnewline \hline
Equivalency principle (genereal standard) & Activity; project initiation; remote links between people \tabularnewline \hline
A state of smallness & Inability to get involved, to trust in others, to communicate; close-mindedness, prejudice, authoritarianism, intolerance, stability, overreliance on one's roots, rigidity, etc. \tabularnewline \hline
A state of greatness & Adaptability, flexibility, polyvalence; sincerity in face-to-face encounters; ability to spread the benefits of social connections, to generate enthusiasm and to increase teammates' employability \tabularnewline \hline
Directory of subjects & Managers, coaches, innovators \tabularnewline \hline
Directory of objects & Computer and information technologies; New organisational devices (sub-contracting, flexibility, outsourcing, autonomous units, franchises, etc.) \tabularnewline \hline
Natural relationships & Trusting and being trustworthy; ability to communicate; adaptability to others' needs \tabularnewline \hline
Greatness ratio & `Great' persons enhance `small' person' employability in return for their trust and enthusiasm for project work, i.e., their ability to take part in another project \tabularnewline \hline
%Format of investment & Ready to sacrifice all that could curtail one's availability, giving up lifelong plans \tabularnewline \hline
%Standard (paradigmic) test & Ability to move from one project to another \tabularnewline \hline
%Harmonious figure of natural order & Where the world's natural form resembles that of a network \hline
\end{tabularx}
\end{table}
答案1
tblr
环境的替代解决方案tabularray
包:您可以为列指定系数X
。
\documentclass{article}
\usepackage{biblatex}
\usepackage{caption}
\usepackage{tabularray}
\begin{document}
\begin{table}[htp]
\label{tab:capitalism}
\caption{The grammar of the project-oriented justificatory regime~\autocite[123]{capitalism}.}
\begin{tblr}{
colspec = {|X[1]|X[2]|},
cell{1}{1} = {c=2}{c}, %multicolumn
hlines,
}
Seventh justificatory regime & \\
Equivalency principle (genereal standard) & Activity; project initiation; remote links between people \\
A state of smallness & Inability to get involved, to trust in others, to communicate; close-mindedness, prejudice, authoritarianism, intolerance, stability, overreliance on one's roots, rigidity, etc. \\
A state of greatness & Adaptability, flexibility, polyvalence; sincerity in face-to-face encounters; ability to spread the benefits of social connections, to generate enthusiasm and to increase teammates' employability \\
Directory of subjects & Managers, coaches, innovators \\
Directory of objects & Computer and information technologies; New organisational devices (sub-contracting, flexibility, outsourcing, autonomous units, franchises, etc.) \\
Natural relationships & Trusting and being trustworthy; ability to communicate; adaptability to others' needs \\
Greatness ratio & `Great' persons enhance `small' person' employability in return for their trust and enthusiasm for project work, i.e., their ability to take part in another project \\
\end{tblr}
\end{table}
\end{document}
答案2
以下 MWE 显示了如何最大限度地减少表格中浪费的空白量,同时将第一列的宽度保持在总宽度的大约 1/3。如果您更喜欢使用两个X
类型列的方法,请确保值\hsize
加起来等于 2。或者,您也可以将p
类型列用作第一列,然后让 latex 计算第二列所需的宽度,这应该比使用两个类型列的方法更容易X
。
\documentclass{article}
\usepackage{tabularx}
\usepackage{biblatex}
\usepackage[english]{babel}
\usepackage{calc}
\usepackage{ragged2e}
\begin{document}
\begin{table}
\label{tab:capitalism}
\caption{The grammar of the project-oriented justificatory regime~\autocite[123]{capitalism}.}
\begin{tabularx}{\linewidth}{|>{\RaggedRight\arraybackslash}p{\widthof{Equivalency principle}}|X|}
%\begin{tabularx}{\linewidth}{|>{\hsize=.66\hsize\raggedright\arraybackslash}X|>{\hsize=1.34\hsize}X|}
%\begin{tabularx}{\linewidth}{|>{\raggedright\arraybackslash}p{0.33\textwidth}|X|}
\hline
\multicolumn{2}{|l|}{Seventh justificatory regime} \tabularnewline \hline
Equivalency principle (genereal standard) & Activity; project initiation; remote links between people \tabularnewline \hline
A state of smallness & Inability to get involved, to trust in others, to communicate; close-mindedness, prejudice, authoritarianism, intolerance, stability, overreliance on one's roots, rigidity, etc. \tabularnewline \hline
A state of greatness & Adaptability, flexibility, polyvalence; sincerity in face-to-face encounters; ability to spread the benefits of social connections, to generate enthusiasm and to increase teammates' employability \tabularnewline \hline
Directory of subjects & Managers, coaches, innovators \tabularnewline \hline
Directory of objects & Computer and information technologies; New organisational devices (sub-contracting, flexibility, outsourcing, autonomous units, franchises, etc.) \tabularnewline \hline
Natural relationships & Trusting and being trustworthy; ability to communicate; adaptability to others' needs \tabularnewline \hline
Greatness ratio & `Great' persons enhance `small' person' employability in return for their trust and enthusiasm for project work, i.e., their ability to take part in another project \tabularnewline \hline
Format of investment & Ready to sacrifice all that could curtail one's availability, giving up lifelong plans \tabularnewline \hline
Standard (paradigmic) test & Ability to move from one project to another \tabularnewline \hline
Harmonious figure of natural order & Where the world's natural form resembles that of a network \tabularnewline \hline
\end{tabularx}
\end{table}
\end{document}
答案3
分数的总和\hsize
应等于列数X
。如果您想要 1:2 的比例,则必须使用不同的方法:
\begin{tabularx}{\linewidth}{
|
>{\hsize=\dimexpr 2\hsize/3\relax\raggedright}X
|
>{\hsize=\dimexpr 4\hsize/3\relax}X
|
}
所以总和为 6/3 = 2。
我还建议您采用不同的方法来处理您的餐桌。
\documentclass{article}
\usepackage{tabularx}
\usepackage{biblatex}
\usepackage{caption}
\usepackage{enumitem} % for the second layout
\usepackage{lipsum} % for filler text
\begin{document}
\lipsum[1][1-4]
\begin{table}[htp] % don't forget p
\caption{The grammar of the project-oriented justificatory regime~\autocite[123]{capitalism}.}
\label{tab:capitalism} % the label must go after the caption
\begin{tabularx}{\linewidth}{
|
>{\hsize=\dimexpr 2\hsize/3\relax\raggedright}X
|
>{\hsize=\dimexpr 4\hsize/3\relax}X
|
}
\hline
\multicolumn{2}{|l|}{Seventh justificatory regime}
\tabularnewline \hline
Equivalency principle (general standard) &
Activity; project initiation; remote links between people
\tabularnewline \hline
A state of smallness &
Inability to get involved, to trust in others, to communicate; close-mindedness,
prejudice, authoritarianism, intolerance, stability, overreliance on one's roots,
rigidity, etc.
\tabularnewline \hline
A state of greatness &
Adaptability, flexibility, polyvalence; sincerity in face-to-face encounters;
ability to spread the benefits of social connections, to generate enthusiasm
and to increase teammates' employability
\tabularnewline \hline
Directory of subjects &
Managers, coaches, innovators
\tabularnewline \hline
Directory of objects &
Computer and information technologies; New organisational devices
(sub-contracting, flexibility, outsourcing, autonomous units, franchises, etc.)
\tabularnewline \hline
Natural relationships &
Trusting and being trustworthy; ability to communicate; adaptability to
others' needs
\tabularnewline \hline
Greatness ratio &
`Great' persons enhance `small' person' employability in return for
their trust and enthusiasm for project work, i.e., their ability
to take part in another project
\tabularnewline \hline
%Format of investment &
% Ready to sacrifice all that could curtail one's availability,
% giving up lifelong plans
%\tabularnewline \hline
%Standard (paradigmic) test &
% Ability to move from one project to another
%\tabularnewline \hline
%Harmonious figure of natural order &
%Where the world's natural form resembles that of a network
%\tabularnewline\hline
\end{tabularx}
\end{table}
\lipsum[1-8]
\begin{table}[!htp]
\caption{The grammar of the project-oriented justificatory regime~\autocite[123]{capitalism}.}
\label{tab:capitalism-again} % the label must go after the caption
{\centering Seventh justificatory regime\\}
\begin{itemize}[
align=left,
labelwidth=1em,
leftmargin=1em,
labelsep=0pt,
itemsep=0pt,
]
\item \textit{Equivalency principle (general standard)} \\
Activity; project initiation; remote links between people
\item \textit{A state of smallness} \\
Inability to get involved, to trust in others, to communicate; close-mindedness,
prejudice, authoritarianism, intolerance, stability, overreliance on one's roots,
rigidity, etc.
\item \textit{A state of greatness} \\
Adaptability, flexibility, polyvalence; sincerity in face-to-face encounters;
ability to spread the benefits of social connections, to generate enthusiasm
and to increase teammates' employability
\item \textit{Directory of subjects} \\
Managers, coaches, innovators
\item \textit{Directory of objects} \\
Computer and information technologies; New organisational devices
(sub-contracting, flexibility, outsourcing, autonomous units, franchises, etc.)
\item \textit{Natural relationships} \\
Trusting and being trustworthy; ability to communicate; adaptability to
others' needs
\item \textit{Greatness ratio} \\
`Great' persons enhance `small' person' employability in return for
their trust and enthusiasm for project work, i.e., their ability
to take part in another project
%\item \textit{Format of investment} \\
% Ready to sacrifice all that could curtail one's availability,
% giving up lifelong plans
%
%\item \textit{Standard (paradigmic) test} \\
% Ability to move from one project to another
%
%\item \textit{Harmonious figure of natural order} \\
%Where the world's natural form resembles that of a network
\end{itemize}
\end{table}
\lipsum
\end{document}
实际上,我会避免h
,并可能为材料设置一个较小的尺寸,这样可以更好地将其与上下文区分开来(并占用更少的空间)。
答案4
使用{NiceTabular}
,nicematrix
您可以为X
列提供权重。
\documentclass{article}
\usepackage{caption}
\usepackage{nicematrix}
\begin{document}
\begin{table}[htp]
\label{tab:capitalism}
\caption{The grammar of the project-oriented justificatory regime~1.}
\begin{NiceTabular}{X[l,1]X[2]}[hvlines]
\Block[l]{1-2}{Seventh justificatory regime} \\
Equivalency principle (genereal standard) & Activity; project initiation; remote links between people \\
A state of smallness & Inability to get involved, to trust in others, to communicate; close-mindedness, prejudice, authoritarianism, intolerance, stability, overreliance on one's roots, rigidity, etc. \\
A state of greatness & Adaptability, flexibility, polyvalence; sincerity in face-to-face encounters; ability to spread the benefits of social connections, to generate enthusiasm and to increase teammates' employability \\
Directory of subjects & Managers, coaches, innovators \\
Directory of objects & Computer and information technologies; New organisational devices (sub-contracting, flexibility, outsourcing, autonomous units, franchises, etc.) \\
Natural relationships & Trusting and being trustworthy; ability to communicate; adaptability to others' needs \\
Greatness ratio & `Great' persons enhance `small' person' employability in return for their trust and enthusiasm for project work, i.e., their ability to take part in another project \\
\end{NiceTabular}
\end{table}
\end{document}
您需要多次编译(因为nicematrix
在后台使用 PGF/Tikz 节点)。