0

I have to adjust the width in one of my tables. I have looked at other questions regarding this - but I cannot seem to figure it out.

My preamble:

\usepackage[backend=biber,style=authoryear,autocite=inline]{biblatex}
\addbibresource{Bibliography.bib}
\usepackage[labelfont={bf, it}]{caption}
\captionsetup{font=footnotesize, textfont=it}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage{float}
\usepackage[normalem]{ulem}
\useunder{\uline}{\ul}{}
\usepackage[T1]{fontenc} 
\usepackage[table,xcdraw]{xcolor}
\usepackage{multicol}
\usepackage{adjustbox}
\usepackage{array}
\usepackage{wrapfig}
\usepackage{multirow}
\usepackage{tabu}
\usepackage{rotating}
\usepackage{amsmath}
%\usepackage[table,xcdraw]{xcolor}
\usepackage[a4paper, total={6in, 9in}]{geometry}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead[L]{\fontsize{10}{12}}
\linespread{1.5}
\usepackage{times}
\usepackage[none]{hyphenat}
\sloppy
\usepackage[hidelinks]{hyperref} %[hidelinks] fjerner det røde i table of contents
\usepackage{textgreek}
\usepackage{longtable}

My table:

\begin{longtable}[H]{l|l|l|l|l}
\label{MTPSLLONG}
\hline
\multicolumn{1}{c|}{\cellcolor[HTML]{F2F1E1}\textbf{Species}} & \multicolumn{1}{c|}{\cellcolor[HTML]{F2F1E1}\textbf{MTPSL}} & \multicolumn{1}{c|}{\cellcolor[HTML]{F2F1E1}\textbf{Substrate(s)}} & \multicolumn{1}{c|}{\cellcolor[HTML]{F2F1E1}\textbf{Product(s)}} & \multicolumn{1}{c}{\cellcolor[HTML]{F2F1E1}\textbf{Reference}} \\ \hline
\endfirsthead

\hline
\multicolumn{1}{c|}{\cellcolor[HTML]{F2F1E1}\textbf{Species}} & \multicolumn{1}{c|}{\cellcolor[HTML]{F2F1E1}\textbf{MTPSL}} & \multicolumn{1}{c|}{\cellcolor[HTML]{F2F1E1}\textbf{Substrate(s)}} & \multicolumn{1}{c|}{\cellcolor[HTML]{F2F1E1}\textbf{Product(s)}} & \multicolumn{1}{c}{\cellcolor[HTML]{F2F1E1}\textbf{Reference}} \\ \hline
\endfoot

 & SmMTPSL1 & (E,E)-FPP & \begin{tabular}[c]{@{}l@{}}(E)- nerolidol, α-copaene, \\ β-elemene, γ-cadinene, δ-cadinene, \\ unidentified oxygenated sesquiterpene\end{tabular} &  \\ \cline{2-4}
 & SmMTPSL13 & None & None &  \\ \cline{2-4}
 & SmMTPSL17 & (E,E)-FPP & \begin{tabular}[c]{@{}l@{}}α-copaene, β-elemene, \\ γ-cadinene, δ-cadinene, \\ unidentified oxygenated sesquiterpene, \\ germacrene, bicyclogermacrene, \\ α-cadinene\end{tabular} &  \\ \cline{2-4}
 & SmMTPSL22 & (E,E)-FPP, GPP & (E)- nerolidol, limonene, linalool &  \\ \cline{2-4}
 & SmMTPSL26 & (E,E)-FPP & \begin{tabular}[c]{@{}l@{}}unidentified sesquiterpene A, \\ unidentified sesquiterpene B, \\ 2-epi-(E)-β-caryophyllene\end{tabular} &  \\ \cline{2-4}
