日本免费全黄少妇一区二区三区-高清无码一区二区三区四区-欧美中文字幕日韩在线观看-国产福利诱惑在线网站-国产中文字幕一区在线-亚洲欧美精品日韩一区-久久国产精品国产精品国产-国产精久久久久久一区二区三区-欧美亚洲国产精品久久久久

latex表格居中顯示 latex表格寬度設(shè)置的方法

我們可以使用makecell命令對(duì)表格單元格中的數(shù)據(jù)進(jìn)行一些變換的控制 。我們可以使用命令進(jìn)行換行,也可以使用p{(寬度)}選項(xiàng)控制列表的寬度
使用makecell 命令我們需要在導(dǎo)言區(qū)添加usepackage{makecell}才能正常編譯通過(guò) 。makecell命令的內(nèi)容是默認(rèn)居中對(duì)齊的,也可以選用選項(xiàng)t,b,l,r,c等分別控制表格單元格中的格式 。
舉個(gè)例子:

latex表格居中顯示 latex表格寬度設(shè)置的方法


代碼如下:
documentclass[UTF8]{ctexart}
usepackage{makecell}
begin{document}
begin{tabular}{|r|r|}
hline
makecell{處理前\ 數(shù)據(jù)} & makecell{處理后 \ 數(shù)據(jù)} \ hline
1234 & 5678 \
hline
end{tabular}
end{document}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
makecell 宏包這種表項(xiàng)分行常用在表頭中 。在Latex中還單獨(dú)定義了類似的thead命令,它產(chǎn)生的字體較小,上下間距較大的單元更適合文字較多的多行表頭使用 。
先貼代碼
begin{tabular}{|r|r|}
hline
thead{處理前 \ 數(shù)據(jù)} & thead{處理后 \ 數(shù)據(jù)} \
hline
1234 & 5678 \
hline
end{tabular}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
documentclass[UTF8]{ctexart}
usepackage{makecell}
begin{tabular}{|r|r|}
hline
thead{處理前 \ 數(shù)據(jù)} & thead{處理后 \ 數(shù)據(jù)} \
hline
1234 & 5678 \
hline
end{tabular}
end{document}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

latex表格居中顯示 latex表格寬度設(shè)置的方法


我們可以對(duì)比一下使用makecell 和使用thead之前表格的區(qū)別:

latex表格居中顯示 latex表格寬度設(shè)置的方法


直觀的感受就是字體變小了 。
在makecell的rothead 命令則相當(dāng)于旋轉(zhuǎn)了90° 的thead命令,這個(gè)命令還依賴rotating宏包,在我們使用rothead時(shí)需要給旋轉(zhuǎn)表頭的寬度rotheadsize賦值,否則就會(huì)就沒(méi)有我們想要的效果
表頭的字體由theadfont 命令控制
例如:
documentclass[UTF8]{ctexart}
usepackage{makecell,rotating}
begin{document}
settowidthrotheadsize{theadfont 數(shù)學(xué)課}
begin{tabular}{|c|c|}
hline
thead{姓名} & rothead{數(shù)學(xué)課\成績(jī)} \
hline
Hebe & 100 \
hline
end{tabular}
end{document}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
可以得到的效果如下所示:

latex表格居中顯示 latex表格寬度設(shè)置的方法


如果我們想要畫(huà)下面的表格:

latex表格居中顯示 latex表格寬度設(shè)置的方法


代碼如下:
documentclass[UTF8]{ctexart}
usepackage{makecell,rotating,multirow,diagbox}
begin{document}
begin{tabular}{|c|*{4}{c}|}
hline
diagbox{序號(hào)1}{序號(hào)2} & 我 & 愛(ài) & hebe & 哈哈 \
hline
數(shù)字 & 1 & 2 & 3 & 4 \
hline
數(shù)字 & 2 & 4 & 6 & 8 \
hline
end{tabular}
end{document}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
都學(xué)了這么多,下面是我們的DIY時(shí)間,我們總結(jié)一下我寫(xiě)論文時(shí)候用到的一些表格,下次大家用到的時(shí)候直接拿去用吧 。

推薦閱讀