由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
TeX版 - 怎么控制表格里行的高度?
相关主题
Table 的黑粗线是怎么弄出来的?新人提问,怎么把一个tabular左上角的那个cell删除?
请问把tabular里两个column设成等宽的命令Table 分两个 column 的问题
请问tabular里面的一个格子里如何能够换行呢?谢谢!latex 表格自动排版的问题
latex写信函(letters),无法做tableBeamer: resizing figure and table
请教一个表格问题。表格里面查图片
About table请问如何在table的cell里面写multi-line的paragraph
help on subtable label如何让 图表的标题和图表有空白?
图表混排的问题add caption above floating table using floatflt
相关话题的讨论汇总
话题: column话题: hline话题: vertical话题: tabular话题: alignment
进入TeX版参与讨论
1 (共1页)
j******d
发帖数: 70
1
觉得字填充了整行,有点挤.请教怎么设定行的高度,并且让字垂直居中.谢谢...
i******e
发帖数: 171
2
\\[1mm]

【在 j******d 的大作中提到】
: 觉得字填充了整行,有点挤.请教怎么设定行的高度,并且让字垂直居中.谢谢...
j******d
发帖数: 70
3
好像不行啊.
用 \hline\\[1mm] blabla...
就算定义成 \begin{tabular}[c]{cc|cc},也无法让blabla在该行垂直中央(靠底部了).
还有,分隔竖线 | 不够高,那 1mm 没有分隔线.

【在 i******e 的大作中提到】
: \\[1mm]
i******e
发帖数: 171
4
oh, then try \renewcommand{\arraystretch}{1.15}
you can change the value.

【在 j******d 的大作中提到】
: 好像不行啊.
: 用 \hline\\[1mm] blabla...
: 就算定义成 \begin{tabular}[c]{cc|cc},也无法让blabla在该行垂直中央(靠底部了).
: 还有,分隔竖线 | 不够高,那 1mm 没有分隔线.

T*******e
发帖数: 47
5
I think what he meant is like this:
\begin{table}
\begin{tabular}[c]{|c|c|}
\hline
test & test \\[3mm]
\hline
\end{tabular}
\end{table}
everything is ok, except the text is not align vertical in the center of the
cell.

【在 j******d 的大作中提到】
: 好像不行啊.
: 用 \hline\\[1mm] blabla...
: 就算定义成 \begin{tabular}[c]{cc|cc},也无法让blabla在该行垂直中央(靠底部了).
: 还有,分隔竖线 | 不够高,那 1mm 没有分隔线.

i******e
发帖数: 171
6
yeah, this way works if he wanna change the row height for one or few r
ows.
I think he can make it at vertical center by putting different positive
or negtive values after "test" and upper and lower \hline.
\arraystretch might be what he wants actually, so he can change the heights
for all rows.

【在 T*******e 的大作中提到】
: I think what he meant is like this:
: \begin{table}
: \begin{tabular}[c]{|c|c|}
: \hline
: test & test \\[3mm]
: \hline
: \end{tabular}
: \end{table}
: everything is ok, except the text is not align vertical in the center of the
: cell.

T*******e
发帖数: 47
7
I also tried:
\begin{table}
\begin{tabular}[c]{|c|c|}
\hline&\\[0mm]
test & test \\[5mm]
\hline
\end{tabular}
\end{table}
it works, but the number in [] is hard to adjust so that the text is aligned
in center vertically.

【在 i******e 的大作中提到】
: yeah, this way works if he wanna change the row height for one or few r
: ows.
: I think he can make it at vertical center by putting different positive
: or negtive values after "test" and upper and lower \hline.
: \arraystretch might be what he wants actually, so he can change the heights
: for all rows.

T*******n
发帖数: 493
8
Is this what you want? The "m" type columns center text vertically, but
since it allows multiple lines of text, you need to set the column width.
Remove the >{\centering} if you want double-flushed text, or change to
>{\raggedright} for left justification only.
\documentclass{article}
\usepackage{array}
\begin{document}
\begin{tabular}{|>{\centering}m{72pt}|m{72pt}|}
\hline
The long text that is in the first column. &
Second column. \\
\hline
\end{tabular}
\end{document}

