I am facing some problems with xltabular. I have used the below commands to do a table to describe the variables used in mys study. Firstly, although I am using the command \newpage some tables are included in the middle of the xltabular. Next, the name of the table is presented in the list of figure instead of tables. I tried to include the xltabular in a table but that didn't work. Can someone tell me how can I solve this problem?

This xltabular code (P.S. the variable description is far longer than that. Below I just show one variable.):


\begin{xltabular}{\linewidth}{ l | X }
  \caption{Description of Variables used in this Study} 
 \label{table: vardescription}\\
 \hline \hline

\textbf{\normalsize Code} & \textbf{\normalsize Definition and source}  \\
 \hline \hline

\textbf{\normalsize Code} & \textbf{\normalsize Definition and source}  \\

\textbf{var2} & {blabla} \\  \hline 

\textbf{var1} & blabla\\  \hline 


and the main body is:


\usepackage[USenglish]{babel}   % language, change USenglish to german if writing in German
\usepackage{amsmath,amsfonts,amssymb,mathrsfs} % math symbols
\usepackage{graphicx}   % package for graphics
\usepackage{tabularx}   % package for tables
%\usepackage{bookmark}  % allows you to click on bookmarks in the pdf, it is commented off because it might disturb you at the beginning. Comment on to see what it can do.
\usepackage{bm}         % for bold math
\usepackage{listings}   % for inserting code
\usepackage{verbatim}   % useful for program listings
\usepackage{pdflscape}  % turning wide pages by 90°
\usepackage{color}      % package for colors
\usepackage{geometry}   % interface of your document dimensions
\usepackage[hang]{footmisc} % option hang produces hanging footnotes, see options of package
\usepackage[capposition=top]{floatrow}  % defines the position of a caption in a floating environment
\usepackage{longtable} % for long tables
\usepackage{makecell} % use for bold line \hlineB{2}
\usepackage{boldline} % use for bold line \hlineB{2}
\usepackage{rotating} % to retrun tables vertically 
\usepackage{url} %for online cite
%% Customized options

\usepackage[onehalfspacing]{setspace}   % Either double-spaced, onehalf-spaced, or single-spaced
\clubpenalty=1000                       % prevents single lines at the end of page 
\widowpenalty=1000                      % prevents single lines at the top of page 
\displaywidowpenalty=1000               % for math mode
\interfootnotelinepenalty=10000         % prevents footnotes from breaking across pages
\newcommand{\N}{{\mathbb N}}            % shortcut for natural numbers
\newcommand{\R}{{\mathbb R}}            % shortcut for real numbers

%% Other stuff
\DeclareGraphicsExtensions{.pdf,.png,.jpg} % include pictures only with these endings
\setlength{\footnotemargin}{10pt}   % defines the space of hanging footnotes

\geometry{left=2.5cm, right=2.5cm, top=2.5cm, bottom=2.5cm} %sets margins on paper itself, check again before submitting/writing if you got the right numbers here
\definecolor{darkblue}{RGB}{51, 51, 178}    % defines colour of written text
\allowdisplaybreaks % allows page breaks in align envirnonment







    \textsc{\LARGE }\\[1.5cm] 

    \textsc{\Large Thesis}\\[0.5cm] 


    {\huge\bfseries }\\[0.4cm] 


            \textsc{} % Your name
            \textsc{} % Supervisor's name






















And that gives me the following:

enter image description here

Furthermore, the next pages doesn't contain a caption (I want smoothing like: Table 5.2: continued from next page). And the strange thing is that although this is at the end of the appendix page that doesn't stay there and there two previous tables that goes after it. (I want this to be at very and of the appendix.)


I have also tried to use longtable but I can't wrap the text there and the equation are not allowed in longtable.

\begin{longtable}{ l|l }

  \hline \hline
\textbf{\normalsize Code} & \textbf{\normalsize Definition and source}  \\

 \textbf{e} & {Domestic Currency per U.S. Dollar, End of Period, Rate is retrieved from IMF.} \\  \hline 

\textbf{exportsgr} & Exports of goods and services (annual \% growth) retrieved from World Bank. \\  \hline 

\textbf{gr\_tot} & Terms of trade change over previous year (in \%).  Data for terms of trade are collected from theglobaleconomy.com  and Kaminsky and Reinhart online database. Since variables have two different base years, the base year for both was changed to 2000 to have the same base year. And then the change is calculated as below.  \\

\\   \hline 


If the following command it shows en error for the equation.

\textbf{gr\_tot} & Terms of trade change over previous year (in \%).  Data for terms of trade are collected from theglobaleconomy.com  and Kaminsky and Reinhart online database. Since variables have two different base years, the base year for both was changed to 2000 to have the same base year. And then the change is calculated as below.  \\

gr$\_tot_{i,t} = (\frac{tot_{i,t}- tot_{i,t-1}}{tot_{i,t-1}})100
\\   \hline 

Whereas when using long text it does not fit on the page like below.

enter image description here

Instead it should be something like in this photo:

