我注意到,当我想在 LYX 中减少行间距时(使用更多->设置->行设置),我无法选择行设置?这是什么问题?
我知道如何更改 Tex 代码,但我想知道 LYX 选项有什么问题?
答案1
首先,LyX 不是 LaTeX 编辑器,如果你想完全控制表格的代码,请将其写入 ERT(插入 --> TeX 代码),或者写入单独的文本文件,然后使用“插入 --> 文件 --> 子文档”将其添加到 LyX,设置包含类型到输入。
我不确定你为什么要减少空间,但我不知道具体情况。当然,如果你碰巧全局设置了行距,或者只为表格所在的段落设置了行距,那么这也会影响表格行,在这种情况下,你应该打开段落设置(右键单击表格旁边的行距 --> 段落设置),然后将行距设置为默认,然后再执行其他任何操作。
有两个参数可以更改来修改整个表格的行距,它们是\extrarowheight
和\arraystretch
,请参阅extrarowheight 与 arraystretch。要在 LyX 中使用它们,您需要在表格前执行插入 --> TeX 代码,然后写入\setlength{\extrarowheight}{<some length>}
或\renewcommand{\arraystretch}{<some number>}
。请注意,后者需要array
包,因此还需要转到文档 --> 设置 --> LaTeX 前言,然后添加\usepackage{array}
。
请注意,如果不放置在周围环境中(例如\begin{table} ... \end{table}
),这些设置将应用于所有以下表格,这可能是您想要的,也可能不是。在下面的示例中,我{ ... }
在修改和表格周围添加了一对括号。
以下是.lyx
显示部分内容的示例文件(下面的屏幕截图)。将文本复制到一个空文本文件,并将其另存为something.lyx
,然后您应该能够在 LyX 中打开它。
#LyX 2.1 created this file. For more info see http://www.lyx.org/
\lyxformat 474
\begin_document
\begin_header
\textclass article
\begin_preamble
\usepackage{array}
\end_preamble
\use_default_options true
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding global
\font_roman default
\font_sans default
\font_typewriter default
\font_math auto
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100
\font_tt_scale 100
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing double
\use_hyperref false
\papersize default
\use_geometry false
\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 true
\use_refstyle 1
\index Index
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header
\begin_body
\begin_layout Subsubsection*
Default settings
\end_layout
\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="3" columns="1">
<features rotate="0" tabularvalignment="middle">
<column alignment="center" valignment="top">
<row>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
Some text
\end_layout
\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
More of the same
\end_layout
\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
Aaand, yet more.
\end_layout
\end_inset
</cell>
</row>
</lyxtabular>
\end_inset
\end_layout
\begin_layout Subsubsection*
With double spaced lines in paragraph
\end_layout
\begin_layout Standard
\paragraph_spacing double
\begin_inset Tabular
<lyxtabular version="3" rows="3" columns="1">
<features rotate="0" tabularvalignment="middle">
<column alignment="center" valignment="top">
<row>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
Some text
\end_layout
\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
More of the same
\end_layout
\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
Aaand, yet more.
\end_layout
\end_inset
</cell>
</row>
</lyxtabular>
\end_inset
\end_layout
\begin_layout Subsubsection*
Negative extrarowheight
\end_layout
\begin_layout Standard
\begin_inset ERT
status open
\begin_layout Plain Layout
{
\backslash
setlength
\backslash
extrarowheight{-2pt}
\end_layout
\end_inset
\begin_inset Tabular
<lyxtabular version="3" rows="3" columns="1">
<features rotate="0" tabularvalignment="middle">
<column alignment="center" valignment="top">
<row>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
Some text
\end_layout
\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
More of the same
\end_layout
\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
Aaand, yet more.
\end_layout
\end_inset
</cell>
</row>
</lyxtabular>
\end_inset
\begin_inset ERT
status open
\begin_layout Plain Layout
}
\end_layout
\end_inset
\end_layout
\begin_layout Subsubsection*
arraystretch 0.5
\end_layout
\begin_layout Standard
\begin_inset ERT
status open
\begin_layout Plain Layout
{
\backslash
renewcommand
\backslash
arraystretch{0.5}
\end_layout
\end_inset
\begin_inset Tabular
<lyxtabular version="3" rows="3" columns="1">
<features rotate="0" tabularvalignment="middle">
<column alignment="center" valignment="top">
<row>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
Some text
\end_layout
\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
More of the same
\end_layout
\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
Aaand, yet more.
\end_layout
\end_inset
</cell>
</row>
</lyxtabular>
\end_inset
\begin_inset ERT
status open
\begin_layout Plain Layout
}
\end_layout
\end_inset
\end_layout
\begin_layout Subsubsection*
ERT
\end_layout
\begin_layout Standard
\begin_inset ERT
status open
\begin_layout Plain Layout
\backslash
begin{tabular}{|c|}
\end_layout
\begin_layout Plain Layout
\backslash
hline
\end_layout
\begin_layout Plain Layout
Some text
\backslash
\backslash
[0.5cm]
\backslash
hline
\end_layout
\begin_layout Plain Layout
More of the same
\backslash
\backslash
\backslash
hline
\end_layout
\begin_layout Plain Layout
Aand, yet more
\backslash
\backslash
\backslash
hline
\end_layout
\begin_layout Plain Layout
\backslash
end{tabular}
\end_layout
\end_inset
\end_layout
\end_body
\end_document