1

I'm quite new to latex so I don't know perfectly how to fix this. I am trying to display a 86x2 table. Because it is very long and the first column is very wide, from searches I found that the only solution is a mix of tabularx and longtable; this mix is the result of the package ltxtable.

I have a main file, with all the imports of packages, a separate tex file for the "chapter 1" and another file for the table.

My files are organized like this:

main.tex
chapters(folder) containing Chapter1.tex and table.tex 

Here's the main.tex:

\documentclass[a4paper,12pt,openright,twoside]{book}

...

\usepackage{tabularx}
\usepackage{longtable}
\usepackage{ltxtable}

...

\begin{document}

...

\tableofcontents
\listoffigures
\input chapters/Chapter1
\end{document}

This is the Chapter1.tex:

\chapter{Chapter 1}\label{Cap1}
\section{Introduction}
...
\LTXtable{\textwidth}{table.tex}

And this is the table.tex:

\begin{longtable}[c]{|l|l|}
    \hline
    'Achrome\_di\_salmone\_insalata\_verde\_e\_salsa\_al\_dragoncello'                                        & 90  \\ \hline
    'Agnello\_alle\_melanzane\_'                                                                              & 1   \\ \hline
    'Anelli\_di\_ricotta\_e\_spinaci\_'                                                                       & 68  \\ \hline
    'Astice\_alle\_verze'                                                                                     & 8   \\ \hline
    'Astice\_e\_melone'                                                                                       & 12  \\ \hline
    'Astice\_in\_salsa\_dastice'                                                                              & 65  \\ \hline
    'Baccal\_mantecato\_polenta\_arrostita'                                                                   & 109 \\ \hline
    'Branzino\_arrosto\_la\_sua\_bottarga\_e\_involtino\_di\_biete'                                           & 35  \\ \hline
    'Branzino\_arrosto\_spaghetti\_di\_zucchine'                                                              & 10  \\ \hline
    'Cannelloni\_di\_mare\_salsa\_di\_crostacei\_e\_nero\_di\_seppia'                                         & 16  \\ \hline
    'Capesante\_puntarelle\_e\_tartufo\_nero'                                                                 & 38  \\ \hline
    'Capesante\_scottate\_puntarelle\_e\_salsa\_dalici'                                                       & 18  \\ \hline
    'Carciofi\_alla\_romana'                                                                                  & 29  \\ \hline
    'Carne\_pesce\_'                                                                                          & 46  \\ \hline
    'Cialde\_di\_ovis\_mollis\_fichi\_e\_crema\_al\_limone'                                                   & 1   \\ \hline
    'Cialde\_di\_ovis\_mollis\_marrons\_glaces\_e\_mousse\_al\_mascarpone'                                    & 2   \\ \hline
    'Cialde\_di\_ovis\_mollis\_mousse\_al\_mascarpone\_frutti\_rossi'                                         & 38  \\ \hline
    'Controfiletto\_di\_manzo\_gratinato\_alle\_erbe\_verdure\_di\_stagione'                                  & 51  \\ \hline
    'Costoletta\_di\_vitello\_alla\_milanese\_secondo\_Gualtiero\_Marchesi\_piccola\_insalata'                & 81  \\ \hline
    'Costolette\_di\_agnello\_al\_timo\_melanzane\_alla\_menta'                                               & 5   \\ \hline
    'Costolette\_di\_agnello\_arrosto\_tartufo\_nero\_e\_porri\_fondenti'                                     & 9   \\ \hline
    'Crema\_di\_zucca\_e\_zenzero'                                                                            & 9   \\ \hline
    'Croccante\_di\_mandorle\_al\_gorgonzola\_naturale'                                                       & 2   \\ \hline
    'Da\_Kiev\_a\_Kiev\_Petto\_di\_pollo\_alla\_Kiev\_secondo\_Gualtiero\_Marchesi'                           & 22  \\ \hline
    'Dadolata\_di\_salmone\_con\_le\_sue\_uova\_asparagi\_verdi\_salsa\_allo\_yogurt'                         & 47  \\ \hline
    'Dripping\_di\_pesce'                                                                                     & 25  \\ \hline
    'Filetto\_di\_manzo\_alla\_tartara'                                                                       & 80  \\ \hline
    'Filetto\_di\_ombrina\_arrosto\_verdure\_croccanti\_e\_salsa\_alle\_erbe'                                 & 66  \\ \hline
    'Filetto\_di\_orata\_arrosto\_prosciutto\_croccante'                                                      & 0   \\ \hline
    'Filetto\_di\_vitello\_alla\_Rossini\_secondo\_Gualtiero\_Marchesi'                                       & 64  \\ \hline
    'Fondente\_al\_cioccolato\_salsa\_ai\_frutti\_rossi'                                                      & 1   \\ \hline
    'Fritto\_di\_code\_di\_scampi\_gamberi\_e\_verdure\_Salsa\_agrodolce\_allo\_zenzero'                      & 111 \\ \hline
    'Goulash\_di\_tonno'                                                                                      & 30  \\ \hline
    'Grande\_antipasto\_di\_pesce'                                                                            & 44  \\ \hline
    'Guancetta\_di\_vitello\_al\_vapore\_salsa\_verde\_e\_piccole\_verdure'                                   & 2   \\ \hline
    'Insalata\_dastice\_asparagi\_al\_vapore\_e\_tartufo\_nero'                                               & 0   \\ \hline
    'Insalata\_di\_capesante\_zenzero\_e\_pepe\_rosa'                                                         & 184 \\ \hline
    'Insalata\_di\_carne\_cruda\_e\_tartufo\_nero'                                                            & 35  \\ \hline
    'Insalata\_di\_carne\_cruda\_sedani\_croccanti\_e\_olive'                                                 & 20  \\ \hline
    'Insalata\_di\_spaghetti\_al\_caviale\_erba\_cipollina'                                                   & 10  \\ \hline
    'Insalata\_di\_spaghetti\_e\_granciporro\_'                                                               & 9   \\ \hline
    'La\_caprese\_del\_Marchesino'                                                                            & 64  \\ \hline
    'Maialino\_da\_latte\_croccante\_biete\_al\_sesamo'                                                       & 20  \\ \hline
    'Meringata'                                                                                               & 3   \\ \hline
    'Merluzzo\_sfogliato\_al\_vapore\_puntarelle\_e\_pane\_nero\_croccante'                                   & 29  \\ \hline
    'Merluzzo\_sfogliato\_verdure\_alla\_russa'                                                               & 6   \\ \hline
    'Millefoglie\_ai\_marrons\_glacs'                                                                         & 16  \\ \hline
    'Minextra'                                                                                                & 6   \\ \hline
    'Nocette\_dagnello\_al\_forno\_melanzane\_alla\_menta'                                                    & 20  \\ \hline
    'Ossobuco\_in\_gremolata\_alla\_milanese'                                                                 & 87  \\ \hline
    'Penne\_asparagi\_e\_tartufi'                                                                             & 12  \\ \hline
    'Petti\_e\_cosce\_di\_quaglia\_glassate\_miele\_e\_zenzero'                                               & 0   \\ \hline
    'Petto\_danatra\_al\_pepe\_verde\_con\_i\_suoi\_ravioli'                                                  & 34  \\ \hline
    'Piccata\_di\_vitello\_al\_prosciutto\_piccola\_insalata'                                                 & 70  \\ \hline
    'Piramide\_di\_riso\_venere\_e\_code\_di\_gambero'                                                        & 10  \\ \hline
    'Ravioli\_di\_broccoli'                                                                                   & 7   \\ \hline
    'Raviolo\_aperto'                                                                                         & 48  \\ \hline
    'Riso\_mantecato\_al\_succo\_di\_barbabietola\_fonduta\_leggera\_al\_parmigiano'                          & 13  \\ \hline
    'Riso\_oro\_e\_zafferano'                                                                                 & 113 \\ \hline
    'Risotto\_allo\_zafferano'                                                                                & 11  \\ \hline
    'Rombo\_ai\_funghi\_porcini'                                                                              & 4   \\ \hline
    'Rombo\_arrosto\_patate\_e\_carciofi'                                                                     & 20  \\ \hline
    'Sacher\_\_Marchesi'                                                                                      & 75  \\ \hline
    'Salmone\_marinato\_allaneto\_salsa\_dolceforte\_alle\_pere'                                              & 71  \\ \hline
    'Scaloppa\_di\_salmone\_lattuga\_e\_salsa\_al\_vino\_rosso'                                               & 1   \\ \hline
    'Selezione\_di\_formaggi'                                                                                 & 7   \\ \hline
    'Semifreddo\_allo\_yogurt\_frutti\_rossi'                                                                 & 13  \\ \hline
    'Sformato\_di\_panettone'                                                                                 & 27  \\ \hline
    'Sorbetto\_alla\_Bellini'                                                                                 & 1   \\ \hline
    'Spaghetti\_integrali\_freddi\_code\_di\_gamberi\_e\_salsa\_di\_soia'                                     & 11  \\ \hline
    'Spaghetti\_integrali\_germogli\_di\_soia\_sesamo\_e\_code\_di\_gamberi\_scottate'                        & 1   \\ \hline
    'Tartara\_di\_manzo\_misticanza\_di\_germogli\_chips\_di\_patata'                                         & 0   \\ \hline
    'Tartara\_di\_manzo\_pane\_alle\_spezie'                                                                  & 22  \\ \hline
    'Tiramis'                                                                                                 & 2   \\ \hline
    'Tortelli\_di\_melanzana\_mandorle\_tostate\_'                                                            & 5   \\ \hline
    'Tortelli\_di\_zucca\_'                                                                                   & 13  \\ \hline
    'Trancio\_di\_branzino\_alla\_mediterranea'                                                               & 8   \\ \hline
    'Trancio\_di\_branzino\_arrosto\_carciofi\_alla\_menta'                                                   & 28  \\ \hline
    'Trancio\_di\_branzino\_arrosto\_piccole\_verdure\_salsa\_alle\_erbe'                                     & 3   \\ \hline
    'Trancio\_di\_branzino\_ratatouille\_di\_verdure'                                                         & 2   \\ \hline
    'Trancio\_di\_merluzzo\_al\_forno\_bietoline\_e\_limone\_candito\_'                                       & 9   \\ \hline
    'Tre\_gusti\_per\_un\_dolce'                                                                              & 27  \\ \hline
    'Vitello\_tonnato'                                                                                        & 41  \\ \hline
    'Zabaione\_allo\_zafferano\_sorbetto\_al\_cioccolato'                                                     & 0   \\ \hline
    'Zabaione\_freddo\_al\_Marsala\_spaghetti\_di\_riso\_fritti'                                              & 26  \\ \hline
    '\_Il\_Rosso\_e\_il\_Nero\_\_\_Coda\_di\_rospo\_al\_nero\_di\_seppia\_su\_letto\_di\_salsa\_di\_gazpacho' & 27  \\ \hline
    'others'                                                                                                  & 19  \\ \hline
