我正在使用 MDPI latex 模板这里。我有一张宽桌子,应该横跨整个宽度。
要重现此问题,请使用此 MWE。MWE 代码必须在 mdpi 模板内执行,例如 overleaf
\documentclass[journal,article,submit,moreauthors,pdftex]{Definitions/mdpi}
% MDPI internal commands
\firstpage{1}
\makeatletter
\setcounter{page}{\@firstpage}
\makeatother
\pubvolume{1}
\issuenum{1}
\articlenumber{0}
\pubyear{2021}
\copyrightyear{2020}
\datereceived{}
\dateaccepted{}
\datepublished{}
\hreflink{https://doi.org/} % If needed use \linebreak
% Full title of the paper (Capitalized)
\Title{Title}
% MDPI internal command: Title for citation in the left column
\TitleCitation{Title}
% Author Orchid ID: enter ID or remove command
\newcommand{\orcidauthorA}{0000-0000-0000-000X} % Add \orcidA{} behind the author's name
%\newcommand{\orcidauthorB}{0000-0000-0000-000X} % Add \orcidB{} behind the author's name
% Authors, for the paper (add full first names)
\Author{Firstname Lastname $^{1,\dagger,\ddagger}$\orcidA{}, Firstname Lastname $^{1,\ddagger}$ and Firstname Lastname $^{2,}$*}
% MDPI internal command: Authors, for metadata in PDF
\AuthorNames{Firstname Lastname, Firstname Lastname and Firstname Lastname}
% MDPI internal command: Authors, for citation in the left column
\AuthorCitation{Lastname, F.; Lastname, F.; Lastname, F.}
% If this is a Chicago style journal: Lastname, Firstname, Firstname Lastname, and Firstname Lastname.
% Affiliations / Addresses (Add [1] after \address if there is only one affiliation.)
\address{%
$^{1}$ \quad Affiliation 1; [email protected]\\
$^{2}$ \quad Affiliation 2; [email protected]}
% Contact information of the corresponding author
\corres{Correspondence: [email protected]; Tel.: (optional; include country code; if there are multiple corresponding authors, add author initials) +xx-xxxx-xxx-xxxx (F.L.)}
% Current address and/or shared authorship
\firstnote{Current address: Affiliation 3}
\secondnote{These authors contributed equally to this work.}
\abstract{}
% Keywords
\keyword{keyword 1; keyword 2; keyword 3 (List three to ten pertinent keywords specific to the article; yet reasonably common within the subject discipline.)}
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setcounter{section}{-1} %% Remove this when starting to work on the template.
\section{Introduction}
\begin{specialtable}[H]
\widefigure
\caption{Summary of various datasets including free-view datasets, crowd-surveillance view and drone-view}
\label{table:table2}
\begin{tabular}{c c c c c c c}
\toprule
Name & Year & Attributes & Avg. Resolution & No. samples & No. instances & Avg. count \\ \midrule
\multicolumn{7}{c}{Free view datasets} \\ \midrule
NWPU-Crowd \cite{gao2020nwpu} & 2020 & Congested, Localization & 2191x3209 & 5,109 & 2,133,375 & 418 \\ \midrule
JHU-CROWD++ \cite{sindagi2019pushing} & 2020 & Congested & 1430x910 & 4,372 & 1,515,005 & 346 \\ \midrule
JHU-CROWD++ \cite{Idrees2018CompositionLF} & 2018 & Congested & 2013x2902 & 1,535 & 1,251,642 & 815 \\ \midrule
ShanghaiTech Part A \cite{liu2018ano_pred} & 2016 & Congested & 589x868 & 482 & 241,677 & 501 \\ \midrule
UCF\_CC\_50 \cite{6619173} & 2013 & Congested & 2101x2888 & 50 & 241,677 & 1,279 \\
\bottomrule
\end{tabular}
\end{specialtable}
\end{document}
我通常使用\begin{table*}
并且它运行良好,我想知道引入新命令如specialtable
、、parcol
...的好处或目的是什么。
但表格仍然向右移动
请注意,在 IEEE 模板中,使用
\begin{table*}
....
\end{table*}
因此问题与 MDPI 内部命令有关,例如\specialtable
答案1
更新,2022 年 11 月 1 日
与此同时,模板也变得更好了;现在,“宽”图形只需放入环境中adjustwidth
并使用\fulllength
尺寸即可:
\begin{figure}
\begin{adjustwidth}{-\extralength}{0cm}
\centering
\includegraphics[width=.95\fulllength]{panoramic_figure}
\end{adjustwidth}
\caption{This figure will be full-page.\label{fig:panoramic}}
\end{figure}
原始答案(2021 年 12 月)
这里的问题是 MDPI 模板很奇怪。要插入宽图,您必须执行以下步骤(取自template.tex
发行版中的文件):
\end{paracol}
% Example of a figure that spans the whole page width (the commands \widefigure and \begin{paracol}{2}, \linenumbers, and\switchcolumn need to be present). The same concept works for tables, too.
\begin{figure}[H]
\widefigure
\includegraphics[width=15 cm]{Figs/circuit-2}
\caption{This is a wide figure with the full prototype.\label{fig:my-main-fig}}
\end{figure}
\begin{paracol}{2}
\linenumbers
\switchcolumn
...\end{paracol}
等部分是强制的。模板\begin{paracol}{2}
在\begin{document}
命令中发出一个(您必须手动关闭由于图形太宽(在参考部分之前),因此要插入宽图形,您必须停止paracol
,插入图形(手动定位),然后重新启动环境。
我想象,改变figure
(table
或specialtable
,如模板中所建议的---测试它)然后放置一个tabularx
跨越整体\linewidth
将会给你想要的结果。
我本应以完全不同的方式组织模板。最后,它是一个单列模板,左侧有大量空白用于边距,当开始引用时,这些空白必须消失。这不是一个在 LaTeX 中容易复制的模板,但我认为 MDPI 使用的解决方案至少太脆弱了。
答案2
我猜,你喜欢获得这样的东西:
只是一些片段,如何设置你的表格。你的文档序言应该包含以下内容:
\usepackage{booktabs, makecell, tabularx}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\usepackage{siunitx}
和表体:
%\caption{Summary of various datasets including free-view datasets, crowd-surveillance view and drone-view}
\label{table:table2}
\sisetup{group-minimum-digits=4,
group-separator={,},
}
\small
\setlength\tabcolsep{4pt}
\begin{tabularx}{\linewidth}{@{} l c L
S[table-format=4.0,product-symbol = {{\times}}]
S[table-format=4.0]
S[table-format=7.0]
S[table-format=4.0] @{}}
\toprule
Name
& Year
& Attributes
& {\makecell{Average\\ Resolution}}
& {\makecell{No. \\ samples}}
& {\makecell{No.\\ instances}}
& {\makecell{Average\\ count}} \\
\midrule
\multicolumn{7}{c}{Free view datasets} \\ \midrule
NWPU-Crowd \cite{gao2020nwpu}
& 2020
& Congested, Localization
& \numproduct{2191x3209}
& 5 109
& 2 133 375
& 418 \\
\addlinespace
JHU-CROWD++ \cite{sindagi2019pushing}
& 2020
& Congested
& \numproduct{1430x910}\hphantom{,0}
& 4 372
& 1 515 005
& 346 \\
\addlinespace
JHU-CROWD++ \cite{Idrees2018CompositionLF}
& 2018
& Congested
& \numproduct{2013x2902}
& 1 535
& 1 251 642
& 815 \\
\addlinespace
ShanghaiTech Part A \cite{liu2018ano_pred}
& 2016
& Congested
& \numproduct{589x868}
& 482
& 241 677
& 501 \\
\addlinespace
UCF\_CC\_50 \cite{6619173}
& 2013
& Congested
& \numproduct{2101x2888}
& 50
& 241 677
& 1 279 \\
\bottomrule
\end{tabularx}
您需要将此表代码片段插入到您的位置,即您的代码片段所在位置。如果您希望在表中使用 MWE,则首先需要在问题中提供一个 MWE,我们可以在 Overleaf 帐户中对其进行测试,而不仅仅是代码片段。
答案3
万一您来这里寻找如何在 MDPI LYX 模板中使用宽表,请不要忽视 lyx 中的命令:\widetable可以在 ERL 中将其用在表格开头以生成宽表。还有另一个命令 \widefigure 可以对图形执行相同操作,并且它在模板中使用。