Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Using LyX, how can I make a 6 column table with the second row having multiple lines of text? I am trying to create the following layout in LyX:

screenshot

I'm using LyX 2.0 for mac.

What are ways to accomplish this?

share|improve this question
    
Hi Jane, Welcome to TeX.SE! Most TeX users would probably call this a table. There have been many questions on this site about tables- this link will take you directly to questions that have been tagged with them, and should help get you started. –  cmhughes Nov 26 '11 at 4:38
    
I've edited the title to refer to tables for future users: 'chart' is misleading here. –  Joseph Wright Nov 26 '11 at 12:00
    
If my answer solved your problem, would you consider accepting it, by clicking the checkmark on the left? This marks the question as "solved", and awards some points to both yourself and me. –  Torbjørn T. Dec 9 '11 at 0:30

3 Answers 3

I wished to leave an example, of a LyX file that implements the recomended solution, as a text file.


#LyX 2.1 created this file. For more info see http://www.lyx.org/
\lyxformat 474
\begin_document
\begin_header
\textclass article
\use_default_options true
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding global
\font_roman Liberation Serif
\font_sans Liberation Sans
\font_typewriter Liberation Mono
\font_math default
\font_default_family default
\use_non_tex_fonts true
\font_sc false
\font_osf true
\font_sf_scale 100
\font_tt_scale 100
\graphics default
\default_output_format pdf5
\output_sync 0
\bibtex_command biber
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\papersize letterpaper
\use_geometry true
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification false
\use_refstyle 1
\index Index
\shortcut idx
\color #008000
\end_index
\leftmargin 3cm
\topmargin 3cm
\rightmargin 3cm
\bottommargin 3cm
\secnumdepth 3
\tocdepth 3
\paragraph_separation skip
\defskip smallskip
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle plain
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 1
\html_be_strict true
\end_header

\begin_body

\begin_layout Title
An Example of a Table with Six Columns
\begin_inset Newline newline
\end_inset

With Paragraphs in Cells
\end_layout

\begin_layout Author
Denis J.
 Navas
\end_layout

\begin_layout Date
2015--feb--16
\end_layout

\begin_layout Standard
On the question 
\begin_inset Quotes eld
\end_inset

Using LyX, how can I make a six column table with the second row having
 multiple lines of text?
\begin_inset Quotes erd
\end_inset

 made on Stack Exchange, the best answer showed how to build a table with
 LyX, without saying clearly that when you specify columns widhts, you get
 multiline cells.

\begin_inset Foot
status open

\begin_layout Plain Layout
http://tex.stackexchange.com/questions/36205/using-lyx-how-can-i-make-a-6-column-t
able-with-the-second-row-having-multiple-l?rq=1
\end_layout

\end_inset


\end_layout

\begin_layout Standard
This is an excercise building a table, following those instructions.
\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="5" columns="6">
<features rotate="0" booktabs="true" tabularvalignment="middle" tabularwidth="15cm">
<column alignment="left" valignment="top" width="3cm">
<column alignment="left" valignment="top" width="0pt">
<column alignment="left" valignment="top">
<column alignment="left" valignment="top">
<column alignment="left" valignment="top">
<column alignment="left" valignment="top" width="2.5cm">
<row>
<cell alignment="left" valignment="top" topline="true" bottomline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\size small
Concepto
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" topline="true" bottomline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\size small
Col 1
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" topline="true" bottomline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\size small
Col 2
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" topline="true" bottomline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\size small
Col 3
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" topline="true" bottomline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\size small
Col 4
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" topline="true" bottomline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\size small
Col 5
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\end_layout

\end_inset
</cell>
</row>
<row>
<cell multirow="3" alignment="left" valignment="middle" bottomline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\size small
Permite incluir varias filas
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\size small
Para crear un título
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\size small
para dos filas,
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\size small
primero
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\size small
multifila
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\size small
y
\end_layout

\end_inset
</cell>
</row>
<row>
<cell multirow="4" alignment="left" valignment="top" bottomline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" bottomline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\size small
luego insertar filas.
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" bottomline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" bottomline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" bottomline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" bottomline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\end_layout

\end_inset
</cell>
</row>
</lyxtabular>

\end_inset


\end_layout

\begin_layout Standard
The actions I did, were:
\end_layout

\begin_layout Enumerate
Insert -- Table
\end_layout

\begin_layout Enumerate
Fix the column widh AND the total size.

\begin_inset Newline newline
\end_inset

Select all the cells.
 Access the table configuration menu, with 'Edit, Table Configuration, Table
 Configuration, Complete table configuration -- Width (set a number)'.

\end_layout

\begin_layout Enumerate
Adjust the borders.

