我正在尝试使用 makecell-package 来处理表格中的多行内容。这在标准 latex 类文章中效果很好。但是,使用 elsevier 的 cas-dc 包时,这不起作用。在底部,您可以找到一个最小示例。我收到(第一个)错误
Misplaced \noalign. \thead{First Heading} & \thead
此后还出现了很多类似的错误。
最小示例:
% !TeX program = lualatex
% !TEX encoding = UTF-8
% !TeX spellcheck = en_GB
\documentclass[a4paper,fleqn,english]{cas-dc}
\usepackage{babel}
\usepackage{fontspec}
\usepackage{tabularx}
\usepackage[output-decimal-marker={,}]{siunitx}
\usepackage{booktabs}
\usepackage{makecell}
\renewcommand\theadfont{\bfseries}
%%%%%%
\usepackage[backend=biber,style=numeric, citestyle=numeric]{biblatex}
\makeatletter
\newlength{\bibsep}{\@listi \global\bibsep\itemsep \global\advance\bibsep by\parsep}
\makeatother
% NEW END
\begin{document}
\let\WriteBookmarks\relax
\def\floatpagepagefraction{1}
\def\textpagefraction{.001}
\shorttitle{The CAS }
\shortauthors{Elvis et~al.}
\title [mode = title]{Quantum teleportation in the context of industry 4.0}
\author[1]{Elvis Presley}[auid=000,bioid=1]
\cormark[1]
% \fnmark[1]
\ead{[email protected]}
%\ead[url]{www.cvr.cc, [email protected]}
\credit{Software, Experiments}
\begin{abstract}
Quantum teleportation is a key technology for industry 4.0, 5G mobile communication and memristors. However, scientific journals with stupid latex templates waste the time of researchers. In this paper, the connection between these different research areas are discussed. For practical purposes, several blueprints for parameter optimisation are given.
\end{abstract}
%\begin{graphicalabstract}
%\includegraphics{figs/grabs.pdf}
%\end{graphicalabstract}
%\begin{highlights}
%\item Research highlights item 1
%\item Research highlights item 2
%\item Research highlights item 3
%\end{highlights}
\begin{keywords}
Latex \sep Quantum Teleportation \sep Industry 4.0
\end{keywords}
\maketitle
\begin{table*}[t]
\caption{My table}
\label{my_table}
\begin{tabular}{cc}
\toprule
% \textbf{First Heading} & \textbf{Second Heading} \\ % works
\thead{First Heading} & \thead{Second \\ Heading} \\ % does not work
\midrule
First cell & Second cell \\
\bottomrule
\end{tabular}
\end{table*}
\section{Appendix}
%Appendix sections are coded under \verb+\appendix+.
%\verb+\printcredits+ command is used after appendix sections to list
%author credit taxonomy contribution roles tagged using \verb+\credit+
%in frontmatter.
\printcredits
\end{document}
答案1
该软件包提供了替换和的nicematrix
命令,还允许使用\Block
\multicolumn
m\ultirow
\\
内部。
在这种情况下, \Block{}<\bfseries>{Second \\ Heading}
定义一个 1x1 单元格,其中包含两行粗体字体。
% !TeX program = lualatex
% !TEX encoding = UTF-8
% !TeX spellcheck = en_GB
\documentclass[a4paper,fleqn,english]{cas-dc}
\usepackage{babel}
\usepackage{fontspec}
\usepackage{tabularx}
\usepackage[output-decimal-marker={,}]{siunitx}
\usepackage{booktabs}
%\usepackage{makecell}
\usepackage{nicematrix} % added <<<<<<<<<<<<<<<<<<<<<<
\renewcommand\theadfont{\bfseries}
%%%%%%
\usepackage[backend=biber,style=numeric, citestyle=numeric]{biblatex}
\makeatletter
\newlength{\bibsep}{\@listi \global\bibsep\itemsep \global\advance\bibsep by\parsep}
\makeatother
% NEW END
\begin{document}
\let\WriteBookmarks\relax
\def\floatpagepagefraction{1}
\def\textpagefraction{.001}
\shorttitle{The CAS }
\shortauthors{Elvis et~al.}
\title [mode = title]{Quantum teleportation in the context of industry 4.0}
\author[1]{Elvis Presley}[auid=000,bioid=1]
\cormark[1]
% \fnmark[1]
\ead{[email protected]}
%\ead[url]{www.cvr.cc, [email protected]}
\credit{Software, Experiments}
\begin{abstract}
Quantum teleportation is a key technology for industry 4.0, 5G mobile communication and memristors. However, scientific journals with stupid latex templates waste the time of researchers. In this paper, the connection between these different research areas are discussed. For practical purposes, several blueprints for parameter optimisation are given.
\end{abstract}
%\begin{graphicalabstract}
%\includegraphics{figs/grabs.pdf}
%\end{graphicalabstract}
%\begin{highlights}
%\item Research highlights item 1
%\item Research highlights item 2
%\item Research highlights item 3
%\end{highlights}
\begin{keywords}
Latex \sep Quantum Teleportation \sep Industry 4.0
\end{keywords}
% \maketitle
\begin{table*}[t]
\caption{My table}
\label{my_table}
\begin{NiceTabular}{cc}% changed <<<<<<<<<<<<<<<<
\toprule
% \textbf{First Heading} & \textbf{Second Heading} \\ % works
\Block{}<\bfseries>{First Heading} & \Block{}<\bfseries>{Second \\ Heading} \\ % also works!!
\midrule
First cell & Second cell \\
\bottomrule
\end{NiceTabular}
\end{table*}
\section{Appendix}
%Appendix sections are coded under \verb+\appendix+.
%\verb+\printcredits+ command is used after appendix sections to list
%author credit taxonomy contribution roles tagged using \verb+\credit+
%in frontmatter.
\printcredits
\end{document}