I want to make a table that spreads to \textwidth. I tried several ways (none of them working properly Tabularx (xltabular) with only multicolumns not spreading properly, xltabular produces error in combination with multicolumn and \kill)
What I want to know is what I need to change (and learn) in order to make such tables.
MWE
\documentclass[paper=a4,fontsize=18pt]{article} \usepackage{geometry} \geometry{ % verbose, portrait, % page orientation (landscape or portrait) a4paper, % paper size tmargin=5mm, % page top margin bmargin=5mm, % page bottom margin lmargin=5mm, % page left margin rmargin=5mm % page right maring } \usepackage[utf8]{inputenc} \usepackage[defaultsans]{opensans} %font \usepackage[T1, T2A]{fontenc} \usepackage{fancyhdr} \usepackage{multicol} \usepackage{colortbl} \usepackage{booktabs} \usepackage{tabularx} \usepackage{longtable} \usepackage{layouts} \usepackage{xltabular} %\pagestyle{fancy} \definecolor{greyCell}{RGB}{235,235,235} \newcommand{\smf}{% small font \fontsize{9}{11}\selectfont } \begin{document} \def\arraystretch{1}% vertical padding \setlength{\tabcolsep}{0.8mm} % for the horizontal padding \fontsize{10}{13}\selectfont \noindent \noindent \begin{xltabular}{\textwidth}{|*{20}{c|}} \hline \multicolumn{20}{|c|}{ \textbf{ Header } } \\ \multicolumn{2}{|l}{ \smf Label} & \multicolumn{2}{l}{ } & \multicolumn{6}{l}{ \smf 2020.07 } & \multicolumn{3}{l}{ \smf Label} & \multicolumn{7}{l|}{ \smf long variable } \\ \multicolumn{2}{|l}{ \smf Label} & \multicolumn{2}{r}{ \smf 146 } & % number cell \multicolumn{6}{l}{ \smf long variable test } & % cell with person name \multicolumn{3}{l}{ \smf Label} & \multicolumn{7}{l|}{ \smf 23 } \\ % number cell \multicolumn{2}{|l}{ \smf Label } & \multicolumn{2}{r}{ \smf 12 } & % number cell \multicolumn{6}{l}{ \smf variable variable variable } & % can be long \multicolumn{3}{l}{ \smf Label} & \multicolumn{7}{l|}{ \smf Long variable long variable } \\ \multicolumn{2}{|l}{ \smf Label} & \multicolumn{2}{r}{ \smf 24568545 } & % number cell \multicolumn{6}{l}{ \smf long variable here } & \multicolumn{3}{l}{ \smf Label } & \multicolumn{7}{l|}{ \smf 1,000.12 } \\ \hline \multicolumn{10}{|c}{ \cellcolor{greyCell} \smf \textbf{Label} } & \multicolumn{10}{|c|}{ \cellcolor{greyCell} \smf \textbf{Label} } \\ \hline \multicolumn{2}{|c|}{ \smf \textit{label}} & \multicolumn{5}{c|}{ \smf \textit{label} } & \multicolumn{2}{c|}{ \smf \textit{label} } & \smf \textit{d\%} & \multicolumn{2}{c|}{ \smf \textit{label}} & \multicolumn{5}{c|}{ \smf \textit{label} } & \multicolumn{2}{c|}{ \smf \textit{label} } & \smf \textit{d\%} \\ \hline \multicolumn{2}{|r|}{ \smf 104 } & % number cell \multicolumn{5}{l|}{ \smf long variable } & \multicolumn{2}{r|}{ \smf 1,000.00 } & % number cell \smf 14.4 & \multicolumn{2}{r|}{ \smf 455 } & % number cell \multicolumn{5}{l|}{ \smf long variable } & \multicolumn{2}{r|}{ \smf 777.20 } & \smf 0,4 \\ \hline \multicolumn{7}{|l|}{ \smf long label } & % first row bottom \multicolumn{2}{r|}{ \smf 1,144.00 } & % number cell & \multicolumn{7}{l|}{ \smf long label } & \multicolumn{2}{r|}{ \smf 1,234.12 } & % number cell \\ \hline \multicolumn{7}{|l|}{ \smf long label } & % second row bottom \multicolumn{2}{r|}{ \smf 1,232.12 } & & \multicolumn{7}{l|}{ \smf very long label } & \multicolumn{2}{r|}{ \smf 1,999.12 } & \\ \hline \multicolumn{7}{|l|}{ \smf long label} & % third row bottom \multicolumn{2}{r|}{ \smf 1,888.32 } & & \multicolumn{7}{l|}{ \smf long label } & \multicolumn{2}{r|}{ \smf 1,878.99 } & \\ \hline \multicolumn{7}{|l|}{ \smf long label } & % last row bottom \multicolumn{2}{r|}{ \smf 1,878.99 } & & \multicolumn{7}{l|}{ \smf long label } & \multicolumn{2}{r|}{ \smf 1,878.99 } & \\ \hline \end{xltabular} \end{document} How it should really look (I did this myself but its not working under environment pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017)) 
-----EDIT-----
I did a new MWE using only longtable and multicolumn. The idea is the same to use a n number of columns and take portions of them. This time each row is using p type columns with calculated width.
\documentclass[paper=a4,fontsize=18pt]{article} \usepackage{geometry} \geometry{ % verbose, portrait, % page orientation (landscape or portrait) a4paper, % paper size tmargin=5mm, % page top margin bmargin=5mm, % page bottom margin lmargin=5mm, % page left margin rmargin=5mm % page right maring } \usepackage[utf8]{inputenc} \usepackage[defaultsans]{opensans} %font \usepackage[T1, T2A]{fontenc} \usepackage[english,bulgarian]{babel} \usepackage{fancyhdr} \usepackage{multicol} \usepackage{longtable} \usepackage{colortbl} \usepackage{xcolor} \usepackage{layouts} \renewcommand{\familydefault}{\sfdefault} \definecolor{greyCell}{RGB}{235,235,235} \newcommand{\smf}{ % small font \fontsize{9}{11}\selectfont } \begin{document} \def\arraystretch{1}% vertical padding \setlength{\tabcolsep}{0.8mm} % for the horizontal padding \fontsize{10}{13}\selectfont \vspace{-4mm} \noindent \LTleft=0pt \LTright=0pt \begin{longtable}{@{\extracolsep{\fill}}*{20}{p{0.5\textwidth}} @{}} \hline \multicolumn{20}{|p{\dimexpr 1\textwidth-2\tabcolsep}|}{ \centering \textbf{ Платежна бележка } }\\ % header \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep}}{ \smf Период } & % ---------------- row 1 \multicolumn{2}{p{\dimexpr 0.1\textwidth-2\tabcolsep}}{ } & \multicolumn{6}{p{\dimexpr 0.3\textwidth-2\tabcolsep}}{ \smf 2020.07 } & \multicolumn{3}{p{\dimexpr 0.15\textwidth-2\tabcolsep}}{ \smf Календар } & \multicolumn{7}{p{\dimexpr 0.35\textwidth-2\tabcolsep}|}{ \smf 5 Пет дневна работна седмица } \\ \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep}}{ \smf За лице } & % ---------------- row 2 \multicolumn{2}{p{\dimexpr 0.1\textwidth-2\tabcolsep}}{ \smf\raggedleft\arraybackslash 146 } & \multicolumn{6}{p{\dimexpr 0.3\textwidth-2\tabcolsep}}{ \smf Атанас Антонов Атанасов } & \multicolumn{3}{p{\dimexpr 0.15\textwidth-2\tabcolsep}}{ \smf Работни дни } & \multicolumn{7}{p{\dimexpr 0.35\textwidth-2\tabcolsep}|}{ \smf 23 } \\ \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep}}{ \smf Заето в } & % ---------------- row 3 \multicolumn{2}{p{\dimexpr 0.1\textwidth-2\tabcolsep}}{ \smf\raggedleft\arraybackslash 12 } & \multicolumn{6}{p{\dimexpr 0.3\textwidth-2\tabcolsep}}{ \smf Поддръжка } & \multicolumn{3}{p{\dimexpr 0.15\textwidth-2\tabcolsep}}{ \smf Трудов стаж } & \multicolumn{7}{p{\dimexpr 0.35\textwidth-2\tabcolsep}|}{ \smf 24г. 1м. 4д. към 01.07.2020 } \\ \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep}}{ \smf Длъжност } & % ---------------- row 4 \multicolumn{2}{p{\dimexpr 0.1\textwidth-2\tabcolsep}}{ \smf\raggedleft\arraybackslash 24236003 } & \multicolumn{6}{p{\dimexpr 0.3\textwidth-2\tabcolsep}}{ \smf Експерт, организация на труда } & \multicolumn{3}{p{\dimexpr 0.15\textwidth-2\tabcolsep}}{ \smf Осн. заплата } & \multicolumn{7}{p{\dimexpr 0.35\textwidth-2\tabcolsep}|}{ \smf 1,000.00 } \\ \hline \multicolumn{10}{|p{\dimexpr 0.5\textwidth-2\tabcolsep-1\arrayrulewidth}|}{ \smf \centering \cellcolor{greyCell} \textbf{ Начисления } } & \multicolumn{10}{p{\dimexpr 0.5\textwidth-2\tabcolsep-1\arrayrulewidth}|}{ \smf \centering \cellcolor{greyCell} \textbf{ Удръжки } } \\ \hline \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \centering \textit{шифър} } & \multicolumn{5}{|p{\dimexpr 0.25\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \centering \textit{Наименование} } & \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \centering \textit{Сума} } & \multicolumn{1}{|p{\dimexpr 0.05\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \centering \textit{д\%} } & \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \centering \textit{шифър} } & \multicolumn{5}{|p{\dimexpr 0.25\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \centering \textit{Наименование} } & \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \centering \textit{Сума} } & \multicolumn{1}{|p{\dimexpr 0.05\textwidth-2\tabcolsep-1\arrayrulewidth}|}{ \smf \centering \textit{д\%} } \\ \hline \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedleft } & \multicolumn{5}{|p{\dimexpr 0.25\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedright От 01.07.2020 г. ОМВ } & \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedleft 1,000.00 } & \multicolumn{1}{|p{\dimexpr 0.05\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedleft 0 } & \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedleft 455 } & \multicolumn{5}{|p{\dimexpr 0.25\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedright Разпл. сметка Уникредит } & \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedleft 777.20 } & \multicolumn{1}{|p{\dimexpr 0.05\textwidth-2\tabcolsep-1\arrayrulewidth}|}{ \smf \raggedleft 0 } \\ \hline \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedleft 104 } & \multicolumn{5}{|p{\dimexpr 0.25\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedright Заплата по щат } & \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedleft 1,000.00 } & \multicolumn{1}{|p{\dimexpr 0.05\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedleft 23 } & \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedleft 485 } & \multicolumn{5}{|p{\dimexpr 0.25\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedright Разпл. сметка FiBank } & \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedleft 75.00 } & \multicolumn{1}{|p{\dimexpr 0.05\textwidth-2\tabcolsep-1\arrayrulewidth}|}{ \smf \raggedleft 0 } \\ \hline \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedleft 111 } & \multicolumn{5}{|p{\dimexpr 0.25\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedright Допл.проф.опит и стаж } & \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedleft 144.00 } & \multicolumn{1}{|p{\dimexpr 0.05\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedleft 14.4 } & \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedleft 490 } & \multicolumn{5}{|p{\dimexpr 0.25\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedright Банков заем } & \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedleft 0.00 } & \multicolumn{1}{|p{\dimexpr 0.05\textwidth-2\tabcolsep-1\arrayrulewidth}|}{ \smf \raggedleft 0 } \\ \hline \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ } & \multicolumn{5}{|p{\dimexpr 0.25\textwidth-2\tabcolsep-1\arrayrulewidth}}{ } & \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ } & \multicolumn{1}{|p{\dimexpr 0.05\textwidth-2\tabcolsep-1\arrayrulewidth}}{ } & \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedleft 500 } & \multicolumn{5}{|p{\dimexpr 0.25\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedright Данък общ доход } & \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedleft 98.63 } & \multicolumn{1}{|p{\dimexpr 0.05\textwidth-2\tabcolsep-1\arrayrulewidth}|}{ \smf \raggedleft 10 } \\ \hline \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ } & \multicolumn{5}{|p{\dimexpr 0.25\textwidth-2\tabcolsep-1\arrayrulewidth}}{ } & \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ } & \multicolumn{1}{|p{\dimexpr 0.05\textwidth-2\tabcolsep-1\arrayrulewidth}}{ } & \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedleft 501 } & \multicolumn{5}{|p{\dimexpr 0.25\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedright ЛОВ ф.\textquotedbl{}Безработица\textquotedbl{} } & \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedleft 4.58 } & \multicolumn{1}{|p{\dimexpr 0.05\textwidth-2\tabcolsep-1\arrayrulewidth}|}{ \smf \raggedleft 0.4 } \\ \hline \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ } & \multicolumn{5}{|p{\dimexpr 0.25\textwidth-2\tabcolsep-1\arrayrulewidth}}{ } & \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ } & \multicolumn{1}{|p{\dimexpr 0.05\textwidth-2\tabcolsep-1\arrayrulewidth}}{ } & \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedleft 533 } & \multicolumn{5}{|p{\dimexpr 0.25\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedright ЛОВ ф.\textquotedbl{}Пенсии\textquotedbl{} } & \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedleft 75.28 } & \multicolumn{1}{|p{\dimexpr 0.05\textwidth-2\tabcolsep-1\arrayrulewidth}|}{ \smf \raggedleft 6.58 } \\ \hline \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ } & \multicolumn{5}{|p{\dimexpr 0.25\textwidth-2\tabcolsep-1\arrayrulewidth}}{ } & \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ } & \multicolumn{1}{|p{\dimexpr 0.05\textwidth-2\tabcolsep-1\arrayrulewidth}}{ } & \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedleft 536 } & \multicolumn{5}{|p{\dimexpr 0.25\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedright ЛОВ ф.\textquotedbl{}ОЗМ\textquotedbl{} } & \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedleft 16.02 } & \multicolumn{1}{|p{\dimexpr 0.05\textwidth-2\tabcolsep-1\arrayrulewidth}|}{ \smf \raggedleft 1.4 } \\ \hline \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ } & \multicolumn{5}{|p{\dimexpr 0.25\textwidth-2\tabcolsep-1\arrayrulewidth}}{ } & \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ } & \multicolumn{1}{|p{\dimexpr 0.05\textwidth-2\tabcolsep-1\arrayrulewidth}}{ } & \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedleft 537 } & \multicolumn{5}{|p{\dimexpr 0.25\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedright ЛОВ ф.\textquotedbl{}ДЗПО УПФ\textquotedbl{} } & \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedleft 25.17 } & \multicolumn{1}{|p{\dimexpr 0.05\textwidth-2\tabcolsep-1\arrayrulewidth}|}{ \smf \raggedleft 2.2 } \\ \hline \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ } & \multicolumn{5}{|p{\dimexpr 0.25\textwidth-2\tabcolsep-1\arrayrulewidth}}{ } & \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ } & \multicolumn{1}{|p{\dimexpr 0.05\textwidth-2\tabcolsep-1\arrayrulewidth}}{ } & \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedleft 540 } & \multicolumn{5}{|p{\dimexpr 0.25\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedright Здравно осигуряване } & \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedleft 36.61 } & \multicolumn{1}{|p{\dimexpr 0.05\textwidth-2\tabcolsep-1\arrayrulewidth}|}{ \smf \raggedleft 3.2 } \\ \hline \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ } & \multicolumn{5}{|p{\dimexpr 0.25\textwidth-2\tabcolsep-1\arrayrulewidth}}{ } & \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ } & \multicolumn{1}{|p{\dimexpr 0.05\textwidth-2\tabcolsep-1\arrayrulewidth}}{ } & \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedleft 560 } & \multicolumn{5}{|p{\dimexpr 0.25\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedright Членски внос Подкрепа } & \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedleft 35.50 } & \multicolumn{1}{|p{\dimexpr 0.05\textwidth-2\tabcolsep-1\arrayrulewidth}|}{ \smf \raggedleft 0 } \\ \hline \multicolumn{7}{|p{\dimexpr 0.35\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedright Всичко начисления } & % row 1 bottom \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedleft 1,144.00 } & \multicolumn{1}{|p{\dimexpr 0.05\textwidth-2\tabcolsep-1\arrayrulewidth}}{ } & \multicolumn{7}{|p{\dimexpr 0.35\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf Всичко удръжки } & \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedleft 1,144.00 } & \multicolumn{1}{|p{\dimexpr 0.05\textwidth-2\tabcolsep-1\arrayrulewidth}|}{ } \\ \hline \multicolumn{7}{|p{\dimexpr 0.35\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedright Осигурителен доход } & % row 2 bottom \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedleft 1,144.00 } & \multicolumn{1}{|p{\dimexpr 0.05\textwidth-2\tabcolsep-1\arrayrulewidth}}{ } & \multicolumn{7}{|p{\dimexpr 0.35\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf Всичко за осигуреното лице } & \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedleft 157.66 } & \multicolumn{1}{|p{\dimexpr 0.05\textwidth-2\tabcolsep-1\arrayrulewidth}|}{ } \\ \hline \multicolumn{7}{|p{\dimexpr 0.35\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedright Облагаем доход } & % row 3 bottom \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedleft 1,144.00 } & \multicolumn{1}{|p{\dimexpr 0.05\textwidth-2\tabcolsep-1\arrayrulewidth}}{ } & \multicolumn{7}{|p{\dimexpr 0.35\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf Всичко за осигурителя } & \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedleft 224.44 } & \multicolumn{1}{|p{\dimexpr 0.05\textwidth-2\tabcolsep-1\arrayrulewidth}|}{ } \\ \hline \multicolumn{7}{|p{\dimexpr 0.35\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedright Данъчна основа } & % row 4 bottom \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedleft 986.34 } & \multicolumn{1}{|p{\dimexpr 0.05\textwidth-2\tabcolsep-1\arrayrulewidth}}{ } & \multicolumn{7}{|p{\dimexpr 0.35\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf Сума за получаване } & \multicolumn{2}{|p{\dimexpr 0.1\textwidth-2\tabcolsep-1\arrayrulewidth}}{ \smf \raggedleft 887.71 } & \multicolumn{1}{|p{\dimexpr 0.05\textwidth-2\tabcolsep-1\arrayrulewidth}|}{ } \\ \hline \end{longtable} \end{document}
This time I get a lot of Overfull \hbox and Underfull \vbox . The result is almost identical with the first image. Is there anything I could do to optimise the code? Maybe I am missing something in the calculations ? A different approach is also welcomed (which produces the same result).