\multirow{-6}{*}{\textit{Selaginella moellendorffii}} & SmMTPSL30 & None & None & \multirow{-6}{*}{Li et. al (2012)} \\ \hline
 & MpMTPSL1 & None & None &  \\ \cline{2-4}
 & MpMTPSL2 & NPP & Not defined &  \\ \cline{2-4}
 & MpMTPSL3 & (E,E)-FPP & Not defined &  \\ \cline{2-4}
 & MpMTPSL4 & (E,E)-FPP & \begin{tabular}[c]{@{}l@{}}(2)-a-Gurjunene (3), \\  5-Hydroxy-a-Gurjunene, and others\\ not defined\end{tabular} &  \\ \cline{2-4}
 & MpMTPSL5 & (E,E)-FPP & Not defined &  \\ \cline{2-4}
 & MpMTPSL6 & NPP & Not defined &  \\ \cline{2-4}
 & MpMTPSL7 & (E,E)-FPP & Not defined &  \\ \cline{2-4}
 & MpMTPSL8 & None & None &  \\ \cline{2-4}
\multirow{-9}{*}{\textit{Marchantia polymorpha}} & MpMTPSL9 & (E,E)-FPP & Not defined & \multirow{-9}{*}{Kumar et. al (2016)} \\ \hline
 & Liv-IRBN-MTPSL2 & GPP, (E,E)-FPP, (Z,E)-FPP & \begin{tabular}[c]{@{}l@{}}Myrcene, limonene, (Z)-β-ocimene, \\ (E)-β-ocimene, linalool, \\ bicycloelemene, bicyclogermacrene, \\ unidentified sesquiterpene hydrocarbons\end{tabular} &  \\ \cline{2-4}
\multirow{-2}{*}{\textit{Scapania nemorea}} & Liv-IRBN-MTPSL4 & (E,E)-FPP, (Z,E)-FPP, (Z,Z)-FPP, (E,E,E)-GGPP & \begin{tabular}[c]{@{}l@{}}α-isocomene, β-elemene, \\ (E)-β-caryophyllene, (E)-β-farnesene, \\ nerolidol, dactylol, (E)-β-farnesene, \\ (Z)-α-bisabolene, γ-curcumene, \\ zingiberene, multiple unidentified ST, \\ β-sesquiphellandrene, \\ unidentified sesquiterpene hydrocarbons, \\ unidentified diterpenes\end{tabular} &  \\ \cline{1-4}
\textit{Sphagnum lescurii} & Mos-GOWD-MTPSL2 & GPP & \begin{tabular}[c]{@{}l@{}}Myrcene, (Z)-β-ocimene, \\ (E)-β-ocimene, linalool, allo-ocimene\end{tabular} &  \\ \cline{1-4}
\textit{Pseudotaxiphyllum elegans} & Mos-QKQO-MTPSL3 & (E,E)-FPP, (Z,E)-FPP, (Z,Z)-FPP & \begin{tabular}[c]{@{}l@{}}γ-curcumen, α-zingiberene, \\ β-bisabolene, β-curcumene, \\ sesquiphellandrene, (E)-α-bisabolene, \\ (Z)-α-bisabolene, γ-curcumene, \\ zingiberene, β-sesquiphellandrene\end{tabular} &  \\ \cline{1-4}
\textit{Anomodon rostratus} & Mos-VBMM-MTPSL3 & (E,E)-FPP, (Z,E)-FPP, (Z,Z)-FPP, (E,E,E)-GGPP & \begin{tabular}[c]{@{}l@{}}(E)-β-farnesene, γ-curcumene, \\ α-zingiberen, β-bisabolene, \\ β-curcumene, (E)-α-bisabolene,  \\ (Z)-γ- bisabolene, (E)-γ-bisabolene, \\ β-bisabolol, α-bisabolol, β-bisabolene, \\ (Z)-γ-bisabolene, (Z)-α-bisabolene, \\ γ-curcumene, (E)-γ- bisabolene,\\ multiple unidentified diterpenes\end{tabular} &  \\ \cline{1-4}
\textit{Anthoceros punctatus} & Hon-ApMTPSL7 & GPP, (E,E)-FPP, (Z,E)-FPP, (Z,Z)-FPP &  &  \\ \cline{1-4}
\textit{Myriopteris eatonii} & Mon-GSXD-MTPSL3 & (E,E)-FPP, (Z,E)-FPP & \begin{tabular}[c]{@{}l@{}}(Z,E)-α-farnesene, (E,E)-α-farnesene, \\ (E)-β-farnesene, (E,E)-α-farnesene\end{tabular} &  \\ \cline{1-4}
\textit{Pityrogramma trifoliata} & Mon-UJTT-MTPSL4 & GPP, (E,E)-FPP, (Z,E)-FPP, (Z,Z)-FPP & \begin{tabular}[c]{@{}l@{}}Myrcene, (Z)-β-ocimene, \\ (E)-β-ocimene, linalool, \\ protoillud-6-ene, \\ multiple unidentified ST, \\ epi-bicyclosesquiphellandrene, \\ γ-cadinene, δ-cadinene, α-cadinene, \\ γ-curcumene\end{tabular} &  \\ \cline{1-4}
\textit{Woodsia scopulina} & Mon-YJJY-MTPSL1 & (E,E)-FPP, (Z,E)-FPP, (Z,Z)-FPP & \begin{tabular}[c]{@{}l@{}}Protoillud-6-ene, \\ multiple unidentified ST, \\ epi-bicyclosesquiphellandrene, \\ γ-cadinene, δ-cadinene, α-cadinene, \\ γ-curcumene\end{tabular} & \multirow{-9}{*}{Jia et. al (2016)} \\ \hline
\textit{Porphyridium purpureum} & PpMTPSL & (E,E)-FPP, (E,E,E)-GGPP & \begin{tabular}[c]{@{}l@{}}β-Elemene, aristol-9-ene, β-copaene, \\ germacrene A, \\ multiple unidentified ST, \\ unidentified oxygenated sesquiterpene\end{tabular} &  \\ \cline{1-4}
 & EaMTPSL1 & GPP, (E,E)-FPP & Linalol, nerolidol &  \\ \cline{2-4}
\multirow{-2}{*}{\textit{Erythrolobus australicus}} & EaMTPSL2 & (E,E)-FPP & \begin{tabular}[c]{@{}l@{}}β-Elemene, aristol-9-ene, β-copaene, \\ unidentified oxygenated sesquiterpene, \\ α-ylangene, α-muurolene, \\ multiple unidentified ST, \\ (Z)-α-bisabolene epoxide\end{tabular} & \multirow{-3}{*}{Wei 2019} \\ \hline
\end{longtable}

A picture of some of it: enter image description here

3
  • 2
    Please make you code compilable. Which documentclass do you use? Please alo make your example code more minimal. There are a lot of packages that are not related to the longtable.
    – leandriis
    Apr 6 '20 at 10:18
  • Your longtable misses its caption as well as a \\ after the label.
    – leandriis
    Apr 6 '20 at 10:20
  • longtable environments do not float. Hence, the [H] placement specifier has no effect at all (except to add to the code clutter).
    – Mico
    Apr 6 '20 at 10:39
1

In order to make your table fit into the textwidth, I would suggest the following redesign. In the following MWE, I have commented out all the packages that are not directly related to the table, I have added booktabs for horizontal lines, makecell for the column headers and xltabular instead of longtable for the X type column. To efficiently make use f the X type columns, I have also removed all nested tabulars and the associated \\s. In addition, I have removed most horizontal and all vertical lines. To save space and reduce the amount of wasted white space in the first and last column and potential problems uf \multirowand mid-table page breaks, I have removed them alltogether and added section-like headers to the table in which I combined the "Species" and "Reference" information. Since you use biblatex, I suggest you replace the manually entered citation information (Such as "Li et. al (2012)") by the appropriate biblatex commands.

enter image description here

\documentclass{article}
%\usepackage[backend=biber,style=authoryear,autocite=inline]{biblatex}
%\addbibresource{Bibliography.bib}
\usepackage[labelfont={bf, it}]{caption}
\captionsetup{font=footnotesize, textfont=it}
%\usepackage{graphicx}
%\usepackage{epstopdf}
%\usepackage{float}
%\usepackage[normalem]{ulem}
%\useunder{\uline}{\ul}{}
%\usepackage[T1]{fontenc} 
%\usepackage[table,xcdraw]{xcolor}
%\usepackage{multicol}
%\usepackage{adjustbox}
\usepackage{array}
%\usepackage{wrapfig}
\usepackage{multirow}
%\usepackage{tabu}
%\usepackage{rotating}
%\usepackage{amsmath}
%\usepackage[table,xcdraw]{xcolor}
\usepackage[a4paper, total={6in, 9in}]{geometry}
%\usepackage{fancyhdr}
%\pagestyle{fancy}
%\fancyhead[L]{\fontsize{10}{12}}
\linespread{1.5}
%\usepackage{times}
%\usepackage[none]{hyphenat}
%\sloppy

