![如何在乳胶中生成具有美观风格的自定义表格?](https://linux22.com/image/352143/%E5%A6%82%E4%BD%95%E5%9C%A8%E4%B9%B3%E8%83%B6%E4%B8%AD%E7%94%9F%E6%88%90%E5%85%B7%E6%9C%89%E7%BE%8E%E8%A7%82%E9%A3%8E%E6%A0%BC%E7%9A%84%E8%87%AA%E5%AE%9A%E4%B9%89%E8%A1%A8%E6%A0%BC%EF%BC%9F.png)
我有一个包含函数参数列表及其简短描述的表格。但是,我打算用漂亮的样式在 Latex 中创建此表格。我查看了这个社区,但找不到可以用于我的 Latex 项目的所需模板。我怎样才能在中实现我想要的表格latex
?有什么办法可以实现吗?有什么想法吗?
我在 MS Office 中创建了此表;我想在 Latex 中使用此表:
我怎样才能在乳胶中生成上述表格?提前致谢 :)
编辑:
感谢diabox
这个包,我使用了它的示例乳胶代码,但不知道如何在输出表上添加样式。有什么想法吗?
\begin{tabular}{|c|c|c|} \hline
\backslashbox[2cm]{num}{alpha}
& A & B \\\hline
1 & A1 & B1 \\\hline
2 & A2 & B2 \\\hline
\end{tabular}
答案1
这是对您的代码的改进。它仍然需要X
最后一列的列类型和makecell
。我将其替换slashbox
为diagbox
:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{ragged2e}
\usepackage[table, svgnames]{xcolor}
\usepackage{array, tabularx, multirow, booktabs, diagbox}
\usepackage{makecell}
\setcellgapes{2pt}
\begin{document}
\noindent\setlength\extrarowheight{2pt}\begin{tabularx}{\linewidth}{|c|c| >{\arraybackslash}X|} \hline
\diagbox[width = 3.5cm, height =1.2cm]{Param. list}{\raisebox{-2ex}{Name}}
& Parameter & \multicolumn{1}{c|}{Description} \\\hline
\hline
\multirow{3}*{Replicate Type} & Biological & Rain most of the day\\
\cline{2-3}
& Technical & Sunny with some clouds xxxx\\
\cline{2-3}
\hline
\multirow{5}*{Thresholds} & $T^{s}$ (Stringent) & Rain most of the day\\
\cline{2-3}
& $T^{w}$ (Weak)& Sunny with some clouds xxxx\\
\cline{2-3}
& $\gamma$ & A clear day with a lot of sunshine\\
\hline
\multirowcell{2}{Multiple Testing \\correction} & FDR & Some long text. Some long text. \\\hline
\multirowcell{3}{Multiple Overlap\\ ERs treatment} & Use most stringent peak & Rain most of the day\\
\cline{2-3}
& Use least stringent peak & Sunny with some clouds. some long text\\
\cline{2-3}
\hline
\end{tabularx}
\end{document}
答案2
建议:没有垂直线,水平线很少,大部分用垂直间距代替。在我看来,看起来比 Word 好看。
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{ragged2e}
\usepackage[table, svgnames]{xcolor}
\usepackage{array, tabularx, multirow, booktabs}
\usepackage{makecell}
\setcellgapes{2pt}
\begin{document}
\begin{table}[!htb]\sffamily\makegapedcells
\begin{tabularx}{\linewidth}{>{\RaggedRight\hsize=0.7\hsize}X>{\RaggedRight\hsize=0.85\hsize}X >{\RaggedRight\hsize=1.45\hsize\arraybackslash}X}
&\multicolumn{2}{c}{\bfseries Param} \\
\bfseries Param list & parameter & Description \\
\arrayrulecolor{Gainsboro!75}\midrule[1.2ex]
\multirow{2}{*}{Replicate Type} & Biological & Few lines intro text \\
& Technical & Few lines intro text \\
\addlinespace[1.5ex]
\multirow{7}{*}{Thresholds} & Stringent Threshold (T\^{}S) & Few lines intro text \\
& Weak Threshold (T\^{}w) & Few lines intro text \\
& Combined Stringency Threshold (gamma) & Few lines intro text \\
\addlinespace[1.5ex]
\multirow{2}{=}[-.5ex]{Multiple overlap ERs Treatment} & Use most stringent & Few lines intro text \\
& Use least stringent & Few lines intro text \\
\addlinespace[1.5ex]
Multiple testing correction & FDR & Few lines intro text \\
\bottomrule[1.2ex]
\end{tabularx}
\end{table}
\end{document}
答案3
感谢@Leo Liu 提供有用的软件包来完成此任务。不过,这是我自己的答案:
\begin{tabular}{|c|c|c|} \hline
\backslashbox[5cm]{Parameter list}{Name}
& Parameter & Description \\\hline
\hline
\multirow{2}*{Replicate Type} & Biological & Rain most of the day\\
\cline{2-3}
& Technical & Sunny with some clouds xxxx\\
\cline{2-3}
\hline
\multirow{3}*{Thresholds} & $T^{s}$ (Stringent) & Rain most of the day\\
\cline{2-3}
& $T^{w}$ (Weak)& Sunny with some clouds xxxx\\
\cline{2-3}
& $\gamma$ & A clear day with a lot of sunshine\\
\hline
Multiple Testing correction & FDR & some long text \\\hline
\multirow{2}*{Multiple Overlap ERs treatment} & Use most stringent peak & Rain most of the day\\
\cline{2-3}
& Use least stringent peak & Sunny with some clouds. some long text\\
\cline{2-3}
\hline
\end{tabular}