我正在使用的模板在换行符后添加了一个空格行table
。
对于表格、标题,是否可以丢弃换行符后的空格,而我只想减少表格标题中的空格。
基本代码如下:
\documentclass[AMA,LATO1COL]{WileyNJD-v2}
\usepackage{tabularx, longtable, setspace}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\begin{document}
\title{A demonstration of the \LaTeX\ class file for Wiley NJD Journals\protect\thanks{This is an example for title footnote.}}
\section{Introduction}\label{sec1}
\begin{table}[htp!]
\centering
\singlespace
\begin{tabularx}{\textwidth /3 +10mm}{{L{1.3cm} @{~} C{1.7cm} @{~} C{3.6cm} }}
\toprule
Study & Some model & Storage \newline used for \newline data transfer \\
\midrule
A & Pay-per-task & Dummy cloud, Google Drive \\
\bottomrule
\end{tabularx}
\caption{Comparative table.}
\end{table}
\end{document}
- 可以从这里下载类文件(https://onlinelibrary.wiley.com/pb-assets/assets/10991476/AMA-stix_New-1658766862393.zip), 在下面:
ama/WileyNJD-v2.cls
:
或来自背面链接。
输出如下:
想要的输出:
答案1
setspace
和\singlespace
(但正确的命令是\singlespacing
根本不做任何事。为什么
tabularx
不使用X
列?为什么还要指定列宽,而 TeX 可以为您完成这一操作?
\pdfmapfile{../Lato-fonts/lato.map}
\RequirePackage{fix-cm}
\documentclass[AMA,LATO1COL]{WileyNJD-v2}
\usepackage{array}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
% for the first table
\newcommand{\reduce}{\linespread{0.8}\selectfont}
% for the second table
\newcommand{\splitcell}[1]{%
\linespread{0.8}\selectfont\begin{tabular}{@{}c@{}}#1\end{tabular}%
}
\begin{document}
\title{A demonstration of the \LaTeX\ class file for Wiley NJD
Journals\protect\thanks{This is an example for title footnote.}}
\section{Introduction}\label{sec1}
\begin{table}[htp!]
\centering
\begin{tabular}{L{1.3cm} @{~} C{1.7cm} @{~} C{3.6cm}}
\toprule
Study & Some model & \reduce Storage \newline used for \newline data transfer \\
\midrule
A & Pay-per-task & Dummy cloud, Google Drive \\
\bottomrule
\end{tabular}
\caption{Comparative table.}
\end{table}
\begin{table}[htp!]
\centering
\begin{tabular}{@{}lcc@{}}
\toprule
Study & Some model & \splitcell{Storage \\ used for \\ data transfer} \\
\midrule
A & Pay-per-task & Dummy cloud, Google Drive \\
\bottomrule
\end{tabular}
\caption{Comparative table.}
\end{table}
\end{document}
(前两行是为了使用模板提供的 Lato 字体。)
只有两行看起来更好。