%\usepackage{textgreek}
\usepackage{xltabular}
\usepackage{makecell}
\renewcommand{\theadfont}{\normalsize}
\usepackage{booktabs}


\usepackage[hidelinks]{hyperref} %[hidelinks] fjerner det røde i table of contents
\begin{document}

\begin{xltabular}{\textwidth}{ll>{\raggedright\arraybackslash}X}
\caption{caption text here}\label{MTPSLLONG}\\
\toprule
 \thead{MTPSL} & \thead{Substrate(s)} & \thead{Product(s)}  \\ 
\midrule
\endfirsthead
\caption*{caption text here - continued}\\
\toprule
 \thead{MTPSL} & \thead{Substrate(s)} & \thead{Product(s)}  \\ 
\midrule
\endhead
\multicolumn{3}{@{}l}{\emph{Selaginella moellendorffii} Li et. al (2012)}\\
  SmMTPSL1 & (E,E)-FPP & (E)- nerolidol, α-copaene,  β-elemene, γ-cadinene, δ-cadinene,  unidentified oxygenated sesquiterpene   \\ 
  SmMTPSL13 & None & None   \\ 
  SmMTPSL17 & (E,E)-FPP & α-copaene, β-elemene,  γ-cadinene, δ-cadinene,  unidentified oxygenated sesquiterpene,  germacrene, bicyclogermacrene,  α-cadinene   \\ 
  SmMTPSL22 & (E,E)-FPP, GPP & (E)- nerolidol, limonene, linalool   \\ 
  SmMTPSL26 & (E,E)-FPP & unidentified sesquiterpene A,  unidentified sesquiterpene B,  2-epi-(E)-β-caryophyllene  \\ 
 SmMTPSL30 & None & None  \\ 
\midrule
\multicolumn{3}{@{}l}{\emph{Marchantia polymorpha} Kumar et. al (2016)}\\
  MpMTPSL1 & None & None   \\ 
  MpMTPSL2 & NPP & Not defined   \\ 
  MpMTPSL3 & (E,E)-FPP & Not defined   \\
  MpMTPSL4 & (E,E)-FPP & (2)-a-Gurjunene (3), 5-Hydroxy-a-Gurjunene, and others not define   \\ 
  MpMTPSL5 & (E,E)-FPP & Not defined   \\ 
  MpMTPSL6 & NPP & Not defined   \\ 
  MpMTPSL7 & (E,E)-FPP & Not defined   \\
  MpMTPSL8 & None & None   \\ 