\end{longtable}

However when I compile with TexStudio i get an error on the \LTXtable command row: Emergency stop. \LTXtable{\linewidth}{table.tex} Along with other four warnings regarding \hbox and \headheight, but those I suppose I will fix after this.

What am I missing to use ltxtable?

3
  • Your longtable has only one cell. There are no line breaks and no & in it. Also it doesn't use the X columntype. Commented Sep 18, 2018 at 10:28
  • If you scroll to the right you can see I use the // and the & for separating cells. I have seen the X columntype but how should I use it? @UlrikeFischer
    – Automatik
    Commented Sep 18, 2018 at 10:36
  • Ah. Sorry, I didn't seen this. As Herbert wrote: lxttable doesn't make much sense here. Commented Sep 18, 2018 at 10:50

1 Answer 1

1

Use package xltabular instead. However, it makes no real sense to use a X column because entries in that column can all not be broken into lines. Do you really need the underscore \_??

\documentclass[a4paper,12pt,openright,twoside]{book}
\usepackage{geometry}
\usepackage{xltabular}
\begin{document}

\footnotesize   
\begin{xltabular}{\linewidth}{|X|r|}\hline
    'Achrome\_di\_salmone\_insalata\_verde\_e\_salsa\_al\_dragoncello'                              
              & 90  \\ \hline
    'Agnello\_alle\_melanzane\_'                                                                    
              & 1   \\ \hline
    'Anelli\_di\_ricotta\_e\_spinaci\_'                                                             
              & 68  \\ \hline
    'Astice\_alle\_verze'                                                                           
              & 8   \\ \hline
    'Astice\_e\_melone'                                                                             
              & 12  \\ \hline
    'Astice\_in\_salsa\_dastice'                                                                    
              & 65  \\ \hline
    'Baccal\_mantecato\_polenta\_arrostita'                                                         
              & 109 \\ \hline
    'Branzino\_arrosto\_la\_sua\_bottarga\_e\_involtino\_di\_biete'                                 
              & 35  \\ \hline
    'Branzino\_arrosto\_spaghetti\_di\_zucchine'                                                    
              & 10  \\ \hline
    'Cannelloni\_di\_mare\_salsa\_di\_crostacei\_e\_nero\_di\_seppia'                               
              & 16  \\ \hline
    'Capesante\_puntarelle\_e\_tartufo\_nero'                                                       
              & 38  \\ \hline
    'Capesante\_scottate\_puntarelle\_e\_salsa\_dalici'                                             
              & 18  \\ \hline
    'Carciofi\_alla\_romana'                                                                        
              & 29  \\ \hline
    'Carne\_pesce\_'                                                                                
              & 46  \\ \hline
    'Cialde\_di\_ovis\_mollis\_fichi\_e\_crema\_al\_limone'                                         
              & 1   \\ \hline
    'Cialde\_di\_ovis\_mollis\_marrons\_glaces\_e\_mousse\_al\_mascarpone'                          
              & 2   \\ \hline
    'Cialde\_di\_ovis\_mollis\_mousse\_al\_mascarpone\_frutti\_rossi'                               
              & 38  \\ \hline
    'Controfiletto\_di\_manzo\_gratinato\_alle\_erbe\_verdure\_di\_stagione'                        
              & 51  \\ \hline
    'Costoletta\_di\_vitello\_alla\_milanese\_secondo\_Gualtiero\_Marchesi\_piccola\_insalata'      
              & 81  \\ \hline
    'Costolette\_di\_agnello\_al\_timo\_melanzane\_alla\_menta'                                     
              & 5   \\ \hline
    'Costolette\_di\_agnello\_arrosto\_tartufo\_nero\_e\_porri\_fondenti'                           
              & 9   \\ \hline
    'Crema\_di\_zucca\_e\_zenzero'                                                                  
              & 9   \\ \hline
    'Croccante\_di\_mandorle\_al\_gorgonzola\_naturale'                                             
              & 2   \\ \hline
    'Da\_Kiev\_a\_Kiev\_Petto\_di\_pollo\_alla\_Kiev\_secondo\_Gualtiero\_Marchesi'                 
              & 22  \\ \hline
    'Dadolata\_di\_salmone\_con\_le\_sue\_uova\_asparagi\_verdi\_salsa\_allo\_yogurt'               
              & 47  \\ \hline
    'Dripping\_di\_pesce'                                                                           
              & 25  \\ \hline
    'Filetto\_di\_manzo\_alla\_tartara'                                                             
              & 80  \\ \hline
    'Filetto\_di\_ombrina\_arrosto\_verdure\_croccanti\_e\_salsa\_alle\_erbe'                       
              & 66  \\ \hline
    'Filetto\_di\_orata\_arrosto\_prosciutto\_croccante'                                            
              & 0   \\ \hline
    'Filetto\_di\_vitello\_alla\_Rossini\_secondo\_Gualtiero\_Marchesi'                             
              & 64  \\ \hline
    'Fondente\_al\_cioccolato\_salsa\_ai\_frutti\_rossi'                                            
              & 1   \\ \hline
    'Fritto\_di\_code\_di\_scampi\_gamberi\_e\_verdure\_Salsa\_agrodolce\_allo\_zenzero'            
              & 111 \\ \hline
    'Goulash\_di\_tonno'                                                                            
              & 30  \\ \hline
    'Grande\_antipasto\_di\_pesce'                                                                  
              & 44  \\ \hline
    'Guancetta\_di\_vitello\_al\_vapore\_salsa\_verde\_e\_piccole\_verdure'                         
              & 2   \\ \hline
    'Insalata\_dastice\_asparagi\_al\_vapore\_e\_tartufo\_nero'                                     
              & 0   \\ \hline
    'Insalata\_di\_capesante\_zenzero\_e\_pepe\_rosa'                                               
              & 184 \\ \hline
    'Insalata\_di\_carne\_cruda\_e\_tartufo\_nero'                                                  
              & 35  \\ \hline
    'Insalata\_di\_carne\_cruda\_sedani\_croccanti\_e\_olive'                                       
              & 20  \\ \hline
    'Insalata\_di\_spaghetti\_al\_caviale\_erba\_cipollina'                                         
              & 10  \\ \hline
    'Insalata\_di\_spaghetti\_e\_granciporro\_'                                                     
              & 9   \\ \hline
    'La\_caprese\_del\_Marchesino'                                                                  
              & 64  \\ \hline
    'Maialino\_da\_latte\_croccante\_biete\_al\_sesamo'                                             
              & 20  \\ \hline
    'Meringata'                                                                                     
              & 3   \\ \hline
    'Merluzzo\_sfogliato\_al\_vapore\_puntarelle\_e\_pane\_nero\_croccante'                         
              & 29  \\ \hline
    'Merluzzo\_sfogliato\_verdure\_alla\_russa'                                                     
              & 6   \\ \hline
    'Millefoglie\_ai\_marrons\_glacs'                                                               
              & 16  \\ \hline
    'Minextra'                                                                                      
              & 6   \\ \hline
    'Nocette\_dagnello\_al\_forno\_melanzane\_alla\_menta'                                          
              & 20  \\ \hline
    'Ossobuco\_in\_gremolata\_alla\_milanese'                                                       
              & 87  \\ \hline
    'Penne\_asparagi\_e\_tartufi'                                                                   
              & 12  \\ \hline
    'Petti\_e\_cosce\_di\_quaglia\_glassate\_miele\_e\_zenzero'                                     
              & 0   \\ \hline
    'Petto\_danatra\_al\_pepe\_verde\_con\_i\_suoi\_ravioli'                                        
              & 34  \\ \hline
    'Piccata\_di\_vitello\_al\_prosciutto\_piccola\_insalata'                                       
              & 70  \\ \hline
    'Piramide\_di\_riso\_venere\_e\_code\_di\_gambero'                                              
              & 10  \\ \hline
    'Ravioli\_di\_broccoli'                                                                         
              & 7   \\ \hline
    'Raviolo\_aperto'                                                                               
              & 48  \\ \hline
    'Riso\_mantecato\_al\_succo\_di\_barbabietola\_fonduta\_leggera\_al\_parmigiano'                
              & 13  \\ \hline
    'Riso\_oro\_e\_zafferano'                                                                       
              & 113 \\ \hline
    'Risotto\_allo\_zafferano'                                                                      
              & 11  \\ \hline
    'Rombo\_ai\_funghi\_porcini'                                                                    
              & 4   \\ \hline
    'Rombo\_arrosto\_patate\_e\_carciofi'                                                           
              & 20  \\ \hline
    'Sacher\_\_Marchesi'                                                                            
              & 75  \\ \hline
    'Salmone\_marinato\_allaneto\_salsa\_dolceforte\_alle\_pere'                                    
              & 71  \\ \hline
    'Scaloppa\_di\_salmone\_lattuga\_e\_salsa\_al\_vino\_rosso'                                     
              & 1   \\ \hline
    'Selezione\_di\_formaggi'                                                                       
              & 7   \\ \hline
    'Semifreddo\_allo\_yogurt\_frutti\_rossi'                                                       
              & 13  \\ \hline
    'Sformato\_di\_panettone'                                                                       
              & 27  \\ \hline
    'Sorbetto\_alla\_Bellini'                                                                       
              & 1   \\ \hline
    'Spaghetti\_integrali\_freddi\_code\_di\_gamberi\_e\_salsa\_di\_soia'                           
              & 11  \\ \hline
    'Spaghetti\_integrali\_germogli\_di\_soia\_sesamo\_e\_code\_di\_gamberi\_scottate'              
              & 1   \\ \hline
    'Tartara\_di\_manzo\_misticanza\_di\_germogli\_chips\_di\_patata'                               
              & 0   \\ \hline
    'Tartara\_di\_manzo\_pane\_alle\_spezie'                                                        
              & 22  \\ \hline
    'Tiramis'                                                                                       
              & 2   \\ \hline
    'Tortelli\_di\_melanzana\_mandorle\_tostate\_'                                                  
              & 5   \\ \hline
    'Tortelli\_di\_zucca\_'                                                                         
              & 13  \\ \hline
    'Trancio\_di\_branzino\_alla\_mediterranea'                                                     
              & 8   \\ \hline
    'Trancio\_di\_branzino\_arrosto\_carciofi\_alla\_menta'                                         
              & 28  \\ \hline
    'Trancio\_di\_branzino\_arrosto\_piccole\_verdure\_salsa\_alle\_erbe'                           
              & 3   \\ \hline
    'Trancio\_di\_branzino\_ratatouille\_di\_verdure'                                               
              & 2   \\ \hline
    'Trancio\_di\_merluzzo\_al\_forno\_bietoline\_e\_limone\_candito\_'                             
              & 9   \\ \hline
    'Tre\_gusti\_per\_un\_dolce'                                                                    
              & 27  \\ \hline
    'Vitello\_tonnato'                                                                              
              & 41  \\ \hline
    'Zabaione\_allo\_zafferano\_sorbetto\_al\_cioccolato'                                           
              & 0   \\ \hline
    'Zabaione\_freddo\_al\_Marsala\_spaghetti\_di\_riso\_fritti'                                    
              & 26  \\ \hline
    '\_Il\_Rosso\_e\_il\_Nero\_\_\_Coda\_di\_rospo\_al\_nero\_di\_seppia\_su\_letto\_di\_salsa\_di\_gazpacho'
     & 27  \\ \hline
    'others'                                                                                        
              & 19  \\ \hline
\end{xltabular} 

\normalsize 
\end{document}

enter image description here

2
  • It worked, thank you! Is the caption still working with xtabular ?
    – Automatik
    Commented Sep 18, 2018 at 10:54
  • it behaves like longtable. See the documentation of xltabular
    – user2478
    Commented Sep 18, 2018 at 11:44

You must log in to answer this question.

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