I want to create the following type of table for my paper.
How can I do it?
Thank you.
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityRecreating your table (but with only natural width columns) you can use the following to get the lines like in your example:
\documentclass[]{article}
\begin{document}
\begin{tabular}{|*{10}{l|}}
\hline
A & B & C & D & \multicolumn{6}{c|}{F} \\
& & & & \multicolumn{6}{c|}{} \\
\cline{5-10}
& & & & a & b & c & d & e & f \\
& & & & & & & & & \\
\hline
1 & 1.1 & - & - & - & - & - & - & - & - \\
\hline
2 & 1.2 & - & - & - & - & - & - & - & - \\
\hline
3 & 1.3 & - & - & - & - & - & - & - & - \\
\hline
\end{tabular}
\end{document}
But: it is considered bad typography to use tables with vertical rules and too many horizontal ones, therefore I'd advice to use the rules provided by booktabs
and that you read booktabs
documentation (there are a lot of helpful tips concerning good looking tables):
\documentclass[]{article}
\usepackage{multirow}
\usepackage{booktabs}
\newcommand\vcenterhead[1]
{%
\multirow{2}{*}[-0.5\dimexpr\aboverulesep+\belowrulesep+\cmidrulewidth\relax]{#1}%
}
\begin{document}
\begin{tabular}{*{10}{l}}
\toprule
\vcenterhead{A} & \vcenterhead{B} & \vcenterhead{C} & \vcenterhead{D} & \multicolumn{6}{c}{F} \\
\cmidrule(l{.5\tabcolsep}r{.5\tabcolsep}){5-10}
& & & & a & b & c & d & e & f \\
\midrule
1 & 1.1 & - & - & - & - & - & - & - & - \\
2 & 1.2 & - & - & - & - & - & - & - & - \\
3 & 1.3 & - & - & - & - & - & - & - & - \\
\bottomrule
\end{tabular}
\end{document}
\cline{4-7}
. To merge cells horizontally you can use\multicolumn{<count>}{<align>}{<contents>}
. To merge cells vertically you can use\usepackage{multirow}
and\multirow{<count>}{<width>}{<contents>}
(use*
for<width>
to use the contents' natural width).