我唯一想改变的是,项目要点也水平对齐。这意味着我希望每列的第二个项目要点处于相同的“高度”。
不幸的是,直到现在我还不能创建一个看起来像示例的表。
我的 MWE:
\documentclass[12pt, titlepage, a4paper, oneside, headsepline]{scrreprt}
\usepackage[left=3cm,right=2cm,top=1cm,bottom=1cm]{geometry}
\begin{table}[htb]
\centering
\begin{tabularx}{\textwidth}{XXX}
\toprule
\multicolumn{1}{c}{broad} & \multicolumn{1}{c}{middle} & \multicolumn{1}{c}{narrow}\\
\midrule
\tabitem Control of strategic direction & \tabitem Founder or descendant runs the company & \tabitem Presence of multiple generations \\
\tabitem Family participation & \tabitem Firm is intended to remain in the family & \tabitem More than one member of the owner's family with management responsibility \vspace{0.3cm}\\
\multicolumn{1}{c}{$\Downarrow$} \vspace{0.3cm} & \multicolumn{1}{c}{$\Downarrow$} & \multicolumn{1}{c}{$\Downarrow$} \\
\multicolumn{1}{c}{Little direct family involvement} & \multicolumn{1}{c}{Some family involvement} & \multicolumn{1}{c}{Strong family involvement} \\
\bottomrule
\end{tabularx}
\end{table}
使用此代码可以得到:
但是,我需要列宽相同。另外,我希望项目符号后的文本像示例图片中那样缩进。
我不知道下一步该做什么,我完全没有头绪。非常感谢您的帮助!
非常感谢,Lea
答案1
这是我的建议。正如评论中提到的,项目已经垂直对齐。因此,我的回答重点解决第二个问题。
\tabitem
由于问题中没有给出 的定义,而且您对项目的第二行及后续行缺少缩进感到不满意,因此我添加了一个\tabitem
基于enumitem
包的替代命令。我还使用该makecell
包在最后一行引入换行符,因为第一列中的内容对于列宽来说太宽,并导致框溢出警告。我还定义了一种新的左对齐列类型,该类型源自列类型X
。最后,我添加了一些\addlinespace
命令以在行之间添加一些垂直空白。
\documentclass[12pt, titlepage, a4paper, oneside, headsepline]{scrreprt}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage[left=3cm,right=2cm,top=1cm,bottom=1cm]{geometry}
%\newcommand\tabitem{\makebox[1em][r]{\textbullet~}} % Probably your old definition of \tabitem?
\usepackage{enumitem}
\newlist{mytabitem}{itemize}{1}
\setlist[mytabitem]{nosep,leftmargin=*,before=\vspace{-0.5\baselineskip},after=\vspace{-1\baselineskip}, label=\textbullet}
\newcommand{\tabitem}[1]{\begin{mytabitem}\item #1\end{mytabitem}}
\newcolumntype{Y}{>{\raggedright\arraybackslash}X}
\usepackage{makecell}
\begin{document}
\begin{table}[htb]
\centering
\begin{tabularx}{\textwidth}{YYY}
\toprule
\multicolumn{1}{c}{broad} & \multicolumn{1}{c}{middle} & \multicolumn{1}{c}{narrow}\\
\midrule
\tabitem{Control of strategic direction} & \tabitem{Founder or descendant runs the company} & \tabitem{Presence of multiple generations} \\ \addlinespace
\tabitem{Family participation} & \tabitem{Firm is intended to remain in the family} & \tabitem{More than one member of the owner's family with management responsibility} \vspace{0.3cm}\\ \addlinespace
\multicolumn{1}{c}{$\Downarrow$} & \multicolumn{1}{c}{$\Downarrow$} & \multicolumn{1}{c}{$\Downarrow$} \\ \addlinespace
\makecell{Little direct \\ family involvement} & \makecell{Some\\ family involvement} & \makecell{Strong\\ family involvement} \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}
答案2
您的表格太宽,您必须减少左边距(或做其他事情)。我还删除了@{}
列的侧边距( )以改善间距。由于复杂的代码不是问题,我通过定义简写来简化代码,但我专注于简单的代码,以便让您更好地理解,因为您是 LaTeX 新手
原则上,您要做的就是将 itemize 环境添加到第二行的单元格中。然后将第三行单元格的内容移动到每个 itemize 环境的第二个新项目中。我已经加载了枚举项,因为这样您就可以完全控制间距。
最后一行的线条\multicolumn{1}{c}{Text}
会引起问题,因为它们比文本宽度更宽,并且破坏了列的计算表格型。您要么缩小边距,要么减小字体大小,要么将 转换c
为p{}
。即使有左边距2cm
并删除了侧边距,标题家庭直接参与程度较低略宽于 1/3 文本宽度(如果仔细观察,就会发现这一点)。如果可能,您可以删除“direct”一词,减小字体大小\small
或将左右边距设置为 1.9 厘米。
以下是 MWE:
\documentclass[12pt, titlepage, a4paper, oneside, headsepline]{scrreprt}
\usepackage[left=1.9cm,right=1.9cm,top=1cm,bottom=1cm]{geometry}
\usepackage{booktabs, tabularx, enumitem, array}
\usepackage{amsmath}
\makeatletter
\newcolumntype{Y}{>{\raggedright\arraybackslash\@minipagetrue\begin{itemize}[leftmargin=*, nosep]}X<{\end{itemize}}}
\newcommand{\mc}[1]{\multicolumn{1}{@{}c@{}}{#1}}
\makeatother
\begin{document}
\begin{table}
\centering
\begin{tabularx}{\textwidth}{@{}*{3}{Y}@{}}
\toprule
\mc{\itshape Broad} & \mc{\itshape Middle} & \mc{\itshape Narrow}\\
\midrule
\item Control of strategic direction
\item Family participation
&
\item Founder or descendant runs the company
\item Firm is intended to remain in the family
&
\item Presence of multiple generations
\item More than one member of the owner's family with management responsibility
\\
\addlinespace[0.3cm]
\mc{$\Downarrow$} &
\mc{$\Downarrow$} &
\mc{$\Downarrow$} \\
\addlinespace[0.3cm]
\mc{Little direct family involvement} &
\mc{Some family involvement} &
\mc{Strong family involvement} \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}