## LaTeX forum ⇒ General ⇒ ! TeX capacity exceeded, sorry [semantic nest size=500].

LaTeX specific issues not fitting into one of the other forums of this category.
Chris Jones XL
Posts: 2
Joined: Fri Feb 01, 2019 1:43 am

### ! TeX capacity exceeded, sorry [semantic nest size=500].

Compiling a fairly large document with xelatex gives this error message followed by 'no pages of output'.

I have some tabular data in a footnote invoked from a cell in a table in the document's text.

I eventually managed to isolate the problem and am now able to provide a one-page non-working document as well as a version that does not incur the error.

This works:

\documentclass[10pt]{book}\usepackage{longtable}\setlength{\tabcolsep}{1.75pt} \begin{document} \chapter*{\centering Lièvre farci.} \begin{longtable}{rrrl}    750 & grammes & de & foie gras d'oie de Strasbourg ou de Nancy,                                       \\     500 & grammes & de & foies de volaille et de gibier,                                                  \\     500 & grammes & de & lard frais,                                                                      \\     250 & grammes & de & champignons de couche,                                                           \\      30 & grammes & de & beurre,                                                                          \\      30 & grammes & de & cognac,                                                                          \\      20 & grammes & d' & échalotes,                                                                       \\      15 & grammes & de & farine,                                                                          \\       3 &  litres & de & gelée de veau et de volaille,                                                    \\         &         &  1 & beau lièvre jeune et tendre,                                                     \\         &         &    & marinade, p. 660, ou p. 669,                                                     \\         &         &    & madère,                                                                          \\         &         &    & porto                                                                            \\        &         &    & mélange d'épices\footnote{Par exemple :                            \\                                           \begin{tabular}{ p{16em} l r l l }                                         & Clous de girofle \dotfill  &  27,50 & pour & 100, \\                                        & Muscade          \dotfill  &  27,50 & pour & 100, \\                                        & Thym             \dotfill  &  10,00 & pour & 100, \\                                        & Laurier          \dotfill  &  10,00 & pour & 100, \\                                        & Poivre blanc     \dotfill  &  10,00 & pour & 100, \\                                        & Marjolaine       \dotfill  &   5,00 & pour & 100, \\                                        & Romarin          \dotfill  &   5,00 & pour & 100, \\                                        & Cayenne          \dotfill  &   5,00 & pour & 100, \\                                         \end{tabular}},                                                  \\\end{longtable} \end{document}

This does not work:

\documentclass[10pt]{book}\usepackage{longtable}\setlength{\tabcolsep}{1.75pt} \begin{document} \chapter*{\centering Lièvre farci.} \begin{longtable}{rrrp{16em}}                                                        750 & grammes & de & foie gras d'oie de Strasbourg ou de Nancy,                                       \\     500 & grammes & de & foies de volaille et de gibier,                                                  \\     500 & grammes & de & lard frais,                                                                      \\     250 & grammes & de & champignons de couche,                                                           \\      30 & grammes & de & beurre,                                                                          \\      30 & grammes & de & cognac,                                                                          \\      20 & grammes & d' & échalotes,                                                                       \\      15 & grammes & de & farine,                                                                          \\       3 &  litres & de & gelée de veau et de volaille,                                                    \\         &         &  1 & beau lièvre jeune et tendre,                                                     \\         &         &    & marinade, p. 660, ou p. 669,                                                     \\         &         &    & madère,                                                                          \\         &         &    & porto                                                                            \\        &         &    & mélange d'épices\footnote{Par exemple :                            \\                                           \begin{tabular}{ p{16em} l r l l }                                         & Clous de girofle \dotfill  &  27,50 & pour & 100, \\                                        & Muscade          \dotfill  &  27,50 & pour & 100, \\                                        & Thym             \dotfill  &  10,00 & pour & 100, \\                                        & Laurier          \dotfill  &  10,00 & pour & 100, \\                                        & Poivre blanc     \dotfill  &  10,00 & pour & 100, \\                                        & Marjolaine       \dotfill  &   5,00 & pour & 100, \\                                        & Romarin          \dotfill  &   5,00 & pour & 100, \\                                        & Cayenne          \dotfill  &   5,00 & pour & 100, \\                                         \end{tabular}},                                                  \\\end{longtable} \end{document}

The only difference between the two versions seems to be the layout of the table that invokes the footnote:

The version that fails has:

\begin{longtable}{rrrp{16em}}

… where the version that compiles succesfully has

\begin{longtable}{rrrl}

I may be able to get over this difficulty and get on with my life but I thought I might as well ask for an explanation and understand what I am doing wrong.

Especially since I have hundreds of similar "longtable" definitions and would prefer to have all their columns aligned when they happen to live on the same page.

Thanks,

CJ

