0

I have a table with function parameter list and its short description. However, I intend to create this table in latex with beautiful style. I looked into this community, but couldn't locate the desired template that I can use for my latex project. How can I achieve my desired table in latex ? Is there any way to make this happen? Any idea please?

I created this table in MS office; I want this table in latex:

enter image description here

How can I generate above table in latex? Thanks in advance :)

Edit :

Thanks for diabox package, I used its example latex code like this, but don't know how to add style on output table. Any idea ?

\begin{tabular}{|c|c|c|} \hline
\backslashbox[2cm]{num}{alpha}
& A & B \\\hline
1 & A1 & B1 \\\hline
2 & A2 & B2 \\\hline
\end{tabular}
5
  • diagbox package may help you to create table heads with diagonal lines. And multirow package may helps you to create multi-row cells.
    – Leo Liu
    Mar 29, 2017 at 11:47
  • @LeoLiu I am beginner level for latex. Could you please give your concrete solution here (detailed latex code)? So other people like me could get benefit from your contribution. Thanks in advance :)
    – Jerry07
    Mar 29, 2017 at 11:49
  • 1
    See diagbox and multirow
    – Leo Liu
    Mar 29, 2017 at 11:53
  • You may start with the answers to questions like tex.stackexchange.com/questions/359984/…, just to get into the topic. You should at least produce a minimal example with the contents of the table, so that other users can easily help you to get the desired results.
    – Jürgen
    Mar 29, 2017 at 11:54
  • @LeoLiu how can I fix the cell wdith? In my approach, if one cell has longer text, I intend to break it and start with new line. How can I do that? Any idea?
    – Jerry07
    Mar 29, 2017 at 13:19

3 Answers 3

2

Here's an improvement to your code. It still requires the X column type for the last column and makecell. I replaced slashbox with 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} 

enter image description here

1
  • Dear Bernard, many thanks for your improvement on my code.
    – Jerry07
    Mar 29, 2017 at 14:45
4

Here's a proposition: no vertical rule, very few horizontal rules, mostly replaced with vertical spacings. Looks nicer than Word's, in my opinion.

  \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} 

enter image description here

1
  • Dear Bernard, I liked your answer. But I want to fix my own answer, whereas cell width can't be adjusted. If Description column has more text, then the column is not appeared correctly. Could you give me a hand to fix this issue ?
    – Jerry07
    Mar 29, 2017 at 13:25
1

Thanks to @Leo Liu for giving useful package to make this task happen. However, this is my own answer:

\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}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .