I am out of any ideas. My piece of code for a very long table goes beyond the page border. I spent 4 hours reading through and testing all possible solutions but no success:
Here is the example screenshot from the word:
below is a snippet of my code
\documentclass{article}
\usepackage{longtable, tabu,pdflscape,booktabs}
\usepackage{multirow}
\usepackage[table,xcdraw]{xcolor}
\usepackage{url}
\begin{document}
\begin{longtable}{|p{2.5cm}p{0.5cm}p{2cm}p{4cm}p{3.5cm}|}
\caption{lab lab lab}
\label{table:test}\\
\hline
\rowcolor[HTML]{FFFFFF}
\multicolumn{1}{|l|}{\cellcolor[HTML]{FFFFFF}} &
\multicolumn{2}{l|}{\cellcolor[HTML]{FFFFFF}\textbf{Geospatial domain}} &
\multicolumn{2}{l|}{\cellcolor[HTML]{FFFFFF}\textbf{E-government / open data platform}} \\ \cline{2-5}
\rowcolor[HTML]{FFFFFF}
\multicolumn{1}{|l|}{\multirow{-2}{*}{\cellcolor[HTML]{FFFFFF}\textbf{Requirements for the catalogue}}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{FFFFFF}\shortstack[l]{Munich Geoportal \\ - Data Model: ISO 19139 \\ - Software: Geonetwork}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{FFFFFF}\shortstack[l]{GeoportalBayern\footnote{\url{https://geoportal.bayern.de/geoportalbayern/suche/suche?6\&q=flur\&f=true}} \\ - Data Model: ISO 19139 \& Inspire\ \ - Software: privately developed}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{FFFFFF}\shortstack[l]{European Data Portal - EDP\footnote{\url{https://data.europa.eu/en}} \\ - Data Model: DCAT-AP \\ - Software: CKAN}} &
\shortstack[l]{City of Los Angeles\footnote{\url{ https://data.lacity.org/browse}} \\ - Data model: Socrata native data model \\ - Software Socrata} \\ \hline
\endhead
\rowcolor[HTML]{9CCDE2}
\multicolumn{1}{|l|}{\cellcolor[HTML]{9CCDE2}1. Intuitive \& User friendly web interface} &
\multicolumn{1}{l|}{\cellcolor[HTML]{9CCDE2}Yes} &
\multicolumn{1}{l|}{\cellcolor[HTML]{9CCDE2}\shortstack[l]{Partial \\ {[}- only available in German \\ - not trivial{]}}} & \multicolumn{1}{l|}{\cellcolor[HTML]{9CCDE2}Yes} &
\cellcolor[HTML]{9CCDE2}\shortstack[l]{Partial\\ {[}- some dataset pages are long{]}} \\ \hline
\rowcolor[HTML]{FFFFFF}
\multicolumn{1}{|l|}{\cellcolor[HTML]{FFFFFF}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{FFFFFF}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{FFFFFF}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{FFFFFF}} &
\\ \hline
\rowcolor[HTML]{9CCDE2}
\multicolumn{1}{|l|}{\cellcolor[HTML]{9CCDE2}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{9CCDE2}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{9CCDE2}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{9CCDE2}} &
\\ \hline
\rowcolor[HTML]{FFFFFF}
\multicolumn{1}{|l|}{\cellcolor[HTML]{FFFFFF}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{FFFFFF}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{FFFFFF}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{FFFFFF}} &
\\ \hline
\rowcolor[HTML]{9CCDE2}
\multicolumn{1}{|l|}{\cellcolor[HTML]{9CCDE2}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{9CCDE2}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{9CCDE2}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{9CCDE2}} &
\\ \hline
\rowcolor[HTML]{FFFFFF}
\multicolumn{1}{|l|}{\cellcolor[HTML]{FFFFFF}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{FFFFFF}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{FFFFFF}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{FFFFFF}} &
\\ \hline
\rowcolor[HTML]{9CCDE2}
\multicolumn{1}{|l|}{\cellcolor[HTML]{9CCDE2}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{9CCDE2}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{9CCDE2}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{9CCDE2}} &
\\ \hline
\rowcolor[HTML]{FFFFFF}
\multicolumn{1}{|l|}{\cellcolor[HTML]{FFFFFF}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{FFFFFF}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{FFFFFF}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{FFFFFF}} &
\\ \hline
\rowcolor[HTML]{9CCDE2}
\multicolumn{1}{|l|}{\cellcolor[HTML]{9CCDE2}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{9CCDE2}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{9CCDE2}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{9CCDE2}} &
\\ \hline
\rowcolor[HTML]{FFFFFF}
\multicolumn{1}{|l|}{\cellcolor[HTML]{FFFFFF}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{FFFFFF}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{FFFFFF}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{FFFFFF}} &
\\ \hline
\rowcolor[HTML]{9CCDE2}
\multicolumn{1}{|l|}{\cellcolor[HTML]{9CCDE2}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{9CCDE2}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{9CCDE2}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{9CCDE2}} &
\\ \hline
\rowcolor[HTML]{FFFFFF}
\multicolumn{5}{|l|}{\cellcolor[HTML]{FFFFFF}Fundamental register (e.g. Building, Agricultural land parcel)} \\ \hline
\rowcolor[HTML]{9CCDE2}
\multicolumn{1}{|l|}{\cellcolor[HTML]{9CCDE2}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{9CCDE2}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{9CCDE2}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{9CCDE2}} &
\\ \hline
\rowcolor[HTML]{FFFFFF}
\multicolumn{1}{|l|}{\cellcolor[HTML]{FFFFFF}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{FFFFFF}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{FFFFFF}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{FFFFFF}} &
\\ \hline
\rowcolor[HTML]{9CCDE2}
\multicolumn{1}{|l|}{\cellcolor[HTML]{9CCDE2}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{9CCDE2}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{9CCDE2}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{9CCDE2}} &
\\ \hline
\rowcolor[HTML]{FFFFFF}
\multicolumn{1}{|l|}{\cellcolor[HTML]{FFFFFF}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{FFFFFF}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{FFFFFF}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{FFFFFF}} &
\\ \hline
\rowcolor[HTML]{9CCDE2}
\multicolumn{1}{|l|}{\cellcolor[HTML]{9CCDE2}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{9CCDE2}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{9CCDE2}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{9CCDE2}} &
\\ \hline
\rowcolor[HTML]{FFFFFF}
\multicolumn{5}{|l|}{\cellcolor[HTML]{FFFFFF}} \\ \hline
\rowcolor[HTML]{9CCDE2}
\multicolumn{1}{|l|}{\cellcolor[HTML]{9CCDE2}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{9CCDE2}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{9CCDE2}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{9CCDE2}} &
\\ \hline
\rowcolor[HTML]{FFFFFF}
\multicolumn{1}{|l|}{\cellcolor[HTML]{FFFFFF}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{FFFFFF}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{FFFFFF}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{FFFFFF}} &
\\ \hline
\rowcolor[HTML]{9CCDE2}
\multicolumn{1}{|l|}{\cellcolor[HTML]{9CCDE2}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{9CCDE2}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{9CCDE2}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{9CCDE2}} &
\\ \hline
\rowcolor[HTML]{FFFFFF}
\multicolumn{1}{|l|}{\cellcolor[HTML]{FFFFFF}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{FFFFFF}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{FFFFFF}} &
\multicolumn{1}{l|}{\cellcolor[HTML]{FFFFFF}} &
\\ \hline
\end{longtable}
\end{document}
I set the linewidth, did not work. I also used other libraries such as tabularx, still could not figure it out. Does anyone have any idea what I am doing wrong? Thanks Mani
If you warp all your cells completely unnecessarily into \multicolumn{1}{|l|}{...}
you disable the automatic line breaking and sabotage the columns width you set at the start of the table.
Here a different approach using the tabularray
package, which makes it very easy to merge cells:
\documentclass{article}
\usepackage{url}
\usepackage{xcolor}
\usepackage{geometry}
\usepackage{tabularray}
\definecolor{mycolor}{HTML}{9CCDE2}
\begin{document}
\begin{longtblr}[
caption={lab lab lab},
label={table:test},
note{1}={\url{https://geoportal.bayern.de/geoportalbayern/suche/suche?6&q=flur&f=true}},
note{2}={\url{https://data.europa.eu/en}},
note{3}={\url{https://data.lacity.org/browse}}
]{
colspec={XXXXX},
cells={halign=l,valign=h},
row{odd}={mycolor},
row{1}={white,font=\bfseries},
rowhead = 2,
vlines,hlines
}
\SetCell[r=2]{} Requirements for the catalogue & \SetCell[c=2]{} Geospatial domain & & \SetCell[c=2]{} E-government / open data platform & \\
& {Munich Geoportal \\ - Data Model: ISO 19139 \\ - Software: Geonetwork} & {GeoportalBayern\TblrNote{1} \\ - Data Model: ISO 19139 \& Inspire\\ - Software: privately developed} & {European Data Portal - EDP\TblrNote{2} \\ - Data Model: DCAT-AP \\ - Software: CKAN} & {City of Los Angeles\TblrNote{3} \\ - Data model: Socrata native data model \\ - Software Socrata}\\
... & .... & ... & ... & ...\\
\end{longtblr}
\end{document}