我是 Lyx 的新手,遇到了一个问题。我有下面的表格,除了我想限制标题单元格的高度外,其他都很好。我希望它们比每个标题包含多行的高度更短。我该怎么做?
以下是代码:
\begin{table}
\begin{tabular}{ccccccccc}
\toprule
\begin{turn}{90}
\end{turn} & \begin{turn}{90}
Zero cost
\end{turn} & \begin{turn}{90}
Distribution allowed
\end{turn} & \begin{turn}{90}
No usage restrictions
\end{turn} & \begin{turn}{90}
Source code available
\end{turn} & \begin{turn}{90}
Source code modifications
\end{turn} & \begin{turn}{90}
Linking with proprietary work
\end{turn} & \begin{turn}{90}
Derivative work can be proprietary
\end{turn} & \begin{turn}{90}
Can be relicensed by anyone
\end{turn}\tabularnewline
\midrule
\midrule
Non-copyleft (permissive) & \textsurd{} & \textsurd{} & \textsurd{} & \textsurd{} & \textsurd{} & \textsurd{} & \textsurd{} & x\tabularnewline
\midrule
\midrule
Weak copyleft & \textsurd{} & \textsurd{} & \textsurd{} & \textsurd{} & \textsurd{} & \textsurd{} & x & x\tabularnewline
\midrule
\midrule
Strong copyleft (restrictive) & \textsurd{} & \textsurd{} & \textsurd{} & \textsurd{} & \textsurd{} & x & x & x\tabularnewline
\bottomrule
\end{tabular}
\caption{Open source license categories. Original source \cite{kechagia2010open}}
\end{table}
此致,
答案1
您可以使用minipage
标题中的单元格来限制其宽度
\documentclass[a4paper]{article}
\usepackage{booktabs}
\usepackage{rotating}
\usepackage{textcomp}
\newenvironment{Turn}{\begin{turn}{90}\begin{minipage}{3cm}\raggedright}
{\end{minipage}\end{turn}}
\begin{document}
\begin{table}
\begin{tabular}{ccccccccc}
\toprule
& \begin{Turn}
Zero cost
\end{Turn} & \begin{Turn}
Distribution allowed
\end{Turn} & \begin{Turn}
No usage restrictions
\end{Turn} & \begin{Turn}
Source code available
\end{Turn} & \begin{Turn}
Source code modifications
\end{Turn} & \begin{Turn}
Linking with proprietary work
\end{Turn} & \begin{Turn}
Derivative work can be proprietary
\end{Turn} & \begin{Turn}
Can be relicensed by anyone
\end{Turn}\tabularnewline
\midrule
\midrule
Non-copyleft (permissive) & \textsurd{} & \textsurd{} & \textsurd{} & \textsurd{} & \textsurd{} & \textsurd{} & \textsurd{} & x\tabularnewline
\midrule
\midrule
Weak copyleft & \textsurd{} & \textsurd{} & \textsurd{} & \textsurd{} & \textsurd{} & \textsurd{} & x & x\tabularnewline
\midrule
\midrule
Strong copyleft (restrictive) & \textsurd{} & \textsurd{} & \textsurd{} & \textsurd{} & \textsurd{} & x & x & x\tabularnewline
\bottomrule
\end{tabular}
\caption{Open source license categories. Original source \cite{kechagia2010open}}
\end{table}
\end{document}
输出
答案2
一种简单的方法是使用\parbox{}
来限制表头宽度。您可以为每个 parbox 指定大小,如下所示。我建议的另一个更改是使用\ding{51}
和\ding{55}
而不是\textsurd
和x
。它们可以在包中找到。在 Lyx 中,您可以使用插入 Tex 代码功能仅在表头内pifont
插入。{\parbox{2cm}{Header}}
\documentclass[a4paper]{article}
\usepackage{booktabs}
\usepackage{rotating}
\usepackage{textcomp}
\usepackage{pifont}
\begin{document}
\begin{table}
\begin{tabular}{ccccccccc}
\toprule
\begin{turn}{90}
\end{turn} & \begin{turn}{90}
{\parbox{2cm}{Zero cost}}
\end{turn} & \begin{turn}{90}
{\parbox{2cm}{Distribution allowed}}
\end{turn} & \begin{turn}{90}
{\parbox{2cm}{No usage restrictions}}
\end{turn} & \begin{turn}{90}
{\parbox{2cm}{Source code available}}
\end{turn} & \begin{turn}{90}
{\parbox{2cm}{Source code modifications}}
\end{turn} & \begin{turn}{90}
{\parbox{2cm}{Linking with proprietary work}}
\end{turn} & \begin{turn}{90}
{\parbox{2cm}{Derivative work can be proprietary}}
\end{turn} & \begin{turn}{90}
{\parbox{2cm}{Can be relicensed by anyone}}
\end{turn}\tabularnewline
\midrule
\midrule
Non-copyleft (permissive) & \textsurd{} & \textsurd{} & \textsurd{} & \textsurd{} & \textsurd{} & \textsurd{} & \textsurd{} & x\tabularnewline
\midrule
\midrule
Weak copyleft & \textsurd{} & \textsurd{} & \textsurd{} & \textsurd{} & \textsurd{} & \textsurd{} & x & x\tabularnewline
\midrule
\midrule
Strong copyleft (restrictive) & \textsurd{} & \textsurd{} & \textsurd{} & \textsurd{} & \textsurd{} & x & x & x\tabularnewline
\bottomrule
\end{tabular}
\caption{Open source license categories. Original source \cite{kechagia2010open}}
\end{table}
\end{document}