-2

I would like to create the following table in the Latex

enter image description here

How can I create one?

Mico
  • 506,678
Encipher
  • 548

2 Answers2

1

You've provided a sketch of the desired overall appearance, but you've left a lot of design aspects unspecified. E.g., should automatic line-wrapping be enabled, for all cells or for just a few? Should the cell contents be left-aligned, centered, right-aligned, something else? Should the 9 data columns all have the same width? The sketch you posted suggests that the left-hand or "header" column should be about 20% wider than the data columns; is this impression correct? Should the table be typeset in portrait or landscape mode?

I had to address some of these issues to come up with the following table. E.g., because the table has 10 columns, it is typeset in landscape mode; its target width is the width of the (rotated) text block; and automatic line breaking is enabled in all cells (except those formed by \multicolumn directives). Please advise if you'd rather apply different settings.

enter image description here

\documentclass{article}% or some other suitable document class
\usepackage{tabularx}  % for 'tabualarx' env. and 'X' col. type
\usepackage{ragged2e}  % for '\RaggedRight' and '\Centering' macros
\usepackage{pdflscape} % for 'landscape' environment
\newcolumntype{L}[1]{>{\RaggedRight\hsize=#1\hsize\hspace{0pt}}X}
\newcolumntype{C}[1]{>{\Centering\hsize=#1\hsize\hspace{0pt}}X}

\begin{document}

\begin{landscape} \setlength\extrarowheight{3pt} % for a more open look \setlength\arrayrulewidth{0.5pt} % default: 0.4pt

\begin{table} %\caption{Place the caption here} % add if needed %\smallskip

% Make the contents of first col. left-aligned, and % the contents of the other nine columns centered. \begin{tabularx}{\linewidth}{|L{1.18}|*{9}{C{0.98}|}}

\hline \multicolumn{10}{|c|}{\dots} \ % full-width header cell \hline xyz & \multicolumn{3}{ c|}{\dots} % 3 header cells that span 3 columns each & \multicolumn{3}{ c|}{\dots} & \multicolumn{3}{ c|}{\dots} \ \hline %% now for the "body" of the table abc & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \ \hline def & & & & & & & & & \ \hline ghi & & & & & & & & & \ \hline jkl & & & & & & & & & \ \hline mno & & & & & & & & & \ \hline pqr & & & & & & & & & \ \hline \end{tabularx} \end{table}

\end{landscape}

\end{document}

Mico
  • 506,678
1

With {NiceTabular} of nicematrix.

\documentclass{article}
\usepackage{geometry}
\usepackage{nicematrix}

\begin{document}

\begin{NiceTabular}{X[l]*{9}{X[c]}}[hvlines] \Block{1-10}{...} \ xyz & \Block{1-3}{...} &&& \Block{1-3}{...} &&& \Block{1-3}{...} \ abc & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \ def \ ghi \ jkl \ mno \ pqr \ \end{NiceTabular}

\end{document}

Output of the above code

F. Pantigny
  • 40,250