Lyx 表格垂直对齐

Lyx 表格垂直对齐

请问如何使用 Lyx 编辑器实现下图所示的表格布局?

我想要第一列和最后一列的内容垂直对齐到顶部第三和第四列的内容应该是垂直对齐到中间

我读了一些关于将单元格更改为多列的内容,但似乎包含最多文本的单元格的垂直对齐设置会覆盖同一行中的所有其他单元格。

在此先感谢您的帮助

更新:以下是示例表格代码。所有单元格均垂直居中对齐。

#LyX 2.2 created this file. For more info see http://www.lyx.org/
\lyxformat 508
\begin_document
\begin_header
\save_transient_properties true
\origin unavailable
\textclass article
\use_default_options true
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding global
\font_roman "lmodern" "default"
\font_sans "lmss" "default"
\font_typewriter "lmtt" "default"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\papersize default
\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 true
\justification true
\use_refstyle 1
\index Index
\shortcut idx
\color #008000
\end_index
\leftmargin 2cm
\topmargin 2cm
\bottommargin 2cm
\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 Section*
Sample Table
\end_layout

\begin_layout Standard
\begin_inset VSpace smallskip
\end_inset


\end_layout

\begin_layout Standard
\noindent
\align center
\begin_inset Tabular
<lyxtabular version="3" rows="6" columns="5">
<features tabularvalignment="top">
<column alignment="center" valignment="middle" width="1cm">
<column alignment="left" valignment="middle" width="7cm">
<column alignment="center" valignment="middle" width="2cm">
<column alignment="center" valignment="middle" width="1.2cm">
<column alignment="center" valignment="middle" width="2.5cm">
<row>
<cell multicolumn="1" alignment="center" valignment="middle" topline="true" bottomline="true" leftline="true" usebox="none" width="8cm">
\begin_inset Text

\begin_layout Plain Layout

\series bold
Title 1
\end_layout

\end_inset
</cell>
<cell multicolumn="2" alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\end_layout

\end_inset
</cell>
<cell multicolumn="1" alignment="center" valignment="middle" topline="true" bottomline="true" leftline="true" usebox="none" width="2cm">
\begin_inset Text

\begin_layout Plain Layout

\series bold
Title 2
\end_layout

\end_inset
</cell>
<cell multicolumn="1" alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\series bold
Title 3
\end_layout

\end_inset
</cell>
<cell multicolumn="1" alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\series bold
Title 4
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="middle" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
1
\end_layout

\end_inset
</cell>
<cell multicolumn="1" alignment="left" valignment="middle" topline="true" bottomline="true" rightline="true" usebox="none" width="7cm">
\begin_inset Text

\begin_layout Plain Layout
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
 Vivamus quis lobortis lectus.
 Curabitur egestas faucibus purus.
 Proin sem risus, imperdiet ac imperdiet eget, elementum a libero.
\end_layout

\end_inset
</cell>
<cell multicolumn="1" alignment="center" valignment="bottom" topline="true" bottomline="true" rightline="true" usebox="none" width="2cm">
\begin_inset Text

\begin_layout Plain Layout
1
\end_layout

\end_inset
</cell>
<cell multicolumn="1" alignment="center" valignment="top" topline="true" bottomline="true" rightline="true" usebox="none" width="1.2cm">
\begin_inset Text

\begin_layout Plain Layout
6
\end_layout

\end_inset
</cell>
<cell multicolumn="1" alignment="center" valignment="top" bottomline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Lorem Ipsum
\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
2
\end_layout

\end_inset
</cell>
<cell multicolumn="1" alignment="left" valignment="middle" bottomline="true" rightline="true" usebox="none" width="7cm">
\begin_inset Text

\begin_layout Plain Layout
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
 Vivamus quis lobortis lectus.
 Curabitur egestas faucibus purus.
 Proin sem risus, imperdiet ac imperdiet eget, elementum a libero.
\end_layout

\end_inset
</cell>
<cell multicolumn="1" alignment="center" valignment="top" bottomline="true" rightline="true" usebox="none" width="2cm">
\begin_inset Text

\begin_layout Plain Layout
2
\end_layout

\end_inset
</cell>
<cell multicolumn="1" alignment="center" valignment="top" bottomline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
7
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="middle" bottomline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Lorem Ipsum
\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
3
\end_layout

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

\begin_layout Plain Layout
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
 Vivamus quis lobortis lectus.
 Curabitur egestas faucibus purus.
 Proin sem risus, imperdiet ac imperdiet eget, elementum a libero.
\end_layout

\end_inset
</cell>
<cell multicolumn="1" alignment="center" valignment="top" bottomline="true" rightline="true" usebox="none" width="2cm">
\begin_inset Text

\begin_layout Plain Layout
3
\end_layout

\end_inset
</cell>
<cell multicolumn="1" alignment="center" valignment="top" bottomline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
8
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="middle" bottomline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Lorem Ipsum
\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
4
\end_layout

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

\begin_layout Plain Layout
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
 Vivamus quis lobortis lectus.
 Curabitur egestas faucibus purus.
 Proin sem risus, imperdiet ac imperdiet eget, elementum a libero.
\end_layout

\end_inset
</cell>
<cell multicolumn="1" alignment="center" valignment="top" bottomline="true" rightline="true" usebox="none" width="2cm">
\begin_inset Text

\begin_layout Plain Layout
4
\end_layout

\end_inset
</cell>
<cell multicolumn="1" alignment="center" valignment="top" bottomline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
9
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="middle" bottomline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Lorem Ipsum
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" bottomline="true" leftline="true" rightline="true" usebox="none" width="1cm">
\begin_inset Text

\begin_layout Plain Layout
5
\end_layout

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

\begin_layout Plain Layout
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
 Vivamus quis lobortis lectus.
 Curabitur egestas faucibus purus.
 Proin sem risus, imperdiet ac imperdiet eget, elementum a libero.
\end_layout

\end_inset
</cell>
<cell multicolumn="1" alignment="center" valignment="top" bottomline="true" rightline="true" usebox="none" width="2cm">
\begin_inset Text

\begin_layout Plain Layout
5
\end_layout

\end_inset
</cell>
<cell multicolumn="1" alignment="center" valignment="top" bottomline="true" rightline="true" usebox="none" width="1.2cm">
\begin_inset Text

\begin_layout Plain Layout
10
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="middle" bottomline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Lorem Ipsum
\end_layout

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

\end_inset


\end_layout

\end_body
\end_document

答案1

刚才我成功地做到了,感谢LyX 维基 | Lyx / 表格

基本上,你将文本最多的行单元格的垂直对齐方式设置为所需的默认方式(在我的情况下,它是中间,单元格有 5 行)。然后,如果你有,例如,单元格中的数字 1 垂直对齐在顶部,你:

  • 类型 1
  • 按 Enter 键并插入单词间空格
  • 再次按 Enter 键并插入另一个单词间空格

因此现在该单元格中总共有 3 条线(当另一个单元格有 5 条线时,3 是中心线)

最后,将垂直对齐设置为与所需对齐相反的方向。因此,我希望 1 位于顶部,因此我将垂直对齐设置为底部。

希望这对某人有帮助。

相关内容