我需要用于xltabular
复杂的表格。MDPI 模板tabularx
有一个我试图复制的全宽示例:
\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}
但是,当我尝试以下操作时,并没有得到我所希望的结果:
\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}
如何生成全宽xltabular
表格?
答案1
我不知道如何拉伸xltabular
表格,但可以使用tabularray
和来实现longtblr
。它具有与 类似的功能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}