4

How can I draw this table in LaTeX ?

enter image description here

Here is my MWE:

\begin{table}
\centering
\begin{tabular}{|c|c|c|c|c|c|c|}
\hline
 & & &  A & B & C & D \\
\hline
 & & Durée & \multicolumn{4}{|c|}{Taxe[DA/Km$^{2}$]} \\
\hline
\multirow{3}*{Période de recherche} & Phase initiale & 3 ans & 4000 & 4800 & 6000 & 8000 \\
\cline{2-7}
 & 2$^{me}$phase & 2 ans & 6000 & 8000 & 10000 & 12000 \\
\cline{2-7}
 & 3$^{me}$phase & 2 ans & 8000 & 12000 & 14000 & 16000 \\
 \hline
 \multicolumn{2}{|c|}{Période de rétention + période exceptionnelle} &  0 ans & 400000 & 560000 & 720000 & 800000 \\
 \hline
\multicolumn{2}{|c|}{Période d’exploitation} & 25 ans & 16000 & 24000 & 28000 & 32000 \\
\hline
\end{tabular}
\caption{Tarif de la taxe superficiaire}
\label{tab:my_label}
\end{table}

I get this:

enter image description here

4
  • To remove a horizontal line, use \cline{3-7} instead of \hline.
  • To remove a vertical line, use \multicolumn{2}{c|}{} and specify only the desired vertical lines.
  • Alter \extrarowheight (from the array package) to add some space to each row, so it looks nicer.
\documentclass[a4paper]{article}
\usepackage[margin=1cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{multirow}
\usepackage{array}

\setlength{\extrarowheight}{2pt}

\begin{document}
\begin{table}
\centering
\begin{tabular}{|c|c|c|c|c|c|c|}
\cline{4-7}
\multicolumn{3}{c|}{} &  A & B & C & D \\
\cline{3-7}
\multicolumn{2}{c|}{} & Durée & \multicolumn{4}{|c|}{Taxe[DA/Km$^{2}$]} \\
\hline
\multirow{3}*{Période de recherche} & Phase initiale & 3 ans & 4000 & 4800 & 6000 & 8000 \\
\cline{2-7}
& 2$^{me}$phase & 2 ans & 6000 & 8000 & 10000 & 12000 \\
\cline{2-7}
& 3$^{me}$phase & 2 ans & 8000 & 12000 & 14000 & 16000 \\
\hline
\multicolumn{2}{|c|}{Période de rétention + période exceptionnelle} &  0 ans & 400000 & 560000 & 720000 & 800000 \\
\hline
\multicolumn{2}{|c|}{Période d’exploitation} & 25 ans & 16000 & 24000 & 28000 & 32000 \\
\hline
\end{tabular}
\caption{Tarif de la taxe superficiaire}
\label{tab:my_label}
\end{table}
\end{document}

enter image description here

2
  • 1
    Maybe you could add a bit extra row height (like \setlength{\extrarowheight}{2pt}) to make it look a bit better. – TeXnician Apr 18 '18 at 8:50
  • I'll try this too, thank you for the trick :) – Red One Apr 18 '18 at 20:40
4

I would like to suggest that you give your table a much more open "look", mainly by getting rid of all vertical lines and most horizontal lines. For the few remaining horizontal lines, don't use \hline and \cline. Insetead, use the well-spaced lines provided by the booktabs package: \toprule; \bottomrule, \midrule, \cmidrule, and addlinespace. (The last macro adds "just" whitespace. As a divider, whitespace can be every bit as effective as an actual, visible line.)

enter image description here

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage{siunitx,booktabs}
\usepackage[a4paper,margin=2.5cm]{geometry} % choose page dimensions

\begin{document}
\begin{table}
\sisetup{group-digits=false,per-mode=symbol}
\centering
\begin{tabular}{@{} ll r *{4}{S[table-format=6.0]} @{}}
\toprule
 & & & {A} & {B} & {C} & {D} \\
\cmidrule(l){4-7}
 & & Durée & \multicolumn{4}{c@{}}{Taxe [\si{DA\per\kilo\meter\squared}]} \\
\midrule
Période de recherche & Phase initiale & 3 ans & 4000 & 4800 & 6000 & 8000 \\
%\cline{2-7}
 & 2\textsuperscript{me} phase & 2 ans & 6000 & 8000 & 10000 & 12000 \\
 & 3\textsuperscript{me} phase & 2 ans & 8000 & 12000 & 14000 & 16000 \\
\addlinespace
\multicolumn{2}{@{}l}{Période de rétention \& période exceptionnelle} 
                               &  0 ans & 400000 & 560000 & 720000 & 800000 \\
\addlinespace
\multicolumn{2}{@{}l}{Période d'exploitation} 
                               & 25 ans & 16000 & 24000 & 28000 & 32000 \\
\bottomrule
\end{tabular}
\caption{Tarif de la taxe superficiaire}
\label{tab:my_label}
\end{table}
\end{document}
1
  • This is indeed more beautiful to look, and it's very clear thank you :) – Red One Apr 18 '18 at 20:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.