PS. I see in the preview of this post that the '\\''s (next line) on the right of the code samples are not visible. Hopefully this will right itself when actualy post (?). All apologies if not - I have never used this forum before and will post amended versions of the two versions (after testing them) if it does not.

rais
Posts: 243
Joined: Sun Nov 16, 2014 8:51 pm
Welcome to the LaTeX Community

Looks like the p-columns cannot be nested this way.
Since you seem to misuse the p-column of the footnote's tabular for horizontal spacing, you might want to try
\documentclass[10pt]{book}\usepackage{longtable}\setlength{\tabcolsep}{1.75pt} \begin{document} \chapter*{\centering Lièvre farci.} \begin{longtable}{rrrp{16em}}    750 & grammes & de & foie gras d'oie de Strasbourg ou de Nancy,\\    500 & grammes & de & foies de volaille et de gibier,\\    500 & grammes & de & lard frais,\\    250 & grammes & de & champignons de couche,\\     30 & grammes & de & beurre,\\     30 & grammes & de & cognac,\\     20 & grammes & d' & échalotes,\\     15 & grammes & de & farine,\\      3 &  litres & de & gelée de veau et de volaille,\\        &         &  1 & beau lièvre jeune et tendre,\\        &         &    & marinade, p. 660, ou p. 669,\\        &         &    & madère,\\        &         &    & porto\\        &         &    & mélange d'épices\footnote{Par exemple :\\                               \hspace*{16em}%                               \begin{tabular}{l r l l }                                    Clous de girofle \dotfill  &  27,50 & pour & 100,\\                                   Muscade          \dotfill  &  27,50 & pour & 100,\\                                   Thym             \dotfill  &  10,00 & pour & 100,\\                                   Laurier          \dotfill  &  10,00 & pour & 100,\\                                   Poivre blanc     \dotfill  &  10,00 & pour & 100,\\                                   Marjolaine       \dotfill  &   5,00 & pour & 100,\\                                   Romarin          \dotfill  &   5,00 & pour & 100,\\                                   Cayenne          \dotfill  &   5,00 & pour & 100,\\                               \end{tabular}},\\\end{longtable} \end{document}

And yes, the \\ were there (just shifted out to the right).

KR
Rainer

Chris Jones XL
Posts: 2
Joined: Fri Feb 01, 2019 1:43 am
The workaround that I found by accident while trying to put together a (non) MWE is good enough where I'm concerned… even though the look of the table is messed up if I don't specify a length in the defininition of the first column of the 'footnote table': it automatically takes the width of the longest literal string… 'Clous de girofle' IIRC… and leaves no space for the dotfill in the first line of the table.

I hesitated to post my question and then I thought I might as well do. Now at least this peculiarity that appears to affect all table-oriented packages (?) is documented.

Not sure why you would call my resorting to the p{length} column definition specified in the packages documentation… "misuse". Is this behavior documented anywhere? Unless I misunderstood your reply to my post I would have rather qualified it by the word "bug"...!

I am entirely new to latex and I have no idea how you folks are organized… but should I report this anywhere so a developer gets a chance to look into it … and perhaps provide some form of explanation - i.e. what's happening under the covers.. and what do they recommend to work around this limitation?

Thanks,

CJ

rais
Posts: 243
Joined: Sun Nov 16, 2014 8:51 pm
Chris Jones XL wrote:I hesitated to post my question and then I thought I might as well do. Now at least this peculiarity that appears to affect all table-oriented packages (?) is documented.

Yes, good thing you did.
I wouldn't put it as all table-oriented packages' are affected by it, though: the default (for tabular) is to disallow footnotes in them (they're basically ignored).
Chris Jones XL wrote:Not sure why you would call my resorting to the p{length} column definition specified in the packages documentation… "misuse".

I didn't.
The p-column's purpose is the line breaking of text (within its cells). I did not see any text in any of the cells of that p-column in the tabular environment within the footnote you posted, hence the misuse'.
Chris Jones XL wrote: Is this behavior documented anywhere? Unless I misunderstood your reply to my post I would have rather qualified it by the word "bug"...!

Let me put it this way: If a tabular (containing---or starting with?---a p column) within a footnote within a longtable's p-column is a valid construct, then yes, this qualifies as a bug.
I am curious, though: Which part of which documentation gave you the idea that a tabular within a footnote is supposed to work? (and I'm not saying it shouldn't, just wondering)
Chris Jones XL wrote:I am entirely new to latex and I have no idea how you folks are organized… but should I report this anywhere so a developer gets a chance to look into it … and perhaps provide some form of explanation - i.e. what's happening under the covers.. and what do they recommend to work around this limitation?

The longtable's documentation tells you where to report related bugs on its first page.

I gave you a workaround that doesn't need the p-column in the tabular within the footnote.
I could think of another one, putting the tabular into a box before putting it into a footnote, but I did not see any reason to do that for a tabular that only uses its first column as a spacer;-)

KR
Rainer