# Long Table with Long Text and Multicolumns

I want to create a long table with a long text.

The minimal working example is given below:

     \documentclass[12pt, a4paper, twoside]{article}
\usepackage{authblk}
\usepackage{titlesec}
\usepackage[T1]{fontenc}
\usepackage{times}
\usepackage[latin9]{inputenc}
\usepackage[english]{babel}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{mathptmx}
\usepackage{float}
\usepackage{url}
\usepackage[final]{graphicx}
\usepackage{natbib}
\setlength{\bibsep}{0.0pt}
%page margins
\usepackage{geometry}
\geometry{verbose,tmargin=3cm,bmargin=3cm,lmargin=3cm,rmargin=3cm }
\setlength\parindent{24pt}
%produces line numbers
\usepackage{textcomp}
\usepackage{textgreek}
\usepackage[toc,page]{appendix}
\usepackage{libertineRoman}
%line spacing
\usepackage{setspace}
\onehalfspacing
\usepackage{titlesec}
\usepackage{tabulary}
\usepackage[para]{threeparttable}
\usepackage{array,booktabs,longtable,tabularx}
\setlength{\LTcapwidth}{7in}
\usepackage[flushleft]{threeparttablex}
\usepackage{pdflscape}
\usepackage{amssymb}
\begin{document}
\section{introduction}
Introduction text is given here.
\begin{landscape}
\begin{longtable}
\caption{Structure}
\label{tab:str}\\
\toprule
& \multicolumn{2}{c}{\textbf{Main 1}} &       & \multicolumn{4}{c}{\textbf{Main 2}} &       & \multicolumn{1}{c}{\textbf{Main 3}} &       & \multicolumn{1}{c}{\textbf{Main 4}} &       & \multicolumn{1}{c}{\textbf{Main 5}} &       & \multicolumn{2}{c}{\textbf{Main 6}} &       & \multicolumn{1}{c}{\textbf{Main 7}} \\
\cmidrule{2-3}\cmidrule{5-8}\cmidrule{10-10}\cmidrule{12-12}\cmidrule{14-14}\cmidrule{16-17}\cmidrule{19-19}
& Text 1a  &       &  Text2a  & Text2b & Text2c & Text 2d &       & Text 3a &       & Text4a &       & Text5a  &       & Text 6a & Text 6b &       & Text6b \\
\multicolumn{19}{c}%
{{\bfseries \tablename\ \thetable{} -- continued from previous page}}\\
\toprule
& \multicolumn{2}{c}{\textbf{Main 1}} &       & \multicolumn{4}{c}        {\textbf{Main 2}} &       & \multicolumn{1}{c}{\textbf{Main 3}} &       & \multicolumn{1}{c}{\textbf{Main 4}} &       & \multicolumn{1}{c}{\textbf{Main 5}} &       & \multicolumn{2}{c}{\textbf{Main 6}} &       & \multicolumn{1}{c}{\textbf{Main 7}} \\
\cmidrule{2-3}\cmidrule{5-8}\cmidrule{10-10}\cmidrule{12-12}\cmidrule{14-14}\cmidrule{16-17}\cmidrule{19-19}
& Text 1a  &       &  Text2a  & Text2b & Text2c & Text 2d &       & Text 3a &       & Text4a &       & Text5a  &       & Text 6a & Text 6b &       & Text6b \\
\multicolumn{19}{r}{{Continued on next page}} \\
\endfoot
\endlastfoot
%%%%%% Main contents of Table Starts here %%%%%%%%%%%%
\multicolumn{19}{l}{\textbf{Structure }} \\
\midrule
Issuer & Licensed UCI  & Licensed UCI  &       & Specialised Credit Institution  & Specialised Credit Institution  & Specialised Credit Institution  & Specialised Credit Institution  &       & Licensed UCI  &       & UCI   &       & Licensed UCI  &       & UCI, Specialised Credit Institution  & UCI, Specialised Credit Institution  &       & UCI, Specialised Credit Institution  \\
Recourse to credit institution  & Yes, direct  & Yes, direct  &       & Yes, direct  & Yes, direct  & Yes, direct  & Yes, direct  &       & Yes, direct  &       & Yes, direct  &       & Yes, direct  &       & Yes, direct  & Yes, direct  &       & Yes, direct  \\
Owner of cover assets & Credit Institution acting as fiduciary  & Credit Institution acting as fiduciary  &       & Credit Institution, pledged to the issuer   & Credit Institution, pledged to the issuer   & The issuer directly  & Credit Institution, pledged to the issuer   &       & The issuer directly  &       & SPE which guarantees the CBs &       & SPE which guarantees the CBs &       & The issuer directly  & The issuer directly  &       & The issuer directly  \\
Issuer is originator of assets & Flexible  & Flexible  &       & No    & No    & Flexible  & No    &       & Yes   &       & Yes   &       & Flexible  &       & Yes   & Yes   &       & Yes \\
\midrule
\multicolumn{19}{l}{\textbf{Framework }} \\
\midrule
Special legilsation  & Yes   & Yes   &       & Yes   & No    & Yes   & Yes   &       & Yes   &       & Yes   &       & Yes   &       & Yes   & Yes   &       & Yes \\
Legal framework for the bankcruptcy of issuer & Special legal framework superseding general insolvency law  & Special legal framework superseding general insolvency law  &       & Special legal framework superseding general insolvency law  & General insolvency law & Special legal framework superseding general insolvency law  & Special legal framework superseding general insolvency law  &       & Special legal framework superseding general insolvency law  &       & Special legal framework superseding general insolvency law  &       & General insolvency law &       & Special legal framework superseding general insolvency law  & Special legal framework superseding general insolvency law  &       & Special legal framework superseding general insolvency law  \\
\midrule
\multicolumn{19}{l}{\textbf{Assets  }} \\
\midrule
Types of assets & Public Sector loans
Mortgage loans
Loans to credit institutions & Public Sector loans
Mortgage loans
Loans to credit institutions &       & Mortgage Loans & Mortgage Loans & Public Sector loans
Mortgage loans
Loans to credit institutions
Senior MBS & Mortgage loans
Senior MBS &       & Public Sector loans
Mortgage loans
Loans to credit institutions
Ship loans
Aircraft loans  &       & Public Sector loans
Mortgage loans
Senior MBS &       & Public Sector loans
Mortgage loans
Loans to credit institutions
Ship loans  &       & Mortgage loans
Senior MBS & Public Sector loans
Senior MBS &       & Mortgage Loans  \\
Geographical scope of cover assets  & Domestic, EEA, CH & Domestic, EEA, CH &       & Domestic (France Only) & Domestic  & Flexible  & Flexible  &       & Domestic, EEA, CH,          USA, Canada, Japan  &       & EEA, CH &       & Domestic and EEA &       & EEA   & EEA   &       & EEA \\
Regulator CB specific disclosure requirements to public & Not mandatory  & Not mandatory  &       & Mandatory & Mandatory & Mandatory & Mandatory &       & Mandatory &       & Not mandatory  &       & Mandatory &       & Not mandatory  & Not mandatory  &       & Mandatory \\
\bottomrule
\end{longtable}%
\end{landscape}
\end{document}


