我有以下乳胶代码:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Introduction}
\label{sec:introduction}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Motivation}
\label{sec:Motivation}
\subsection{Related work}
\label{sec:Related work}
magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clitaeeeeeeeeeee kasd gubergren, no sea takimata diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptuaeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeamet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clitaeeeeeeeeeee kasd gubergren, no sea takimata diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptuaeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeamet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clitaeeeeeeeeeee kasd gubergren, no sea takimata diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptuaeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeamet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clitaeeeeeeeeeee kasd gubergren, no sea takimata diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptuaeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeamet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet
\begin{table*}[H]
\centering
\begin{tabular}{|c|c|c|c|c|c|}
\hline
& \makecell{Critera 1 \\ control} & \makecell{Critera 2 \\ optimal control} & \makecell{Critera 3 \\ smart control heuristic} & \makecell{Comparison to optimal \\ and smart control} & \makecell{Use of training data \\from other buildings} \\
\hline
Author 1 et al., 2020 [1] & \cmark & \rule{0.2cm}{0.2cm} & & & \\
\hline
\end{tabular}
\caption{Comparison of relevant papers from the literature}
\label{tab:my_label}
\end{table*}
\subsection{Contribution}
\label{sec:Contribution}
与主文件
\documentclass[5p,times,twocolumn]{elsarticle}
\usepackage{physics}
\usepackage{tabularx}
\usepackage{siunitx}
\usepackage{xcolor}
\usepackage{hyperref}
\hypersetup{hidelinks}
\usepackage{csquotes}
\usepackage{amssymb}% http://ctan.org/pkg/amssymb
\usepackage{pifont}% http://ctan.org/pkg/pifont
\newcommand{\cmark}{\ding{51}}%
\newcommand{\xmark}{\ding{55}}%
\usepackage{acro}
\include{sections/00_acro}
\graphicspath{{figures/}}
\usepackage{lipsum}
\usepackage{booktabs}
\usepackage{float}
\usepackage{comment}
\usepackage{subcaption}
\usepackage{framed} % Framing content
\usepackage{multicol} % Multiple columns environment
\usepackage{nomencl} % Nomenclature package
\usepackage{makecell}
\journal{}
\begin{document}
\begin{frontmatter}
\title{Title}
\author[1]{Author 1}
\author[1]{Author 2}
\address[1]{Institue 1}
\begin{abstract}
\input{sections/00_abstract}
\end{abstract}
\begin{comment}
%%Graphical abstract
\begin{graphicalabstract}
\includegraphics{grabs}
\end{graphicalabstract}
%%Research highlights
\begin{highlights}
\item Research highlight 1
\item Research highlight 2
\end{highlights}
\end{comment}
\begin{keyword}
%% keywords here, in the form: keyword \sep keyword
keyword 1 \sep keyword 2 \sep keyword 3 \sep keyword 4 \sep keyword 5
%% PACS codes here, in the form: \PACS code \sep code
%\PACS 0000 \sep 1111
%% MSC codes here, in the form: \MSC code \sep code
%% or \MSC[2008] code \sep code (2000 is the default)
%MSC 0000 \sep 1111
\end{keyword}
\end{frontmatter}
\thispagestyle{empty} % Remove page number and header/footer on the first page
%% \linenumbers
%\input{sections/00_nomecl}
\input{sections/01_intro}
\input{sections/02_results}
\input{sections/03_conclusion}
%% If you have bibdatabase file and want bibtex to generate the
%% bibitems, please use
%%
\bibliographystyle{elsarticle-num}
\bibliography{refs}
%% else use the following coding to input the bibitems directly in the
%% TeX file.
% \begin{thebibliography}{00}
% %% \bibitem{label}
% %% Text of bibliographic item
% \bibitem{}
% \end{thebibliography}
\end{document}
\endinput
%%
%% End of file `elsarticle-template-num.tex'.
问题是使用时\begin{table*}[H]
表格消失了。当仅使用\begin{table*}
表格时,表格会显示在下一页的中间,这不是我想要的。我希望它显示在代码中定义的位置。所以我使用了 [H],但这不起作用。你知道我如何将表格放在定义的位置吗?
答案1
跨浮动环境的列table*
和figure*
不支持H
包的浮动选项float
。它们仅支持t
(p
和包裹dblfloatfix
还有)。此外,像和b
这样的跨列浮点数永远不会打印到当前页,但最早会打印到下一页。table*
figure*
说清楚一点:不能[H]
与 一起使用table*
。
对于一张小桌子,你确实可以用来\begin{table}[H]
放置它仅在这里。但是,由于您的表格很宽(甚至比文本区域还宽),我建议使用:
\begin{table*}
\centering
\begin{tabular}{|c|c|c|c|c|c|}
\hline
& \makecell{Critera 1 \\ control} & \makecell{Critera 2 \\ optimal control} & \makecell{Critera 3 \\ smart control heuristic} & \makecell{Comparison to optimal \\ and smart control} & \makecell{Use of training data \\from other buildings} \\
\hline
Author 1 et al., 2020 [1] & \cmark & \rule{0.2cm}{0.2cm} & & & \\
\hline
\end{tabular}
\caption{Comparison of relevant papers from the literature}
\label{tab:my_label}
\end{table*}
或者使其适合文本区域宽度:
\begin{table*}
\centering
\begin{tabular}{|c|c|c|c|c|c|}
\hline
& \makecell{Critera 1 \\ control} & \makecell{Critera 2 \\ optimal
control} & \makecell{Critera 3 \\ smart control heuristic} &
\makecell{Comparison to \\ optimal \\ and smart control} & \makecell{Use of training data \\from other buildings} \\
\hline
Author 1 et al., 2020 [1] & \cmark & \rule{0.2cm}{0.2cm} & & & \\
\hline
\end{tabular}
\caption{Comparison of relevant papers from the literature}
\label{tab:my_label}
\end{table*}
添加更多文本后,它应该打印在下一页的顶部。
并且不要太担心图表的确切位置。出版商可能会更改它们。
但是,如果您坚持手动放置表格,则必须手动完成整个分页,例如:
\documentclass[5p,times,twocolumn]{elsarticle}
\usepackage{physics}
\usepackage{tabularx}
\usepackage{siunitx}
\usepackage{xcolor}
\usepackage{hyperref}
\hypersetup{hidelinks}
\usepackage{csquotes}
\usepackage{amssymb}% http://ctan.org/pkg/amssymb
\usepackage{pifont}% http://ctan.org/pkg/pifont
\newcommand{\cmark}{\ding{51}}%
\newcommand{\xmark}{\ding{55}}%
\usepackage{acro}
%\include{sections/00_acro}
\graphicspath{{figures/}}
\usepackage{lipsum}
\usepackage{booktabs}
\usepackage{float}
\usepackage{comment}
\usepackage{subcaption}
\usepackage{framed} % Framing content
\usepackage{multicol} % Multiple columns environment
\usepackage{nomencl} % Nomenclature package
\usepackage{makecell}
\usepackage{mwe}% for demonstration only
\journal{}
\begin{document}
\begin{frontmatter}
\title{Title}
\author[1]{Author 1}
\author[1]{Author 2}
\address[1]{Institue 1}
\begin{abstract}
%\input{sections/00_abstract}
\end{abstract}
\begin{comment}
%%Graphical abstract
\begin{graphicalabstract}
\includegraphics{grabs}
\end{graphicalabstract}
%%Research highlights
\begin{highlights}
\item Research highlight 1
\item Research highlight 2
\end{highlights}
\end{comment}
\begin{keyword}
%% keywords here, in the form: keyword \sep keyword
keyword 1 \sep keyword 2 \sep keyword 3 \sep keyword 4 \sep keyword 5
%% PACS codes here, in the form: \PACS code \sep code
%\PACS 0000 \sep 1111
%% MSC codes here, in the form: \MSC code \sep code
%% or \MSC[2008] code \sep code (2000 is the default)
%MSC 0000 \sep 1111
\end{keyword}
\end{frontmatter}
\thispagestyle{empty} % Remove page number and header/footer on the first page
%% \linenumbers
%\input{sections/00_nomecl}
%\input{sections/01_intro}
%\input{sections/02_results}
%\input{sections/03_conclusion}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Introduction}
\label{sec:introduction}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Motivation}
\label{sec:Motivation}
\subsection{Related work}
\label{sec:Related work}
magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clitaeeeeeeeeeee kasd gubergren, no sea takimata diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptuaeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeamet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clitaeeeeeeeeeee kasd gubergren, no sea takimata diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptuaeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeamet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clitaeeeeeeeeeee kasd gubergren, no sea takimata diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptuaeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeamet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clitaeeeeeeeeeee kasd gubergren, no sea takimata diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptuaeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeamet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet
\begin{table}[H]
\begin{minipage}{\textwidth}
\centering
\begin{tabular}{|c|c|c|c|c|c|}
\hline
& \makecell{Critera 1 \\ control} & \makecell{Critera 2 \\ optimal
control} & \makecell{Critera 3 \\ smart control heuristic} &
\makecell{Comparison to \\ optimal \\ and smart control} & \makecell{Use of training data \\from other buildings} \\
\hline
Author 1 et al., 2020 [1] & \cmark & \rule{0.2cm}{0.2cm} & & & \\
\hline
\end{tabular}
\caption{Comparison of relevant papers from the literature}
\label{tab:my_label}
\end{minipage}
\end{table}
\newpage
\subsection{Contribution}
\label{sec:Contribution}
\Blindtext[2]
\parfillskip0pt % hack for invisible par
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Etiam lobortis facilisis sem. Nullam nec mi et neque pharetra
sollicitudin. Praesent imperdiet mi nec ante. Donec ullamcorper, felis non
sodales commodo, lectus velit ultrices augue, a dignissim nibh lectus
placerat pede. Vivamus nunc nunc, molestie ut, ultricies vel, semper in,
velit. Ut porttitor. Praesent
\newpage\parfillskip 0pt plus 1fil % revert hack after new page
\noindent% part of hack for invisible par
in sapien. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Duis
fringilla tristique neque. Sed interdum libero ut metus. Pellentesque
placerat. Nam rutrum augue a leo. Morbi sed elit sit amet ante lobortis
sollicitudin. Praesent blandit blandit mauris. Praesent lectus tellus, aliquet
aliquam, luctus a, egestas a, turpis. Mauris lacinia lorem sit amet
ipsum. Nunc quis urna dictum turpis accumsan semper.
\Blindtext[7]
%% If you have bibdatabase file and want bibtex to generate the
%% bibitems, please use
%%
\bibliographystyle{elsarticle-num}
\bibliography{refs}
%% else use the following coding to input the bibitems directly in the
%% TeX file.
% \begin{thebibliography}{00}
% %% \bibitem{label}
% %% Text of bibliographic item
% \bibitem{}
% \end{thebibliography}
\end{document}
\endinput
%%
%% End of file `elsarticle-template-num.tex'.
我会不是建议这样做!
另一个建议是使用包裹midfloat
和环境strip
。你仍然不能使用\begin{float*}[H]…\end{float*}
inside strip
,并且\begin{float}[H]…\end{float}
insidestrip
也不推荐并且通常不起作用。但你可以strip
使用\captionof
:
\begin{strip}
\begin{tabular}{|c|c|c|c|c|c|}
\hline
& \makecell{Critera 1 \\ control} & \makecell{Critera 2 \\ optimal
control} & \makecell{Critera 3 \\ smart control heuristic} &
\makecell{Comparison to \\ optimal \\ and smart control} & \makecell{Use of training data \\from other buildings} \\
\hline
Author 1 et al., 2020 [1] & \cmark & \rule{0.2cm}{0.2cm} & & & \\
\hline
\end{tabular}
\captionof{table}{Comparison of relevant papers from the literature}
\label{tab:my_label}
\end{strip}
但在我的测试中,第二列的分栏太早了: