can anyone help me to do this table in latex and my text in t and f column is too much
- 39,141
- 11
1 Answers
As it is only a prototype, I know two ways to do what you ask, with minimal effort.
(1) Using excel to build a prototype of the table and export it to LaTeX using the add-on Excel2LaTeX from:
https://ctan.org/tex-archive/support/excel2latex?lang=en
My only typing was changing the line \begin{tabular}{|c|c|c|c|c|} to expand the columns and adding two packages.
(2) The second example is using the package nicematrix.
The code is much cleaner because it provides the command \Block to define multirow and multicolumn cells (4 cells)
and also provides directives as hvlines to draw all lines, while respecting the blocks, and commands to expands all the cell vertically.
My only typing was search and delete all the \clines and \bigstruts plus changing the \multirows for \Block
The package manual shows many examples to learn and test.
\documentclass[12pt,a4paper]{article}
\usepackage{bigstrut} % for the first table
\usepackage{multirow}% for the first table
\usepackage{nicematrix} % the second table only needs the package
\begin{document}
\newcolumntype{L}[1]{>{\centering\arraybackslash}p{#1}} % expand & center column
\section{Output from Excel2LaTeX}
% Table generated by Excel2LaTeX from sheet 'Sheet1'
%\begin{tabular}{|c|c|c|c|c|} % original output from from Excel2LaTeX
\begin{tabular}{|L{0.1\textwidth}|L{0.18\textwidth}|L{0.18\textwidth}|L{0.15\textwidth}|L{0.2\textwidth}|} % set columns widths
\hline
F & S & T & F & F \bigstrut\
\hline
1 & \multirow{10}[20]{}{19} & 23 & 40 & 58 \bigstrut\
\cline{1-1}\cline{3-5}2 & & 24 & 41 & 59 \bigstrut\
\cline{1-1}\cline{3-5}3 & & 25 & 42 & 60 \bigstrut\
\cline{1-1}\cline{3-5}4 & & 26 & 43 & 61 \bigstrut\
\cline{1-1}\cline{3-5}5 & & 27 & 44 & 62 \bigstrut\
\cline{1-1}\cline{3-5}6 & & 28 & 45 & 63 \bigstrut\
\cline{1-1}\cline{3-5}7 & & 29 & 46 & 64 \bigstrut\
\cline{1-1}\cline{3-5}8 & & 30 & 47 & 65 \bigstrut\
\cline{1-1}\cline{3-5}9 & & 31 & 48 & 66 \bigstrut\
\cline{1-1}\cline{3-5}10 & & 32 & 49 & 67 \bigstrut\
\hline
11 & \multirow{3}[6]{}{20} & 33 & 50 & 68 \bigstrut\
\cline{1-1}\cline{3-5}12 & & 34 & 51 & 69 \bigstrut\
\cline{1-1}\cline{3-5}13 & & 35 & 52 & 70 \bigstrut\
\hline
14 & \multirow{3}[6]{}{21} & 36 & 53 & 71 \bigstrut\
\cline{1-1}\cline{3-5}15 & & 37 & 54 & 72 \bigstrut\
\cline{1-1}\cline{3-5}16 & & 38 & 55 & 73 \bigstrut\
\hline
17 & \multirow{2}[4]{}{22} & 39 & 56 & 74 \bigstrut\
\cline{1-1}\cline{3-5}18 & & 40 & 57 & 75 \bigstrut\
\hline
\end{tabular}%
\newpage
\section{Package nicematrix}
\begin{NiceTabular}{L{0.1\textwidth}L{0.18\textwidth}L{0.18\textwidth}L{0.15\textwidth}L{0.2\textwidth}}[% set columns widths
cell-space-top-limit = 5pt,cell-space-bottom-limit = 5pt, % expands all cell
hvlines % draw all lines
]
F & S & T & F & F \
1 & \Block{10-1}{19}& 23 & 40 & 58 \
2 & & 24 & 41 & 59 \
3 & & 25 & 42 & 60 \
4 & & 26 & 43 & 61 \
5 & & 27 & 44 & 62 \
6 & & 28 & 45 & 63 \
7 & & 29 & 46 & 64 \
8 & & 30 & 47 & 65 \
9 & & 31 & 48 & 66 \
10 & & 32 & 49 & 67 \
11 & \Block{3-1}{20} & 33 & 50 & 68 \
12 & & 34 & 51 & 69 \
13 & & 35 & 52 & 70 \
14 & \Block{3-1}{21} & 36 & 53 & 71 \
15 & & 37 & 54 & 72 \
16 & & 38 & 55 & 73 \
17 & \Block{ 2-1}{22}& 39 & 56 & 74 \
18 & & 40 & 57 & 75 \
\end{NiceTabular}
\end{document}
- 39,141




\multirow. A google search will bring you to tutorials. – Symbol 1 Jan 23 '21 at 00:21