4

I am using Lualatex because it has the property to dynamically extend its own memory. Currently I am using longtabu like that

\setlength{\tabcolsep}{1mm}
\begin{longtabu} to \textwidth {|
p{30mm}|

p{20mm}|
p{20mm}|
p{30mm}|
p{20mm}|
p{35mm}|
p{15mm}|
p{15mm}|
p{15mm}|
p{30mm}|
p{30mm}|}
\hline\tableHeaderStyle
\raisebox{-0.7mm}[0mm][12mm]{ \thead[l]{ Папка \textnumero } } &
\raisebox{-4mm}[0mm][12mm]{ \thead[l]{ Пореден \\ \textnumero ~ на \\ документ } } &
\raisebox{-4mm}[0mm][12mm]{ \thead[l]{ Машинен \\ \textnumero \\ документ } } &
\raisebox{-0.7mm}[0mm][12mm]{ \thead[l]{ Документ \textnumero } } &
\raisebox{-2.3mm}[0mm][12mm]{ \thead[l]{ Дата на \\ документа } } &
\raisebox{-4mm}[0mm][12mm]{ \thead[l]{ Дата на \\ въвеждане \\ на документа } } &
\raisebox{-2.3mm}[0mm][12mm]{ \thead[l]{ Потре- \\ бител } } &
\raisebox{-2.3mm}[0mm][12mm]{ \thead[l]{ Тест\\ 1} } &
\raisebox{-2.3mm}[0mm][12mm]{ \thead[l]{ Тест\\ 2} } &
\raisebox{-2.3mm}[0mm][12mm]{ \thead[r]{ ~~~~~~~~~~~~~~~~~~~ Стойност \\ дебит } } &
\raisebox{-2.3mm}[0mm][12mm]{ \thead[r]{ ~~~~~~~~~~~~~~~~~~~ Стойност \\ кредит } }
\\ \hline \endhead 

Lets add 2 lines.

1 & 
5000 & 
3000 & 
2 & 
25.04.2018 & 
25.04.2018 15:21:27 & 
test & 
1 & 
 & 
\multicolumn{1}{r|}{ 1 000.00 } & 
\multicolumn{1}{r|}{  }
\\ 
\tabucline[1pt on 10pt off 3pt]{1-11}
\multicolumn{11}{|p{280mm}|}{ Забележка: Latin } \\ % sum of all column widths + some extra from cell padding
\hline

This is going to work. Its going to work also if the last two lines repeat 1000 times. But the document I am trying to generate its quite large. These two lines repeat between 10 000 and 20 000 times. And only then i receive this error :

! Missing } inserted.

Can anyone at least point me to a right direction ? Thank you.

EDIT

Here is the full code with 2 lines. I can not put 100 lines here or 10 000 times because there is limitation.

\documentclass[paper=a4,fontsize=18pt]{article}
\usepackage{geometry}
\geometry{
    % verbose,
    landscape,      % page orientation (landscape or portrait)
    a4paper,        % paper size
    tmargin=20mm,   % page top margin
    bmargin=20mm,   % page bottom margin
    lmargin=5mm,   % page left margin
    rmargin=5mm % page right maring
}

\usepackage{fontspec}
\setmainfont{Times New Roman}
\setsansfont{Arial}
%\setdefaultlanguage{bulgarian}
%\usepackage[defaultsans]{opensans} %font
%\usepackage[T1, T2A]{fontenc}
\usepackage[english,bulgarian]{babel}
\usepackage{fancyhdr}
\usepackage{multicol}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{longtable}
\usepackage{tabu}
\usepackage{colortbl}
\usepackage{xcolor}
\usepackage{makecell}
%\usepackage[lutf8x]{luainputenc}
\usepackage{tabularx}
\usepackage{tabulary}
\usepackage{array}
\usepackage{ragged2e}
\usepackage{xparse}
\usepackage{hhline}
\usepackage{textcomp}

% ============================== PAGE ==============================

\pagestyle{fancy}
\fancyhf{}
\rhead{\tcbd{
  \fontsize{8}{10}\selectfont
  25.04.2018 03:23:45
}}
\lhead{\tcbd{
  \fontsize{8}{10}\selectfont
  "Тест" ЕООД
}}
\rfoot{\tcbd{
  Стр. \thepage
}}
\lfoot{\tcbd{
  \fontsize{8}{10}\selectfont
  Тест
}}