enter image description here

  • Please extend your code fragment to complete small document, which reproduce your problem. In normal circumstances your problem should not happen.
    – Zarko
    Commented Jan 16, 2020 at 9:25
  • What do you mean by "extend your code fragment"?
    – Arbnor
    Commented Jan 16, 2020 at 9:36
  • 1
    @Arbnor they mean you need to edit the code in your main asked question to make a complete compilable document.
    – Diaa
    Commented Jan 16, 2020 at 10:57
  • 1
    please make a document that we can run to see the problem. You have posted a lot of code but most of it is unrelated to tables and contains \include{chapters/Literature}\include{chapters/data}\include{chapters/Analysis}\include{chapters/conclusion} and other references that we don't have. Commented Jan 16, 2020 at 13:32
  • 1
    @Arbnor: Nobody wants you to include all of your thesis here. Intead, make a copy of the document and comment out everything that is unrelated to the appendix. Recompile and see if the problem persists, if so, replace \include{chapters/appendix} with the actual contents of the file appendix.tex. Now start commenting out parts of what you just included. Recompile and see if the problem persists, If so, comment out more unitl you have the smallest possible document that still reproduces the problem. Then delete all lines that you previously commented out. ....
    – leandriis
    Commented Jan 16, 2020 at 13:51

1 Answer 1

  • With request for providing a complete small document, which reproduces your problem is meant that we need MWE (Minimal Working Example), a document which begins with \documentclass{...} and end with \end{document}. In the preamble of this document should be loaded only packages which are relevant to your problem and similarly contain only necessary definitions of the document's elements. Example of the MWE is below.
  • Many times it happens that during preparation of an MWE the problem is resolved, so the effort of constructing it is (very) worth.
  • From your code fragments I constructed the MWE (see below), with which I didn't succeed to reproduce any of your mentioned problems (note, for final document you need to compile it at least twice).
\usepackage[USenglish]{babel}           % change USenglish to german if writing in German
\usepackage{amsmath, amssymb, mathrsfs} % math stuff
\usepackage{graphicx}                   % package for graphics
\usepackage{array, booktabs, xltabular} % tables
\usepackage[skip=1ex,font={small,sf}, labelfont=bf]{caption}

%---------------- show page layout. don't use in a real document!



\chapter{Fitst chapter}
\section{first section}
\section{second section}
    \begin{xltabular}{\linewidth}{ >{\bfseries}l   X }
\caption{Description of Variables used in this Study}
\label{table: vardescription}                                  
\addtocounter{table}{-1}                                        \\
\textbf{Code} & \textbf{Definition and source}                  \\
\caption[]{Description of Variables used in this Study (Cont.)} \\
\textbf{Code} & \textbf{Definition and source}                  \\
%    \midrule
    \multicolumn{2}{r}{\footnotesize\textit{Continue on the next page}}
% table body
var1        &   \lipsum[1]  \\  \midrule
var2        &   \lipsum[2]  \\  \midrule
var3        &   \lipsum[3]  \\  \midrule
var4        &   \lipsum[4]  \\  \midrule
var5        &   \lipsum[5]  \\  \midrule
var6        &   \lipsum[6]  \\  \midrule
var7        &   \lipsum[7]  \\  
Test of referencing, see Tab.~\ref{table: vardescription} 

\section{third section}
    \caption[Figure caption text for \texttt{listoffigures}]{Figure}
Test of referencing, see Fig.~\ref{fig:figure-1} 

(result is 6 page long, so I left generating of the document to you)


  • Use of the xltabular, which is combination of longtable and tabularx make sense only if table is longer than one page, otherwise is better to use tabularx encapsulated in the float table.
  • xltabular is not intended to be enclosed into floats. It can begins anywhere on page (at point of its inserting in document).
  • Breaks of table between pages can be only between table rows, (and not in middle of them), consequently can be some empty vertical space on bottom of page.
  • in which listof... (LoF, LoT) will appear some caption is depend where caption is. Caption in float figure will appear on LoF, caption in float table in LoT. This means that caption fromxltabular` will appear in the LoT.


As you can see from test of my MWE, it not reproduce your problems, so I suggest you to extend it within step by step manner with your preamble and look, if your problems will arise. Also on the same way copy to it contents of your real document.

  • Is there any other way to create a table with data description?
    – Arbnor
    Commented Jan 16, 2020 at 20:33
  • @Arbnor, of coure. This can be done on many different ways. Depends on what you like to have/achieve. A more specific answer requires knowledge of the document and the purpose of that description. As guessing, description list may be good solution..However, I wonder, if my answer help you find what is going wrong in your document?
    – Zarko
    Commented Jan 16, 2020 at 21:03
  • Not that much Zarko. Actually the xltabular is quite ok but because it creates this problems I can't use it. I was trying to find another way to do it and this is very time consuming. I am searching for new method and hope I can find one very soon because I don't have that much time.
    – Arbnor
    Commented Jan 16, 2020 at 21:20
  • 1
    @Arbnor, sorry, but your responses don't clarify your problems nor given any information, what is wrong with suggestion you got. On such a way is not possible to help you.
    – Zarko
    Commented Jan 16, 2020 at 21:36

You must log in to answer this question.

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