1

I need to use xltabular for a complex table. The MDPI template has an example of a tabularx on full width that I am trying to replicate:

\documentclass[journal,article,submit,pdftex,moreauthors]{Definitions/mdpi} 

\firstpage{1} 
\makeatletter 
\setcounter{page}{\@firstpage} 
\makeatother
\pubvolume{1}
\issuenum{1}
\articlenumber{0}
\pubyear{2022}
\copyrightyear{2022}
\datereceived{} 
\dateaccepted{} 
\datepublished{} 
\hreflink{https://doi.org/}

\Title{Title}

\Author{Firstname Lastname}
\AuthorNames{Firstname Lastname}

\address{%
$^{1}$ \quad Affiliation 1; [email protected]
}

\begin{document}

\begin{table}[H]
\caption{This is a wide table.\label{tab2}}
    \begin{adjustwidth}{-\extralength}{0cm}
        \newcolumntype{C}{>{\centering\arraybackslash}X}
        \begin{tabularx}{\fulllength}{CCCC}
            \toprule
            \textbf{Title 1}    & \textbf{Title 2}  & \textbf{Title 3}     & \textbf{Title 4}\\
            \midrule
            Entry 1     & Data          & Data          & Data\\
            Entry 2     & Data          & Data          & Data \textsuperscript{1}\\
            \bottomrule
        \end{tabularx}
    \end{adjustwidth}
    \noindent{\footnotesize{\textsuperscript{1} This is a table footnote.}}
\end{table}

\end{document}

Good table that spreads the full width

However, when I attempt the following I don't get the result I hoped for:

\documentclass[journal,article,submit,pdftex,moreauthors]{Definitions/mdpi} 

\usepackage{xltabular}

\firstpage{1} 
\makeatletter 
\setcounter{page}{\@firstpage} 
\makeatother
\pubvolume{1}
\issuenum{1}
\articlenumber{0}
\pubyear{2022}
\copyrightyear{2022}
\datereceived{} 
\dateaccepted{} 
\datepublished{} 
\hreflink{https://doi.org/}

\Title{Title}

\Author{Firstname Lastname}
\AuthorNames{Firstname Lastname}

\address{%
$^{1}$ \quad Affiliation 1; [email protected]
}

\begin{document}

\begin{table}[H]
\caption{This is a wide table.\label{tab2}}
    \begin{adjustwidth}{-\extralength}{0cm}
        \newcolumntype{C}{>{\centering\arraybackslash}X}
        \begin{xltabular}{\fulllength}{CCCC}
            \toprule
            \textbf{Title 1}    & \textbf{Title 2}  & \textbf{Title 3}     & \textbf{Title 4}\\
            \midrule
            Entry 1     & Data          & Data          & Data\\
            Entry 2     & Data          & Data          & Data \textsuperscript{1}\\
            \bottomrule
        \end{xltabular}
    \end{adjustwidth}
    \noindent{\footnotesize{\textsuperscript{1} This is a table footnote.}}
\end{table}

\end{document}

Bad table that is not wide enough

How can I generate a full-width xltabular table?

2
  • 1
    Please extend your code fragments to complete, compilable small document with your tables, which we can test as it is.
    – Zarko
    Commented Oct 27, 2022 at 13:26
  • Thank you. That is done @Zarko. You'll still need the MDPI Class and Style Files though.
    – mritz_p
    Commented Oct 27, 2022 at 15:37

1 Answer 1

2

I couldn't figure out how to stretch an xltabular table, but was able to do this with tabularray and longtblr. This has similar functionality to xltabular.

\documentclass[journal,article,submit,pdftex,moreauthors]{Definitions/mdpi} 

\firstpage{1} 
\makeatletter 
\setcounter{page}{\@firstpage} 
\makeatother
\pubvolume{1}
\issuenum{1}
\articlenumber{0}
\pubyear{2022}
\copyrightyear{2022}
\datereceived{} 
\dateaccepted{} 
\datepublished{} 
\hreflink{https://doi.org/}

\usepackage{tabularray}

\Title{Title}

\Author{Firstname Lastname}
\AuthorNames{Firstname Lastname}

\address{%
$^{1}$ \quad Affiliation 1; [email protected]
}

\begin{document}

\begin{adjustwidth}{-\extralength}{0cm}
    \begin{longtblr}[
        caption = {This is a wide table using tabularray and longtblr.},
        label = {tab2},
        note{1} = {This is a table footnote.}
        ]{
          colspec = {XXXX}, hlines,
        }
        Entry 1     & Data          & Data          & Data\\
        Entry 2     & Data          & Data          & Data \textsuperscript{1}\\
    \end{longtblr}
\end{adjustwidth}

\end{document}

enter image description here

You must log in to answer this question.

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