There are some multiple columns as well. The desired form of table is given below:

• You have 13 columns but your preamble declares only 3. Then, you have some \multicolumn{19}{l}{...}. Start by declaring the correct number of columns. – Eric Domenjoud Nov 21 '16 at 1:00
• @EricDomenjoud I could not find where I have declared 3 in my preamble. Can you please specify. Mainly there are there 13 columns with text. But I want a space between the Main headings text. See the top row of desired table. To obtain this space I added additional blank columns in excel that make total 19. Please check the edited codes. – Ahmed Arif Nov 21 '16 at 11:42
• Ok. I understand where your 19 columns come from but your preamble is {l>{\raggedright\arraybackslash}p{6cm}>{\raggedright\arraybackslash}p{7cm}} which declares 3 columns, one aligned left, and two in paragraph mode. – Eric Domenjoud Nov 21 '16 at 12:29

The space you are looking after is produced by the trim argument of \cmidrule, e.g. \cmidrule(lr){2-3}. Please consult the documentation of the packages used here to get an understanding of what is happening. Code:

\documentclass{article}

\usepackage{geometry}
\geometry{a4paper,textheight=20cm}

\usepackage{booktabs,ragged2e,ltxtable,pdflscape,filecontents}

\begin{filecontents}{lt.tab}
\begin{longtable}[c]{@{}p{3cm}*{12}{>{\hspace{0pt}\RaggedRight}X}@{}}
\caption{Structure}\label{tab:str}\\
\toprule
& \multicolumn{2}{c}{\textbf{Main 1}}
& \multicolumn{4}{c}{\textbf{Main 2}}
& \multicolumn{1}{c}{\textbf{Main 3}}
& \multicolumn{1}{c}{\textbf{Main 4}}
& \multicolumn{1}{c}{\textbf{Main 5}}
& \multicolumn{2}{c}{\textbf{Main 6}}
& \multicolumn{1}{c}{\textbf{Main 7}} \\
\cmidrule(r){1-1}\cmidrule(lr){2-3}\cmidrule(lr){4-7}\cmidrule(lr){8-8}%
\cmidrule(lr){9-9}\cmidrule(lr){10-10}\cmidrule(lr){11-12}\cmidrule(l){13-13}
%
& Text 1a & Text 1b & Text 2a & Text 2b & Text 2c & Text 2d
& Text 3a & Text 4a & Text 5a & Text 6a & Text 6b & Text 7a \\
%
\midrule
\multicolumn{13}{@{}l}{\textbf{Structure}} \\
\midrule
Issuer & Licensed UCI  & Licensed UCI & Specialised Credit Institution
& Specialised Credit Institution  & Specialised Credit Institution
& Specialised Credit Institution  & Licensed UCI & UCI
& Licensed UCI  &  UCI, Specialised Credit Institution
& UCI, Specialised Credit Institution & UCI, Specialised Credit Institution
\end{longtable}
\end{filecontents}

\begin{document}

\begin{landscape}
\footnotesize
\LTXtable{20cm}{lt.tab}
\end{landscape}

\end{document}