使用 LyX,如何制作一个 6 列表格,其中第二行有多行文本?

使用 LyX,如何制作一个 6 列表格,其中第二行有多行文本?

使用 LyX,如何制作一个 6 列表格,其中第二行有多行文本?我正在尝试在 LyX 中创建以下布局:

截屏

我正在使用适用于 Mac 的 LyX 2.0。

有哪些方法可以实现这一目标?

答案1

补充一些关于 LyX 方面的事情:

您可以通过选择“插入 --> 表格...”或单击工具栏上的按钮来创建表格在此处输入图片描述。在这两种情况下,您都可以选择表格的列数和行数。假设您创建一个有 6 列和 2 行的表格,那么您将得到如下内容:

在此处输入图片描述

您需要删除表格中的大部分行,因此首先选择所有单元格,然后单击 LyX 窗口底部工具栏上的相应按钮(至少在我的安装中工具栏出现在那里):

在此处输入图片描述

红色椭圆最右侧的按钮可删除所有线条。但是,您仍需要顶行上方和下方的水平线,因此只需选择此按钮,然后添加线条:

在此处输入图片描述

按照 cmhughes 的步骤,您可以设置列宽。您可以右键单击单元格,选择更多 --> 设置,然后在相应的文本框中输入宽度。

在此处输入图片描述

我认为您必须对每一列都执行此操作,但我可能错了,因为我并不经常使用 LyX。

您要在设置中执行的另一件事是转到边界选项卡,然后选择“正式”样式。这将使 LyX 使用booktabs,cmhughes 在他的回答中描述了这一点。

在此处输入图片描述

您可以通过点击表格工具栏左下方的添加行按钮或使用键盘快捷键向表格添加更多行。在 Windows 上,快捷键为Alt+ M, W I,IE,按住Alt并按下M,然后松开并输入WI。 (在您的 Mac 上可能有所不同,但它可能会显示为工具提示,然后将鼠标悬停在按钮上。)

在此处输入图片描述

答案2

我不太清楚 Lyx 方面的情况,但这里有一些代码可以帮助你入门。

请注意,我使用了列类型p{width}来表示以宽度为参数的“段落”列。&是列分隔符,我们用它\\来开始新行。

屏幕截图 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}

本网站的许多用户都推荐使用该booktabs软件包来美化您的表格。该软件包提供了命令\toprule\midrule\bottomrule,如下所示。

屏幕截图 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}

答案3

我希望留下一个示例,即以文本文件的形式实现推荐解决方案的 LyX 文件。


#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

相关内容