![表格制定语法](https://linux22.com/image/383084/%E8%A1%A8%E6%A0%BC%E5%88%B6%E5%AE%9A%E8%AF%AD%E6%B3%95.png)
我想制作显示内容的表格。有人能帮我提供代码吗?
答案1
tabu 环境中的一个选项,使用 parbox 在多行单元格中插入 itemize 环境;为了增加最后一行的高度,我使用...\\[2\baselineskip]
,然后为了控制项目列表的位置,我使用单元格的值,...\multirrow{Vertical_shift}{*}{...
它只控制声明的文本垂直于单元格的位移;最后为了控制项目的水平位置,我使用leftmargin
来自itemize
环境的选项。
梅威瑟:
% arara: pdflatex: {synctex: yes, action: nonstopmode}
\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage[shortlabels]{enumitem}
\usepackage{tabu}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage[table]{xcolor}
\usepackage{makecell}
\begin{document}
\begin{table}
\centering
\sffamily
\scriptsize
\def\TableLineSize{1pt}
\tabulinesep = 1.5pt
\tabulinestyle{\TableLineSize black}
\begin{tabu} to \linewidth {|X[1.5mc]|X[0.7mc]|X[1.7mc]|X[0.7mc]|X[2mc]|X[3ml]|X[2.5mc]|}
\tabucline -
%Row 1
\rowfont[c]{\bf\sffamily}
\multicolumn{2}{|c|}{\makecell{Source File\\ Form}}
& \multicolumn{2}{c|}{\makecell{Target File\\ Form}}
& Physical Quantity for Mapping
& Transformation Options Used
& Algorithm Options Used
\\ \tabucline -
%Row 2
Tool
& Format
& Tool
& Format
&% for multirow 2-3 col 5
&% for multirow 2-3 col 6
&% for multirow 2-3 col 7
\\[-\TableLineSize] \tabucline {1-4}
%Row 3
ANSYS CFX
& .csv
& Abaqus Standard
& .inp
&\multirow{-1}{*}{Pressure}
&\multirow{-1.7}{*}{
\parbox{0.2\textwidth}{
\begin{itemize}[leftmargin=15pt]\itemsep-5pt
\item Automatic
\item Course
\item Fine
\item Bounding Box
\end{itemize}
}
}
&\multirow{-0.8}{*}{
\parbox{0.2\textwidth}{
\begin{itemize}[leftmargin=15pt]\itemsep-5pt
\item Shape Function
\item Nearest
\end{itemize}
}
}
\\[2\baselineskip] \tabucline -
\end{tabu}
\caption{Multirow with itemize in parbox within Tabu environment}
\end{table}
\end{document}
答案2
- 请始终向我们展示您迄今为止尝试过的方法并解释您遇到的问题(看来您的问题是对您上一个问题的后续......)
- 用于起点J Leon V.回答
- 相反(脆弱)
tabu
宁愿使用tabularx
- 用于列
thead
标题makecell
\makegapedcells
通过包中的宏获得更多的垂直空间makecell
- 重新
itemize
定义其默认样式tablę
在我看来,想要展示的桌子形式很丑,所以我宁愿建议如何设计你的桌子
\documentclass{article} \usepackage[margin=25mm]{geometry} \usepackage{enumitem} \usepackage{makecell, multirow, tabularx} \setcellgapes{2pt} \renewcommand\theadfont{\footnotesize\bfseries} \renewcommand\theadgape{} \begin{document} \begin{table} \setlist[itemize]{nosep, leftmargin=*, before=\vspace{-0.6\baselineskip}, after=\vspace{-\baselineskip} } \centering \makegapedcells \small \begin{tabularx}{\linewidth}{| *{5}{c|} *{2}{X|} } \hline \multicolumn{2}{|c|}{\thead{Source File Form}} & \multicolumn{2}{ c|}{\thead{Target File Form}} & % \multirow{2.4}{*}{\thead{aaa\\b}} & \multirow{2.4}{=}{\thead{a\\b}} & \multirow{2.4}{=}{\thead{a\\b}} \\ \cline{1-4} Tool & Format & Tool & Format & & & \\ \hline ANSYS CFX & .csv & \makecell[tl]{Abaqus Standard} & .inp & Pressure & \begin{itemize} \item Automatic \item Course \item Fine \item Bounding Box \end{itemize} & \begin{itemize} \item Shape Function \item Nearest \end{itemize} \\ \hline \end{tabularx} \caption{With \texttt{makecell} and \texttt{multirow} within \texttt{tabularx} environment} \label{tab:1} \end{table} \end{document}