I have this table:
\documentclass{scrbook} \usepackage{lipsum}% only for dummy text \usepackage{tabularray} \begin{document} \begin{table} \begin{longtblr}[]{ width = 1\textwidth, cells = {c}, cell{1}{1} = {c=12}{}, cell{2}{1} = {c=6}{}, cell{2}{7} = {c=6}{}, cell{3}{1} = {c=4}{}, cell{3}{5} = {c=4}{}, cell{3}{9} = {c=4}{}, cell{4}{1} = {c=3}{}, cell{4}{4} = {c=3}{}, cell{4}{7} = {c=3}{}, cell{4}{10} = {c=3}{}, cell{5}{1} = {c=2}{}, cell{5}{3} = {c=3}{}, cell{5}{6} = {c=2}{}, cell{5}{8} = {c=3}{}, cell{5}{11} = {c=2}{}, cell{6}{2} = {c=3}{}, cell{6}{5} = {c=2}{}, cell{6}{7} = {c=2}{}, cell{6}{9} = {c=3}{}, hlines, vlines, } 1 & & & & & & & & & & & \\ 2& & & & & & 2 & & & & & \\ 3 & & & & 3 & & & & 3 & & & \\ 4 & & & 4 & & & 4& & &4& & \\ 5 & & 5 & & & 5 & & 5 & & & 5 & \\ 6Loerm Ipsum&6 Lorem Ipsum & & & 6Lorem Ipsum& &6 Lorem Ipsum& & 6Lorem Ipsum& & &6 Lorem Ipsum \end{longtblr} \end{table} \end{document} Unfortunately, when I type text into the last column, the table expands beyond the edge of the page. Is there a way to force this table to maintain a width equal to the width of the text?
LaTeX displays: Overfull \hbox (83.53403pt too wide) detected at line 40
After some trails, is it good way?:
\documentclass{scrbook} \usepackage{tabularray} \begin{table} \begin{longtblr}[]{ rows = {rowsep=1pt}, columns = {colsep=1pt}, cells = {c}, cell{1}{1} = {c=12}{}, cell{2}{1} = {c=6}{}, cell{2}{7} = {c=6}{}, cell{3}{1} = {c=4}{}, cell{3}{5} = {c=4}{}, cell{3}{9} = {c=4}{}, cell{4}{1} = {c=3}{}, cell{4}{4} = {c=3}{}, cell{4}{7} = {c=3}{}, cell{4}{10} = {c=3}{}, cell{5}{1} = {c=2}{}, cell{5}{3} = {c=3}{}, cell{5}{6} = {c=2}{}, cell{5}{8} = {c=3}{}, cell{5}{11} = {c=2}{}, cell{6}{1} = {}{0.15\textwidth}, cell{6}{2} = {c=3}{0.15\textwidth}, cell{6}{5} = {c=2}{0.15\textwidth}, cell{6}{7} = {c=2}{0.15\textwidth}, cell{6}{9} = {c=3}{0.15\textwidth}, cell{6}{11} = {}{0.15\textwidth}, width=\textwidth, hlines, vlines, } 1 & & & & & & & & & & & \\ 2& & & & & & 2 & & & & & \\ 3 & & & & 3 & & & & 3 & & & \\ 4 & & & 4 & & & 4& & &4& & \\ 5 & & 5 & & & 5 & & 5 & & & 5 & \\ 6Loerm Ipsum&6 Lorem Ipsum & & & 6Lorem Ipsum& &6 Lorem Ipsum& & 6Lorem Ipsum& & &6 Lorem Ipsum \end{longtblr} \end{table} \end{document} 
\documentclass{...}, the required\usepackage's,\begin{document}, and\end{document}. That may seem tedious to you, but think of the extra work it represents for the users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem.tableenvironment nor the\centeringmake much sense