【在 j******d 的大作中提到】
: 觉得字填充了整行,有点挤.请教怎么设定行的高度,并且让字垂直居中.谢谢...
T*******n
发帖数: 493
9
Also try
\usepackage{array}
\setlength{\extrarowheight}{3pt}
but this will only add space to the top, which I don't think is what you want.

【在 j******d 的大作中提到】
: 觉得字填充了整行,有点挤.请教怎么设定行的高度,并且让字垂直居中.谢谢...
i******e
发帖数: 171
10
It seems that the first argument controls the whole row. {b{1in} m{1in}}
will make the texts of the whole row at the bottom, even if I use "m" f
or the second column; vice versa. ...... don't quite understand.

【在 T*******n 的大作中提到】
: Is this what you want? The "m" type columns center text vertically, but
: since it allows multiple lines of text, you need to set the column width.
: Remove the >{\centering} if you want double-flushed text, or change to
: >{\raggedright} for left justification only.
: \documentclass{article}
: \usepackage{array}
: \begin{document}
: \begin{tabular}{|>{\centering}m{72pt}|m{72pt}|}
: \hline
: The long text that is in the first column. &

T*******n
发帖数: 493
11
That is the correct behavior. The first column has three lines of text, and
by setting it as a "b" column, you are telling LaTeX to set the vertical
alignment reference position to the bottom of the first column. The second
column has only one single line, so the vertical alignment reference position
is that single line itself. Therefore the result is that the single line in
the second column aligned with the last line in the first column.
You should normally set the column containing the cel

【在 i******e 的大作中提到】
: It seems that the first argument controls the whole row. {b{1in} m{1in}}
: will make the texts of the whole row at the bottom, even if I use "m" f
: or the second column; vice versa. ...... don't quite understand.

i******e
发帖数: 171
12
huhu, don't quite understand. I'll try to figure out the example back ho
me. Thanks

position

【在 T*******n 的大作中提到】
: That is the correct behavior. The first column has three lines of text, and
: by setting it as a "b" column, you are telling LaTeX to set the vertical
: alignment reference position to the bottom of the first column. The second
: column has only one single line, so the vertical alignment reference position
: is that single line itself. Therefore the result is that the single line in
: the second column aligned with the last line in the first column.
: You should normally set the column containing the cel

T*******n
发帖数: 493
13
Each cell in the table has its own vertical alignment reference point,
and all the cells in the same row have their vertical alignment reference
points aligned with each other. The vertical alignment of these cells
work the same way as \parbox's.
Maybe this helps illustrate the alignment mechanism?
\documentclass[landscape]{article}
\setlength{\oddsidemargin}{0in}
\setlength{\textwidth}{9in}
\begin{document}
\makebox[0pt][l]{\rule{\textwidth}{0.2pt}}
\ignorespaces
vertical alignment reference l

【在 i******e 的大作中提到】
: huhu, don't quite understand. I'll try to figure out the example back ho
: me. Thanks
:
: position

i******e
发帖数: 171
14
Thanks! Actually I got what you were saying during driving back home. :)

【在 T*******n 的大作中提到】
: Each cell in the table has its own vertical alignment reference point,
: and all the cells in the same row have their vertical alignment reference
: points aligned with each other. The vertical alignment of these cells
: work the same way as \parbox's.
: Maybe this helps illustrate the alignment mechanism?
: \documentclass[landscape]{article}
: \setlength{\oddsidemargin}{0in}
: \setlength{\textwidth}{9in}
: \begin{document}
: \makebox[0pt][l]{\rule{\textwidth}{0.2pt}}

1 (共1页)
进入TeX版参与讨论
相关主题
add caption above floating table using floatflt请教一个表格问题。
如何给一段文字加上框框?About table
Latex表格问题:左上角斜杠分行列?help on subtable label
how to use longtable in latex?图表混排的问题
Table 的黑粗线是怎么弄出来的?新人提问,怎么把一个tabular左上角的那个cell删除?
请问把tabular里两个column设成等宽的命令Table 分两个 column 的问题
请问tabular里面的一个格子里如何能够换行呢?谢谢!latex 表格自动排版的问题
latex写信函(letters),无法做tableBeamer: resizing figure and table
相关话题的讨论汇总
话题: column话题: hline话题: vertical话题: tabular话题: alignment