[Tex/LaTex] Variable description table

longtabletables

I want to create a table with variable description. First, I the table shown below has really small font and text is not wrapped. And second, I need to let the table continue in the next page. How can I fix these problems?

enter image description here

\begin{table}[!htbp] 
\fontsize{11}{9}\selectfont 
  \caption{Description of Variables used in this Study} 
 \label{table: vardescription}
\begin{center}
\begin{tabular}{ l | p{13cm} }
 \hline \hline

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


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


\textbf{importsgr} & Imports 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.  

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




\toprule
\end{tabular}
\end{center}

\end{table}

Best Answer

Here are two different examples of your table using xltabular to enable page breaking and to make sure the table fits into the textwidth:

enter image description here

\documentclass{article}

\usepackage{xltabular}
\usepackage{booktabs}
\begin{document}


\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 
\endfirsthead
 \hline \hline

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

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


\textbf{importsgr} & Imports 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.  

\begin{equation}
gr\_tot_{i,t} = (\frac{tot_{i,t}- tot_{i,t-1}}{tot_{i,t-1}})100
\end{equation}
\\ \hline 
\textbf{exportsgr} & Exports of goods and services (annual \% growth) retrieved from World Bank. \\ \hline 


\textbf{importsgr} & Imports 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.  

\begin{equation}
gr\_tot_{i,t} = (\frac{tot_{i,t}- tot_{i,t-1}}{tot_{i,t-1}})100
\end{equation}
\\ \hline 
\textbf{exportsgr} & Exports of goods and services (annual \% growth) retrieved from World Bank. \\ \hline 


\textbf{importsgr} & Imports 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.  

\begin{equation}
gr\_tot_{i,t} = (\frac{tot_{i,t}- tot_{i,t-1}}{tot_{i,t-1}})100
\end{equation}
\\ \hline 
\textbf{exportsgr} & Exports of goods and services (annual \% growth) retrieved from World Bank. \\ \hline 


\textbf{importsgr} & Imports 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.  

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

\end{xltabular}


\newpage

\begin{xltabular}{\linewidth}{ l  X }
  \caption{Description of Variables used in this Study} 
 \label{table: vardescription}\\
\toprule
 Code & Definition and source  \\
\midrule
\endfirsthead
\toprule
 Code & Definition and source  \\
\midrule
\endhead
\bottomrule
\endfoot

exportsgr & Exports of goods and services (annual \% growth) retrieved from World Bank. \\ \addlinespace 


importsgr & Imports of goods and services (annual \% growth) retrieved from World Bank.\\   \addlinespace


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.  

\begin{equation}
gr\_tot_{i,t} = (\frac{tot_{i,t}- tot_{i,t-1}}{tot_{i,t-1}})100
\end{equation}
\\  \addlinespace

exportsgr & Exports of goods and services (annual \% growth) retrieved from World Bank. \\  \addlinespace


importsgr & Imports of goods and services (annual \% growth) retrieved from World Bank.\\ \addlinespace 


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.  

\begin{equation}
gr\_tot_{i,t} = (\frac{tot_{i,t}- tot_{i,t-1}}{tot_{i,t-1}})100
\end{equation}
\\  \addlinespace

exportsgr & Exports of goods and services (annual \% growth) retrieved from World Bank. \\ \addlinespace 


importsgr & Imports of goods and services (annual \% growth) retrieved from World Bank.\\  \addlinespace


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.  

\begin{equation}
gr\_tot_{i,t} = (\frac{tot_{i,t}- tot_{i,t-1}}{tot_{i,t-1}})100
\end{equation}
\\  

exportsgr & Exports of goods and services (annual \% growth) retrieved from World Bank. \\  \addlinespace


importsgr & Imports of goods and services (annual \% growth) retrieved from World Bank.\\  \addlinespace


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.  

\begin{equation}
gr\_tot_{i,t} = (\frac{tot_{i,t}- tot_{i,t-1}}{tot_{i,t-1}})100
\end{equation}
\\  

\end{xltabular}


\end{document}
Related Question