\midrule
% & Liv-IRBN-MTPSL2 & GPP, (E,E)-FPP, (Z,E)-FPP & \begin{tabular}[c]{@{}l@{}}Myrcene, limonene, (Z)-β-ocimene, \\ (E)-β-ocimene, linalool, \\ bicycloelemene, bicyclogermacrene, \\ unidentified sesquiterpene hydrocarbons\end{tabular} &  \\ \cline{2-4}
%\multirow{-2}{*}{\textit{Scapania nemorea}} & Liv-IRBN-MTPSL4 & (E,E)-FPP, (Z,E)-FPP, (Z,Z)-FPP, (E,E,E)-GGPP & \begin{tabular}[c]{@{}l@{}}α-isocomene, β-elemene, \\ (E)-β-caryophyllene, (E)-β-farnesene, \\ nerolidol, dactylol, (E)-β-farnesene, \\ (Z)-α-bisabolene, γ-curcumene, \\ zingiberene, multiple unidentified ST, \\ β-sesquiphellandrene, \\ unidentified sesquiterpene hydrocarbons, \\ unidentified diterpenes\end{tabular} &  \\ \cline{1-4}
%\textit{Sphagnum lescurii} & Mos-GOWD-MTPSL2 & GPP & \begin{tabular}[c]{@{}l@{}}Myrcene, (Z)-β-ocimene, \\ (E)-β-ocimene, linalool, allo-ocimene\end{tabular} &  \\ \cline{1-4}
%\textit{Pseudotaxiphyllum elegans} & Mos-QKQO-MTPSL3 & (E,E)-FPP, (Z,E)-FPP, (Z,Z)-FPP & \begin{tabular}[c]{@{}l@{}}γ-curcumen, α-zingiberene, \\ β-bisabolene, β-curcumene, \\ sesquiphellandrene, (E)-α-bisabolene, \\ (Z)-α-bisabolene, γ-curcumene, \\ zingiberene, β-sesquiphellandrene\end{tabular} &  \\ \cline{1-4}
%\textit{Anomodon rostratus} & Mos-VBMM-MTPSL3 & (E,E)-FPP, (Z,E)-FPP, (Z,Z)-FPP, (E,E,E)-GGPP & \begin{tabular}[c]{@{}l@{}}(E)-β-farnesene, γ-curcumene, \\ α-zingiberen, β-bisabolene, \\ β-curcumene, (E)-α-bisabolene,  \\ (Z)-γ- bisabolene, (E)-γ-bisabolene, \\ β-bisabolol, α-bisabolol, β-bisabolene, \\ (Z)-γ-bisabolene, (Z)-α-bisabolene, \\ γ-curcumene, (E)-γ- bisabolene,\\ multiple unidentified diterpenes\end{tabular} &  \\ \cline{1-4}
%\textit{Anthoceros punctatus} & Hon-ApMTPSL7 & GPP, (E,E)-FPP, (Z,E)-FPP, (Z,Z)-FPP &  &  \\ \cline{1-4}
%\textit{Myriopteris eatonii} & Mon-GSXD-MTPSL3 & (E,E)-FPP, (Z,E)-FPP & \begin{tabular}[c]{@{}l@{}}(Z,E)-α-farnesene, (E,E)-α-farnesene, \\ (E)-β-farnesene, (E,E)-α-farnesene\end{tabular} &  \\ \cline{1-4}
%\textit{Pityrogramma trifoliata} & Mon-UJTT-MTPSL4 & GPP, (E,E)-FPP, (Z,E)-FPP, (Z,Z)-FPP & \begin{tabular}[c]{@{}l@{}}Myrcene, (Z)-β-ocimene, \\ (E)-β-ocimene, linalool, \\ protoillud-6-ene, \\ multiple unidentified ST, \\ epi-bicyclosesquiphellandrene, \\ γ-cadinene, δ-cadinene, α-cadinene, \\ γ-curcumene\end{tabular} &  \\ \cline{1-4}
%\textit{Woodsia scopulina} & Mon-YJJY-MTPSL1 & (E,E)-FPP, (Z,E)-FPP, (Z,Z)-FPP & \begin{tabular}[c]{@{}l@{}}Protoillud-6-ene, \\ multiple unidentified ST, \\ epi-bicyclosesquiphellandrene, \\ γ-cadinene, δ-cadinene, α-cadinene, \\ γ-curcumene\end{tabular} & \multirow{-9}{*}{Jia et. al (2016)} \\ \hline
%\textit{Porphyridium purpureum} & PpMTPSL & (E,E)-FPP, (E,E,E)-GGPP & \begin{tabular}[c]{@{}l@{}}β-Elemene, aristol-9-ene, β-copaene, \\ germacrene A, \\ multiple unidentified ST, \\ unidentified oxygenated sesquiterpene\end{tabular} &  \\ \cline{1-4}
% & EaMTPSL1 & GPP, (E,E)-FPP & Linalol, nerolidol &  \\ \cline{2-4}
%\multirow{-2}{*}{\textit{Erythrolobus australicus}} & EaMTPSL2 & (E,E)-FPP & \begin{tabular}[c]{@{}l@{}}β-Elemene, aristol-9-ene, β-copaene, \\ unidentified oxygenated sesquiterpene, \\ α-ylangene, α-muurolene, \\ multiple unidentified ST, \\ (Z)-α-bisabolene epoxide\end{tabular} & \multirow{-3}{*}{Wei 2019} \\ \hline
\end{xltabular}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.