我想使用eLife 模板在 Overleaf 中查看补充材料。由于它很长,我需要添加章节编号,以便读者更轻松地浏览文档。
在 cls 文件中,切片的设置包括以下命令:
\setcounter{secnumdepth}{0}
我已经改为
\setcounter{secnumdepth}{3}
这包括章节编号,但章节编号和章节标题之间没有空格(因此看起来很丑,见图)
我在编译时还遇到两种类型的错误:
Missing number, treated as zero.
<to be read again>
!
l.123 ...m when used on the co-infection data set}
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
和
Illegal unit of measure (pt inserted).
<to be read again>
!
l.123 ...m when used on the co-infection data set}
Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, nd, nc, bp, or sp; but yours is a new one!
I'll assume that you meant to say pt, for printer's points.
To recover gracefully from this error, it's best to
delete the erroneous units; e.g., type `2' to delete
two letters. (See Chapter 27 of The TeXbook.)
我只知道如何使用 latex 编写文档,但我无法更改其格式和外观。因此,任何有关如何编辑 cls 文件以停止错误并改善外观的指导都会有所帮助。
要在 overleaf 中打开 eLife 模板并查看源代码,您可以按照以下步骤操作关联。
非常感谢!
答案1
eLife.cls
与...相关eLife
Overleaf 中的模板显示以下几行:
%
% section/subsection/paragraph set-up
%
\setcounter{secnumdepth}{0}
\RequirePackage[explicit]{titlesec}
\titleformat{\section}
{\color{eLifeMediumGrey}\Large\bfseries}
{\thesection}{}{#1}[]
\titleformat{\subsection}
{\large\bfseries}
{\thesubsection}{}{#1}[]
\titleformat{\subsubsection}
{\large}
{\thesubsubsection}{}{#1}[]
\titleformat{\paragraph}
{\color{eLifeMediumGrey}\large}
{\theparagraph}{}{#1}[]
\titlespacing*{\section}{0pc}{3ex \@plus4pt \@minus3pt}{0pt}
\titlespacing*{\subsection}{0pc}{2.5ex \@plus3pt \@minus2pt}{0pt}
\titlespacing*{\subsubsection}{0pc}{2ex \@plus2.5pt \@minus1.5pt}{0pt}
\titlespacing*{\paragraph}{0pc}{1.5ex \@plus2pt \@minus1pt}{0pt}
根据titlesec
文档中,命令中的第四个参数\titleformat
是节号与标题之间的距离。由于eLife
声明titleformat
命令的距离为空,因此即使增加secnumdepth
距离也会为 0。
您必须在所有这些\titleformat
命令的第四个参数中插入一些距离。仅举一个例子:
\titleformat{\section}
{\color{eLifeMediumGrey}\Large\bfseries}
{\thesection}{0.5em}{#1}[]