\end_layout

\begin_deeper
\begin_layout Enumerate
First, supress all the borders.

\end_layout

\begin_layout Enumerate
Later, select first row and apply top and bottom border, using the table
 toolbar.
\end_layout

\begin_layout Enumerate
Select the last row and apply a bottom border.
\end_layout

\begin_layout Enumerate
If you see too much space between rows, supress any aditional space given
 in 'Table configuration -- Borders -- Additional space'.
\end_layout

\end_deeper
\begin_layout Enumerate
As an aditional configuration, later, I selected cells C1R4 and C1R5, and
 with the context menu, select 'more -- multiline', and you get a cell that
 combine both cells.

\end_layout

\begin_layout Enumerate
Select all the cells and 
\series bold
\size small
change the font size
\series default
\size default
, with 'Edit -- Personalized -- Size -- select small'.
\end_layout

\end_body
\end_document
share|improve this answer

To fill in a little on the LyX side of things:

You can create a tabular by either choosing Insert --> Table ... or clicking the enter image description here button on the toolbar. In both cases, you choose the number of columns and rows for your table. Say you create a table with 6 columns and 2 rows, then you'll get something like this:

enter image description here

You'll want to remove most of the lines in the table, so start by selecting all the cells, and clicking the appropriate buttons on the toolbar at the bottom of the LyX window (that's where the toolbar appears on my installation, at least):

enter image description here

The button on the far right in the red oval removes all the lines. However, you'll still want the horizontal lines above and below the top row, so select just this, and add the lines:

enter image description here

Following cmhughes, you can set the column width. You can do this by right clicking in a cell, choosing More --> Settings, and writing a width in the appropriate text box.

enter image description here

I think you have to do this for each column, but I may be wrong, as I don't use LyX that much.

Another thing you want to do in the settings, is to go to the Borders tab, and select the "Formal" style. This will make LyX use booktabs, that cmhughes described in his answer.

enter image description here

You can add more rows to your table, by clicking the Add row button in the bottom left of the tabular toolbar, or using the keyboard shortcut. On Windows this is Alt + M, W I, i.e., hold down Alt and press M, then release both and type WI. (May be different on your Mac, but it will probably show up as a tooltip then hovering the mouse over the button.)

enter image description here

share|improve this answer
    
If I could vote this up more than once I would. Exceptional. It also illustrates to me why I use LaTeX though. This seems rather complex! –  qubyte Nov 26 '11 at 10:07
1  
+1 for an excellent LyX answer! –  Daniel Nov 26 '11 at 14:15
    
+1 there are quite a few unanswered lyx questions that could benefit from this kind of great answer –  cmhughes Nov 26 '11 at 17:08
    
Thanks all! @cmhughes: I've looked at that list a couple of times, and if I was able to answer some of the questions, I would have. –  Torbjørn T. Nov 26 '11 at 17:17
    
+1 for showing that LyX actually supports booktabs (quite hidden so...) –  e-birk Apr 20 '13 at 20:35

I'm not sure about the Lyx side of things, but here's some code that should get you started.

Note that I've used the column type p{width} to represent a 'paragraph' column that takes a width as an argument. The & are column separators, and we use \\ to start a new line.

screenshot 1

\documentclass{article}

\begin{document}

\begin{table}
\centering
\begin{tabular}{|p{1.5cm}|p{2cm}|p{1.5cm}|p{2cm}|p{1.5cm}|p{2cm}|}
 \hline
 \textbf{Topic 1}             & \textbf{Topic 2}    &   \textbf{Topic 3} &  \textbf{Topic 4} & \textbf{Topic 5} & \textbf{Topic 6}\\ \hline
          here is some text   & text                & 0923 0923 0923     & some more text goes here    & and some more text goes here    & and yet more here  \\ \hline
\end{tabular}
\end{table}

\end{document}

A lot of users on this site would recommend using the booktabs package to make your tables beautiful. This package provides the commands \toprule, \midrule, and \bottomrule, which are demonstrated below.

screenshot 2

\documentclass{article}
\usepackage{booktabs}

\begin{document}

\begin{table}
\centering
\begin{tabular}{p{1.5cm}p{2cm}p{1.5cm}p{2cm}p{1.5cm}p{2cm}}
 \toprule
 \textbf{Topic 1}             & \textbf{Topic 2}    &   \textbf{Topic 3} &  \textbf{Topic 4} & \textbf{Topic 5} & \textbf{Topic 6}\\ 
 \midrule
          here is some text   & text                & 0923 0923 0923     & some more text goes here    & and some more text goes here    & and yet more here  \\ 
 \bottomrule
\end{tabular}
\end{table}

\end{document}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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