2

I'm new to Lyx and I have a problem. I have the following table and everything is good except that I want to limit the height of header cells. I want them to be shorter that this where each header would contain multiple lines. How I can do that?

enter image description here

Here is the code:

\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}

Best Regards,

3

You can use minipage for cells in header to limit their width

\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}

Output

enter image description here

  • Hi Salim, That look like it would solve my problem perfectly. However, how I add the code to my file? I have no idea about how to do that in Lyx. – emadalamoudi Apr 26 '16 at 19:36
3

One easy way to do is to use \parbox{} to limit the header width. You can give the size for each parbox as shown below. Another change I would suggest is to use \ding{51} and \ding{55} instead of \textsurd and x. they can be found in pifont package. In Lyx you can use the insert Tex code facility to insert just the {\parbox{2cm}{Header}} inside the table 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}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.