\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}

% ============================== TABLES ==============================

\definecolor{clTableHeaderBackground}{RGB}{192,192,192}
\definecolor{clTableHeaderText}{RGB}{0,0,0}
\newcommand{\mc}[2]{\multicolumn{ #1 }{c}{ #2 }}    % snippet for multicolumn

% Table Header Style
\newcommand{\tableHeaderStyle}{
    \rowfont{\color{clTableHeaderText}\bfseries}
    \rowcolor{clTableHeaderBackground}
}
\tabulinesep =_0.5mm^1mm     % table cell vertical padding (top and bottom)
\arrayrulewidth=0.8pt         % line width

% ============================== OTHER ==============================

\renewcommand{\familydefault}{\sfdefault}

\newcommand{\resetFont}{
    \fontsize{9}{12}\selectfont
}

\newenvironment{nscenter}
 {\parskip=0pt\par\nopagebreak\centering}
 {\par\noindent\ignorespacesafterend}

%define "Twig Curly Braces Divider"
\newcommand{\tcbd}{}

%define Wrap

\ExplSyntaxOn
\NewDocumentCommand{\separator}{ }
 {
  \mode_if_math:TF { \allowbreak } { \- }
 }
\NewDocumentCommand{\wrap}{ m }
 {
  \mathers_wrap:n { #1 }
 }

\seq_new:N \l_mathers_input_seq
\seq_new:N \l_mathers_output_seq
\seq_new:N \l_mathers_temp_seq

\cs_new_protected:Npn \mathers_wrap:n #1
 {
  \seq_clear:N \l_mathers_output_seq
  \seq_set_split:Nnn \l_mathers_input_seq { ~ } { #1 }
  \seq_map_inline:Nn \l_mathers_input_seq
   {
    \seq_set_split:Nnn \l_mathers_temp_seq { } { ##1 }
    \seq_put_right:Nx \l_mathers_output_seq
     { \seq_use:Nn \l_mathers_temp_seq { \allowbreak } }
   }
  \seq_use:Nn \l_mathers_output_seq { ~ }
 }
\ExplSyntaxOff




\tabulinesep =_0.5mm^1mm     % table cell vertical padding (top and bottom)
\begin{document}
\fontsize{15}{13}\selectfont
\begin{nscenter}
  \textbf{Хронологичен опис на счетоводните записвания}
\end{nscenter}
\\ \vspace{-5mm}
\fontsize{12}{10}\selectfont
\begin{nscenter}
  За периода: 25.04.2018 - 25.04.2018 
\end{nscenter}
\vspace{-5mm}
\fontsize{9}{11}\selectfont
\def\arraystretch{1.4}
\setlength{\tabcolsep}{1mm}
\begin{longtabu} to \textwidth {|
p{30mm}|
p{20mm}|
p{20mm}|
p{30mm}|
p{20mm}|
p{35mm}|
p{15mm}|
p{15mm}|
p{15mm}|
p{30mm}|
p{30mm}|}
\hline\tableHeaderStyle
\raisebox{-0.7mm}[0mm][12mm]{ \thead[l]{ Папка \textnumero } } &
\raisebox{-4mm}[0mm][12mm]{ \thead[l]{ Пореден \\ \textnumero ~ на \\ документ } } &
\raisebox{-4mm}[0mm][12mm]{ \thead[l]{ Машинен \\ \textnumero \\ документ } } &
\raisebox{-0.7mm}[0mm][12mm]{ \thead[l]{ Документ \textnumero } } &
\raisebox{-2.3mm}[0mm][12mm]{ \thead[l]{ Дата на \\ документа } } &
\raisebox{-4mm}[0mm][12mm]{ \thead[l]{ Дата на \\ въвеждане \\ на документа } } &
\raisebox{-2.3mm}[0mm][12mm]{ \thead[l]{ Потре- \\ бител } } &
\raisebox{-2.3mm}[0mm][12mm]{ \thead[l]{ Сметка \\ дебит } } &
\raisebox{-2.3mm}[0mm][12mm]{ \thead[l]{ Сметка \\ кредит } } &
\raisebox{-2.3mm}[0mm][12mm]{ \thead[r]{ ~~~~~~~~~~~~~~~~~~~ Стойност \\ дебит } } &
\raisebox{-2.3mm}[0mm][12mm]{ \thead[r]{ ~~~~~~~~~~~~~~~~~~~ Стойност \\ кредит } }
\\ \hline \endhead 
1 & 
5000 & 
3000 & 
2 & 
25.04.2018 & 
25.04.2018 15:23:45 & 
test & 
1 & 
 & 
\multicolumn{1}{r|}{ 1 000.00 } & 
\multicolumn{1}{r|}{  }
\\ 
\tabucline[1pt on 10pt off 3pt]{1-11}
\multicolumn{11}{|p{280mm}|}{ Забележка: Latin } \\ % sum of all column widths + some extra from cell padding
\hline

\end{longtabu}
\end{document}


Minimal example (Ed.)

Here is a minimal test file

\documentclass{article}

\usepackage{longtable}
\usepackage{tabu}

\usepackage{xinttools}

\begin{document}
\begin{longtabu} to \textwidth {|c|}
\hline\endhead 
\romannumeral\xintreplicate{9999}\\
% \\ % comment this out to trigger the problem
\end{longtabu}
\end{document}

I (jfbu) tried to fiddle with the settings in texmfcnf.lua, to no effect.

edit actually the same issue arises with pdflatex, so Ed. has commented out the Emacs buffer variable which Ed. initially used.

But it is striking that it arises at exactly 10000 iterations and not at 9999.

8
  • 1
    I cannot reproduce with just snippets. Please post a minimal working example (MWE). Apr 26, 2018 at 5:53
  • I updated the post. You just need to copy paste until you get 12000 rows. Thank you for helping ! Apr 26, 2018 at 6:14
  • That's not really a minimal working example (MWE) but you deserve +1 for the effort. Apr 26, 2018 at 6:18
  • Thank you all for participating and helping. David Carlisle gave a solution. Maybe for so long tables longtable package is the right one. I dont know why longtabu is not working since is based on longtable. The problem appears and in a simple tabular. Apr 26, 2018 at 8:40
  • 1
    @jfbu no you zeroed in on it it's a tabu "feature" I'll post an answer in a bit Apr 26, 2018 at 8:44

1 Answer 1

5

You can reproduce the error with a small test file by replacing the line to be repeated by

\testlined

defined by

\def\testline{1 & 
5000 & 
3000 & 
2 & 
25.04.2018 & 
25.04.2018 15:23:45 & 
test & 
1 & 
 & 
\multicolumn{1}{r|}{ 1 000.00 } & 
\multicolumn{1}{r|}{  }
\\ 
}

\def\testlinea{\testline\testline\testline\testline\testline\testline\testline\testline\testline\testline}%10
\def\testlineb{\testlinea\testlinea\testlinea\testlinea\testlinea\testlinea\testlinea\testlinea\testlinea\testlinea}%100
\def\testlinec{\testlineb\testlineb\testlineb\testlineb\testlineb\testlineb\testlineb\testlineb\testlineb\testlineb}%1000
\def\testlined{\testlinec\testlinec\testlinec\testlinec\testlinec\testlinec\testlinec\testlinec\testlinec\testlinec}%10000

The longtable package is designed for ling tables like this (there is a clue in the name:-) so changing it to longtable outputs the table. \rowfont isn't defined in that case, here I just commented it out but you could get the same fonts by adding the font declarations to your p column specifiers.

This produces 358 pages of table

\documentclass[paper=a4,fontsize=18pt]{article}
\usepackage{geometry}
\geometry{
    % verbose,
    landscape,      % page orientation (landscape or portrait)
    a4paper,        % paper size
    tmargin=20mm,   % page top margin
    bmargin=20mm,   % page bottom margin
    lmargin=5mm,   % page left margin
    rmargin=5mm % page right maring
}

\usepackage{fontspec}
\setmainfont{Times New Roman}
\setsansfont{Arial}
%\setdefaultlanguage{bulgarian}
%\usepackage[defaultsans]{opensans} %font
%\usepackage[T1, T2A]{fontenc}
\usepackage[english,bulgarian]{babel}
\usepackage{fancyhdr}
\usepackage{multicol}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{longtable}
\usepackage{tabu}
\usepackage{colortbl}
\usepackage{xcolor}
\usepackage{makecell}
%\usepackage[lutf8x]{luainputenc}
\usepackage{tabularx}
\usepackage{tabulary}
\usepackage{array}
\usepackage{ragged2e}
\usepackage{xparse}
\usepackage{hhline}
\usepackage{textcomp}

% ============================== PAGE ==============================

\pagestyle{fancy}
\fancyhf{}
\rhead{\tcbd{
  \fontsize{8}{10}\selectfont
  25.04.2018 03:23:45
}}
\lhead{\tcbd{
  \fontsize{8}{10}\selectfont
  "Тест" ЕООД
}}
\rfoot{\tcbd{
  Стр. \thepage
}}
\lfoot{\tcbd{
  \fontsize{8}{10}\selectfont
  Тест
}}

\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}

% ============================== TABLES ==============================

\definecolor{clTableHeaderBackground}{RGB}{192,192,192}
\definecolor{clTableHeaderText}{RGB}{0,0,0}
\newcommand{\mc}[2]{\multicolumn{ #1 }{c}{ #2 }}    % snippet for multicolumn

% Table Header Style
\newcommand{\tableHeaderStyle}{
%    \rowfont{\color{clTableHeaderText}\bfseries}
%    \rowcolor{clTableHeaderBackground}
}
\tabulinesep =_0.5mm^1mm     % table cell vertical padding (top and bottom)
\arrayrulewidth=0.8pt         % line width

% ============================== OTHER ==============================

\renewcommand{\familydefault}{\sfdefault}

\newcommand{\resetFont}{
    \fontsize{9}{12}\selectfont
}

\newenvironment{nscenter}
 {\parskip=0pt\par\nopagebreak\centering}
 {\par\noindent\ignorespacesafterend}

%define "Twig Curly Braces Divider"
\newcommand{\tcbd}{}

\def\testline{1 & 
5000 & 
3000 & 
2 & 
25.04.2018 & 
25.04.2018 15:23:45 & 
test & 
1 & 
 & 
\multicolumn{1}{r|}{ 1 000.00 } & 
\multicolumn{1}{r|}{  }
\\ 
}

\def\testlinea{\testline\testline\testline\testline\testline\testline\testline\testline\testline\testline}%10
\def\testlineb{\testlinea\testlinea\testlinea\testlinea\testlinea\testlinea\testlinea\testlinea\testlinea\testlinea}%100
\def\testlinec{\testlineb\testlineb\testlineb\testlineb\testlineb\testlineb\testlineb\testlineb\testlineb\testlineb}%1000
\def\testlined{\testlinec\testlinec\testlinec\testlinec\testlinec\testlinec\testlinec\testlinec\testlinec\testlinec}%10000

%define Wrap

\ExplSyntaxOn
\NewDocumentCommand{\separator}{ }
 {
  \mode_if_math:TF { \allowbreak } { \- }
 }
\NewDocumentCommand{\wrap}{ m }
 {
  \mathers_wrap:n { #1 }
 }

\seq_new:N \l_mathers_input_seq
\seq_new:N \l_mathers_output_seq
\seq_new:N \l_mathers_temp_seq

\cs_new_protected:Npn \mathers_wrap:n #1
 {
  \seq_clear:N \l_mathers_output_seq
  \seq_set_split:Nnn \l_mathers_input_seq { ~ } { #1 }
  \seq_map_inline:Nn \l_mathers_input_seq
   {
    \seq_set_split:Nnn \l_mathers_temp_seq { } { ##1 }
    \seq_put_right:Nx \l_mathers_output_seq
     { \seq_use:Nn \l_mathers_temp_seq { \allowbreak } }
   }
  \seq_use:Nn \l_mathers_output_seq { ~ }
 }
\ExplSyntaxOff




\tabulinesep =_0.5mm^1mm     % table cell vertical padding (top and bottom)
\begin{document}
\fontsize{15}{13}\selectfont
\begin{nscenter}
  \textbf{Хронологичен опис на счетоводните записвания}
\end{nscenter}
\\ \vspace{-5mm}
\fontsize{12}{10}\selectfont
\begin{nscenter}
  За периода: 25.04.2018 - 25.04.2018 
\end{nscenter}
\vspace{-5mm}
\fontsize{9}{11}\selectfont
\def\arraystretch{1.4}
\setlength{\tabcolsep}{1mm}
\begin{longtable}{|
p{30mm}|
p{20mm}|
p{20mm}|
p{30mm}|
p{20mm}|
p{35mm}|
p{15mm}|
p{15mm}|
p{15mm}|
p{30mm}|
p{30mm}|}
\hline\tableHeaderStyle
\raisebox{-0.7mm}[0mm][12mm]{ \thead[l]{ Папка \textnumero } } &
\raisebox{-4mm}[0mm][12mm]{ \thead[l]{ Пореден \\ \textnumero ~ на \\ документ } } &
\raisebox{-4mm}[0mm][12mm]{ \thead[l]{ Машинен \\ \textnumero \\ документ } } &
\raisebox{-0.7mm}[0mm][12mm]{ \thead[l]{ Документ \textnumero } } &
\raisebox{-2.3mm}[0mm][12mm]{ \thead[l]{ Дата на \\ документа } } &
\raisebox{-4mm}[0mm][12mm]{ \thead[l]{ Дата на \\ въвеждане \\ на документа } } &
\raisebox{-2.3mm}[0mm][12mm]{ \thead[l]{ Потре- \\ бител } } &
\raisebox{-2.3mm}[0mm][12mm]{ \thead[l]{ Сметка \\ дебит } } &
\raisebox{-2.3mm}[0mm][12mm]{ \thead[l]{ Сметка \\ кредит } } &
\raisebox{-2.3mm}[0mm][12mm]{ \thead[r]{ ~~~~~~~~~~~~~~~~~~~ Стойност \\ дебит } } &
\raisebox{-2.3mm}[0mm][12mm]{ \thead[r]{ ~~~~~~~~~~~~~~~~~~~ Стойност \\ кредит } }
\\ \hline \endhead 
\testlined
\tabucline[1pt on 10pt off 3pt]{1-11}
\multicolumn{11}{|p{280mm}|}{ Забележка: Latin } \\ % sum of all column widths + some extra from cell padding
\hline

\end{longtable}
\end{document}

jfbu narrowed down the problem. longtabu actually disables longtables support for long tables, so that it can hold the entire table in memory to handle X columns, it gets away with it as machines are bigger than they were in 1990 and so the longtable chunksize is set at 10000 rather than longtables default of 20. here I make it \maxdimen (the largest integer TeX can hold)

using the smaller example that jfbu added

\documentclass{article}

\usepackage{longtable}
\usepackage{tabu}

\makeatletter
\renewcommand*\longtabu {\tabu@longtrue
   \ifmmode\PackageError{tabu}{longtabu not allowed in math mode}\fi
   \def\tabu@{\longtable}\def\endlongtabu{\endlongtable}%
   \LTchunksize=\maxdimen
   \expandafter\let\csname tabu*\endcsname \tabu
   \expandafter\def\csname endlongtabu*\endcsname{\endlongtabu}%
   \let\LT@startpbox \tabu@LT@startpbox % \everypar{ array struts }
   \tabu@spreadfalse \tabu@negcoeffalse \tabu@settarget
}% {longtabu}
\makeatother
\def\x{\\\hline}

\usepackage{xinttools}

\begin{document}
\makeatletter\errorcontextlines\maxdimen
\begin{longtabu} to \textwidth {|c|}
\hline\endhead 
\romannumeral\xintreplicate{9999}\x
\x % comment this out to trigger the problem
\end{longtabu}
\end{document}
5
  • 1
    This seems to solve the problem. This is a copy from the longtabu documentation "An environment longtabu – based on D. Carlisle longtable package". I was thinking that is designed to do the same as longtabu as you said "there is a clue in the name". Apr 26, 2018 at 8:20
  • @LubomirBorisov an omelette is based on an egg but don't try to hatch chicks from one:-) Apr 26, 2018 at 8:47
  • @DavidCarlisle oh well, I recalled this chunksize business dimly and made a search for 10000 in tabu manual but that should have been 10 000... then I was a bit exhausted from having cut down the minimal example to a minimal example ;-)
    – user4686
    Apr 26, 2018 at 8:54
  • manual says Presently, longtabu with X columns works only if \LTchunksize is greater than the number of rows. Your patch seems to suggest that there is no user interface to modify the 10000 ? well yes of course \LTchunksize=\@M is hard-coded. Thus the "feature" of tabu is only not to have provided a means to modify this at user level.
    – user4686
    Apr 26, 2018 at 8:57
  • @jfbu it didn't occur to me to look at the manual:-) Apr 26, 2018 at 10:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .