I wanted to create a custom table with latex but I have an issue concerning the size of my table which not ends at the end of the width of the document. I don't understand why because 5x0.2\textwidth = 1 \textwidth.
\documentclass{article}
\usepackage{graphicx}
\usepackage[export]{adjustbox}
\usepackage{tabularx} % in the preamble
\usepackage{multirow}
\usepackage{geometry}
\geometry{
a4paper,
total={170mm,257mm},
left=10mm,
right= 10mm,
top=10mm,
}
\begin{document}
\noindent\begin{tabularx}{\textwidth} {
| >{\centering\arraybackslash}m{.2\textwidth}
| >{\centering\arraybackslash}m{.2\textwidth}
| >{\centering\arraybackslash}m{.2\textwidth}
| >{\centering\arraybackslash}m{.2\textwidth}
| >{\centering\arraybackslash}m{.2\textwidth} |
}
\hline
\multirow{5}{*}{logo} & \multicolumn{3}{c|}{C A} & M \\ \cline{2-5}
& \multicolumn{3}{c|}{Titre} & R \\ \cline{2-5}
& a & b & c & B \\ \cline{2-5}
& d & e & f & Autres \\ \cline{2-5}
& h & i & j & DATE \\ \hline
\end{tabularx}
\end{document}
How can I solve this issue ?
m{.2\textwidth}
withX
(there is no sense in usingtabularx
without automatically-adjustable columns marked byX
). You also have a warning from geometry you should consider