[Tex/LaTex] Create complex table with LaTeX

tables

I am very new to LaTeX, and I am trying to create a table. The table should look like this one:

Enter image description here

I created this code:

\begin{table}[h!]
\centering
\caption{My caption}
\label{my-label}
\begin{tabular}{lll}
Path       & \multicolumn{2}{l}{Alice}  \\
Type       & \multicolumn{2}{l}{Client} \\
Parameters &              &
\end{tabular}
\end{table}

But I am stuck on how to add the parameters. It also doesn't show the table lines. How can I do this?

Best Answer

Dan's answer is very good and teaches how to build such a table from scratch. However, if you have several tables following the same patterns it might be better to have a higher level syntax for them.

\documentclass{article}
\usepackage{xparse}

\ExplSyntaxOn
\NewDocumentCommand{\parametertable}{mmm}
 {
  \seq_set_split:Nnn \l_ella_parametertable_parameters_seq { \\ } { #3 }
  \begin{tabular}{|l|p{1in}|p{1in}|}
  \hline
  Name & \multicolumn{2}{l|}{#1} \\
  \hline
  Type & \multicolumn{2}{l|}{#2} \\
  \hline
  Parameters & 
  \seq_use:Nn \l_ella_parametertable_parameters_seq { \\ \cline{2-3} & }
  \\
  \hline
  \end{tabular}
 }
\ExplSyntaxOff

\begin{document}

\parametertable{Alice}{Client}{
  Param1 & Value \\
  Param2 & Value \\
  Param3 & Value
}

\end{document}

enter image description here

The advantage to such an approach will be evident when you'll decide that, after all, those rules are annoying and you'll want to switch to booktabs. Just modifying the main command in a few details, all your similar tables will change format.

\documentclass{article}
\usepackage{xparse}
\usepackage{booktabs}

\ExplSyntaxOn
\NewDocumentCommand{\parametertable}{mmm}
 {
  \seq_set_split:Nnn \l_ella_parametertable_parameters_seq { \\ } { #3 }
  \begin{tabular}{lp{1in}p{1in}}
  \toprule
  Name & \multicolumn{2}{l}{#1} \\
  \midrule
  Type & \multicolumn{2}{l}{#2} \\
  \midrule
  Parameters & 
  \seq_use:Nn \l_ella_parametertable_parameters_seq { \\ & }
  \\
  \bottomrule
  \end{tabular}
 }
\ExplSyntaxOff

\begin{document}

\parametertable{Alice}{Client}{
  Param1 & Value \\
  Param2 & Value \\
  Param3 & Value
}

\end{document}

Note that the document code has not changed in any way.

enter image description here

Related Question