杂志科学报告提供模板Overleaf.com。 使用化学宏指令包将导致错误。
错误是
我们应该如何使用化学宏指令包装科学报告我发现化学宏指令包会导致许多模板出现问题。
所有内容都可以通过该链接查看,但我已将其发布在这里。wlscirep是
%
% An unofficial LaTeX class for Scientific Report articles.
%
% Copyright Overleaf (WriteLaTeX) 2016.
%
% Based on the SelfArx document class.
%
\NeedsTeXFormat{LaTeX2e}
% \ProvidesClass{wlscirep}[18/03/2016, v1.1]
% \ProvidesClass{wlscirep}[03/11/2016, v1.2]
% \ProvidesClass{wlscirep}[27/02/2017, v1.3]
\ProvidesClass{wlscirep}[08/08/2020, v1.4]
\RequirePackage[utf8]{inputenc}
\RequirePackage[english]{babel}
\RequirePackage{ifthen}
\RequirePackage{calc}
\AtEndOfClass{\RequirePackage{microtype}}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions*
\LoadClass{article}
\RequirePackage{amsmath,amsfonts,amssymb}
\RequirePackage{mathptmx} % Loads the Times-Roman Math Fonts
\RequirePackage{helvet}
\RequirePackage{courier}
\RequirePackage{ifpdf}
\RequirePackage{graphicx,xcolor}
\RequirePackage{booktabs}
% Settings for the author block
\RequirePackage{authblk}
\setlength{\affilsep}{1.5em}
\renewcommand\Authfont{\fontsize{12}{12}\usefont{OT1}{phv}{b}{n}}
\renewcommand\Affilfont{\fontsize{10}{12}\usefont{OT1}{phv}{m}{n}}
\RequirePackage[left=2cm,%
right=2cm,%
top=2.25cm,%
bottom=2.25cm,%
headheight=12pt,%
letterpaper]{geometry}%
\RequirePackage[labelfont={bf,sf},%
labelsep=period,%
justification=raggedright]{caption}
\RequirePackage[colorlinks=true, allcolors=blue]{hyperref}
% Set up of the bibliography style
% \RequirePackage[numbers]{natbib}
\RequirePackage[superscript,biblabel,nomove]{cite}
%% Nov 3, 2016: Support DOI
\bibliographystyle{naturemag-doi}
%
% headers and footers
%
\RequirePackage{fancyhdr} % custom headers/footers
\RequirePackage{lastpage} % Number of pages in the document
\pagestyle{fancy} % Enables the custom headers/footers
% Headers
\lhead{}%
\chead{}%
\rhead{}%
% Footers
\lfoot{}%
\cfoot{}%
\rfoot{\small\sffamily\bfseries\thepage/\pageref{LastPage}}%
\renewcommand{\headrulewidth}{0pt}% % No header rule
\renewcommand{\footrulewidth}{0pt}% % No footer rule
%
% section/subsection/paragraph set-up
%
\RequirePackage[explicit]{titlesec}
\titleformat{\section}
{\color{color1}\large\sffamily\bfseries}
{\thesection}
{0.5em}
{#1}
[]
\titleformat{name=\section,numberless}
{\color{color1}\large\sffamily\bfseries}
{}
{0em}
{#1}
[]
\titleformat{\subsection}
{\sffamily\bfseries}
{\thesubsection}
{0.5em}
{#1}
[]
\titleformat{\subsubsection}
{\sffamily\small\bfseries\itshape}
{\thesubsubsection}
{0.5em}
{#1}
[]
\titleformat{\paragraph}[runin]
{\sffamily\small\bfseries}
{}
{0em}
{#1}
\titlespacing*{\section}{0pc}{3ex \@plus4pt \@minus3pt}{5pt}
\titlespacing*{\subsection}{0pc}{2.5ex \@plus3pt \@minus2pt}{0pt}
\titlespacing*{\subsubsection}{0pc}{2ex \@plus2.5pt \@minus1.5pt}{0pt}
\titlespacing*{\paragraph}{0pc}{1.5ex \@plus2pt \@minus1pt}{10pt}
%
% tableofcontents set-up
%
\usepackage{titletoc}
\contentsmargin{0cm}
\titlecontents{section}[\tocsep]
{\addvspace{4pt}\small\bfseries\sffamily}
{\contentslabel[\thecontentslabel]{\tocsep}}
{}
{\hfill\thecontentspage}
[]
\titlecontents{subsection}[\tocsep]
{\addvspace{2pt}\small\sffamily}
{\contentslabel[\thecontentslabel]{\tocsep}}
{}
{\ \titlerule*[.5pc]{.}\ \thecontentspage}
[]
\titlecontents*{subsubsection}[\tocsep]
{\footnotesize\sffamily}
{}
{}
{}
[\ \textbullet\ ]
\RequirePackage{enumitem}
%\setlist{nolistsep} % Uncomment to remove spacing between items in lists (enumerate, itemize)
% Remove brackets from numbering in List of References
\renewcommand{\@biblabel}[1]{\bfseries\color{color1}#1.}
%
% article meta data
%
\newcommand{\keywords}[1]{\def\@keywords{#1}}
\def\xabstract{abstract}
\long\def\abstract#1\end#2{\def\two{#2}\ifx\two\xabstract
\long\gdef\theabstract{\ignorespaces#1}
\def\go{\end{abstract}}\else
\typeout{^^J^^J PLEASE DO NOT USE ANY \string\begin\space \string\end^^J
COMMANDS WITHIN ABSTRACT^^J^^J}#1\end{#2}
\gdef\theabstract{\vskip12pt BADLY FORMED ABSTRACT: PLEASE DO
NOT USE {\tt\string\begin...\string\end} COMMANDS WITHIN
THE ABSTRACT\vskip12pt}\let\go\relax\fi
\go}
%
% custom title page
%
\renewcommand{\@maketitle}{%
{%
\thispagestyle{empty}%
\vskip-36pt%
{\raggedright\sffamily\bfseries\fontsize{20}{25}\selectfont \@title\par}%
\vskip10pt
{\raggedright\sffamily\fontsize{12}{16}\selectfont \@author\par}
\vskip18pt%
{%
\noindent
{\parbox{\dimexpr\linewidth-2\fboxsep\relax}{\color{color1}\large\sffamily\textbf{ABSTRACT}}}
}%
\vskip10pt
{%
\noindent
\colorbox{color2}{%
\parbox{\dimexpr\linewidth-2\fboxsep\relax}{%
\sffamily\small\textbf\\\theabstract
}%
}%
% \vskip18pt%
% \noindent
% \parbox{\dimexpr\linewidth-2\fboxsep\relax}{%
% {\color{color1}\keywordname\hspace*{1em}} \@keywords%
%}%
}%
\vskip25pt%
}%
}%
%-----------------------------------------------
\setlength{\columnsep}{0.55cm} % Distance between the two columns of text
\setlength{\fboxrule}{0.75pt} % Width of the border around the abstract
\definecolor{color1}{RGB}{0,0,0} % Color of section headings
\definecolor{color2}{gray}{1} % Color of the box behind the abstract
\newcommand{\keywordname}{Keywords:} % Defines the keywords heading name
\newlength{\tocsep}
\setlength\tocsep{1.5pc} % Sets the indentation of the sections in the table of contents
\setcounter{tocdepth}{3} % Show only three levels in the table of contents section: sections, subsections and subsubsections
\usepackage{lipsum} % Required to insert dummy text
%-----------------------------------------------
\let\oldbibliography\thebibliography
\renewcommand{\thebibliography}[1]{%
\addcontentsline{toc}{section}{\hspace*{-\tocsep}\refname}%
\oldbibliography{#1}%
\setlength\itemsep{0pt}%
}
%% Automatically abbreviate journal names
\RequirePackage{jabbrv}
主要的.tex是
\documentclass[fleqn,10pt]{wlscirep}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{chemmacros}
\title{Scientific Reports Title to see here}
\author[1,*]{Alice Author}
\author[2]{Bob Author}
\author[1,2,+]{Christine Author}
\author[2,+]{Derek Author}
\affil[1]{Affiliation, department, city, postcode, country}
\affil[2]{Affiliation, department, city, postcode, country}
\affil[*]{[email protected]}
\affil[+]{these authors contributed equally to this work}
%\keywords{Keyword1, Keyword2, Keyword3}
\begin{abstract}
Example Abstract. Abstract must not include subheadings or citations. Example Abstract. Abstract must not include subheadings or citations. Example Abstract. Abstract must not include subheadings or citations. Example Abstract. Abstract must not include subheadings or citations. Example Abstract. Abstract must not include subheadings or citations. Example Abstract. Abstract must not include subheadings or citations. Example Abstract. Abstract must not include subheadings or citations. Example Abstract. Abstract must not include subheadings or citations.
\end{abstract}
\begin{document}
\flushbottom
\maketitle
% * <[email protected]> 2015-02-09T12:07:31.197Z:
%
% Click the title above to edit the author information and abstract
%
\thispagestyle{empty}
\noindent Please note: Abbreviations should be introduced at the first mention in the main text – no abbreviations lists. Suggested structure of main text (not enforced) is provided below.
\section*{Introduction}
The Introduction section, of referenced text\cite{Figueredo:2009dg} expands on the background of the work (some overlap with the Abstract is acceptable). The introduction should not include subheadings.
\section*{Results}
Up to three levels of \textbf{subheading} are permitted. Subheadings should not be numbered.
\subsection*{Subsection}
Example text under a subsection. Bulleted lists may be used where appropriate, e.g.
\begin{itemize}
\item First item
\item Second item
\end{itemize}
\subsubsection*{Third-level section}
Topical subheadings are allowed.
\section*{Discussion}
The Discussion should be succinct and must not contain subheadings.
\section*{Methods}
Topical subheadings are allowed. Authors must ensure that their Methods section includes adequate experimental and characterization data necessary for others in the field to reproduce their work.
\bibliography{sample}
\noindent LaTeX formats citations and references automatically using the bibliography records in your .bib file, which you can edit via the project menu. Use the cite command for an inline citation, e.g. \cite{Hao:gidmaps:2014}.
For data citations of datasets uploaded to e.g. \emph{figshare}, please use the \verb|howpublished| option in the bib entry to specify the platform and the link, as in the \verb|Hao:gidmaps:2014| example in the sample bibliography file.
\section*{Acknowledgements (not compulsory)}
Acknowledgements should be brief, and should not include thanks to anonymous referees and editors, or effusive comments. Grant or contribution numbers may be acknowledged.
\section*{Author contributions statement}
Must include all authors, identified by initials, for example:
A.A. conceived the experiment(s), A.A. and B.A. conducted the experiment(s), C.A. and D.A. analysed the results. All authors reviewed the manuscript.
\section*{Additional information}
To include, in this order: \textbf{Accession codes} (where applicable); \textbf{Competing interests} (mandatory statement).
The corresponding author is responsible for submitting a \href{http://www.nature.com/srep/policies/index.html#competing}{competing interests statement} on behalf of all authors of the paper. This statement must be included in the submitted article file.
\begin{figure}[ht]
\centering
\includegraphics[width=\linewidth]{stream}
\caption{Legend (350 words max). Example legend text.}
\label{fig:stream}
\end{figure}
\begin{table}[ht]
\centering
\begin{tabular}{|l|l|l|}
\hline
Condition & n & p \\
\hline
A & 5 & 0.1 \\
\hline
B & 10 & 0.01 \\
\hline
\end{tabular}
\caption{\label{tab:example}Legend (350 words max). Example legend text.}
\end{table}
Figures and tables can be referenced in LaTeX using the ref command, e.g. Figure \ref{fig:stream} and Table \ref{tab:example}.
\end{document}
的内容jabbrv.sty是
%% 2018_02_07 - Modifications of Marie-Jean Thoraval ([email protected]):
%% Suppress the end period after non-abbreviated journal titles.
%%
%% Copyright 2010 Erich Hoover
%% E-mail: [email protected]
%%
%% =============================================
%% IMPORTANT NOTICE:
%%
%% This work may be distributed and/or modified under the conditions
%% of the LaTeX Project Public License, either version 1.3c of this
%% license or (at your option) any later version.
%% The latest version of this license is available at
%% http://www.latex-project.org/lppl.txt
%% =============================================
%%
%% This package provides the "\JournalTitle{<title>}" command, where
%% "<title>" is a journal title that you wish to have automatically
%% abbreviated. For example,
%% \JournalTitle{Journal of the Optical Society of America}
%% will be replaced to read
%% J. Opt. Soc. Am.
%%
%% The default behavior of this package is to place a period after
%% each abbreviation. For publications that require period-less
%% abbreviations simply include the package option "noperiod":
%% \usepackage[noperiod]{jabbrv}
%%
%% The default behavior of this package is to not abbreviate a
%% journal title that only contains one word. You can disable this
%% behavior (still abbreviate one word titles) by including the
%% "oneword" package option:
%% \usepackage[oneword]{jabbrv}
%%
%% This package also ignores undefined abbreviations (does not
%% abbreviate them) by default. In order to make sure that all the
%% words you expect to be abbreviated are actually abbreviated then
%% include the "warnundef" option:
%% \usepackage[warnundef]{jabbrv}
%% Please note that this option outputs a LaTeX warning for each
%% title word that does not have an abbreviation, possibly resulting
%% in a large number of warnings in the output log.
%%
%% To change the language used for the set of abbreviations (english
%% by default), use the ``lang=<value>'' option with the Unix
%% language code for <value>; for example:
%% \usepackage[lang=es]{jabbrv}
%% sets the abbreviation language to Spanish.
%%
%% In order to add customize abbreviations this package provides
%% three additional commands: \DefineJournalAbbreviation,
%% \DefineJournalPartialAbbreviation and \DefineSpuriousJournalWord.
%% \DefineSpuriousJournalWord simply takes a single case-sensitive
%% parameter, this parameter will be added to the list of words to
%% completely remove in the output. \DefineJournalAbbreviation takes
%% two parameters, the first parameter is the case-sensitive word to
%% abbreviate and the second parameter is the actual abbreviation,
%% for example:
%% \DefineJournalAbbreviation{Journal}{J}
%% \DefineJournalPartialAbbreviation takes two
%% parameters juts like \DefineJournalAbbreviation; however,
%% \DefineJournalPartialAbbreviation creates an entry that matches
%% any title that begins with the first parameter, for example:
%% \DefineJournalPartialAbbreviation{Communica}{Commun}
%% will match longer words such as ``Communications'' and
%% abbreviate any such word with the given abbreviated form. Please
%% note that care should be taken with creating custom partial
%% abbreviations, as such abbreviations that are not approved by
%% the ISSN may match unintended title words.
%%
%% Please note that this package is still very much in the beta
%% stage, while it should work just fine it has not yet been
%% extensively tested.
%%
\NeedsTeXFormat{LaTeX2e}[1995/06/01]
\ProvidesPackage{jabbrv}[2010/08/18 v0.2
Automatic Journal Title Abbreviation Package]
\RequirePackage{kvoptions}[2006/08/17]
% Special if statement for ensuring there are no double-spaces in the resulting entries
\newif\if@gobble@space@
% Special if for warning when an abbreviation is not defined
\newif\if@warn@noabbrv@ \@warn@noabbrv@false
% Special if for if a partial abbreviation match was found
\newif\if@partial@found@
% Special if for handling exceptions to the abbreviation rules
\newif\if@abbreviate@journal@
% Special if for abbreviating when a title only contains one word
\newif\if@jabbrv@abbrv@one@word@title@ \@jabbrv@abbrv@one@word@title@false
\def\jabbrv@one@word@title{%
\if@jabbrv@abbrv@one@word@title@%
\journal@output@abbrv%
\else%
\the\temp@journal@text%
\fi%
}
% Special definition for the period so that a double-period doesn't result at the end of the entry
\newif\if@show@period@ \@show@period@true
\newif\if@end@period@
\newif\if@no@space@ \@no@space@false
\newif\if@special@period@
\def\journal@abbrv@period@noperiod{\global\@end@period@true}
\def\journal@abbrv@period@period{%
\if@show@period@%
.%
\fi%
}
\def\journal@abbrv@period{%
\ifx\journal@char@stop\@jrnl@temp@char%
\journal@abbrv@period@noperiod%
\else%
\ifx.\@jrnl@temp@char%
\else%
\journal@abbrv@period@period%
\fi%
\fi%
}
% Custom ``comma below'' command (use only if \textcommabelow is defined):
\global\let\jabbrv@textcommabelow=\textcommabelow
\gdef\J@C{%
\expandafter\ifx\csname jabbrv@textcommabelow\endcsname\relax%
\def\jabbrv@comma{}%
\else%
\def\jabbrv@comma{\jabbrv@textcommabelow}%
\fi%
\jabbrv@comma%
}
% Redefinitions for diacritical marks so that they can be processed as command names
\def\jabbrv@redefine@diacritic{%
\def\`{@GRAVEACCENT@}%
\def\'{@ACUTEACCENT@}%
\def\^{@CIRCUMFLEX@}%
\def\"{@UMLAUT@}%
\def\={@MACRONACCENT@}%
\def\~{@TILDE@}%
\def\aa{@RINGa@}%
\def\AA{@RINGA@}%
\def\ae{@aeDIPHTHONG@}%
\def\AE{@AEDIPHTHONG@}%
\def\c{@CEDILLA@}%
\def\o{@SLASHo@}%
\def\O{@SLASHO@}%
\def\oe{@oeDIPHTHONG@}%
\def\OE{@OEDIPHTHONG@}%
\def\ss{@ESZETT@}%
\def\t{@TIE@}%
\def\v{@CARON@}%
\def\&{@AND@}%
% Custom \J@C may be called directly or defined through \textcommabelow:
\def\J@C{@JABBRVCOMMA@}%
\let\textcommabelow=\J@C%
}
\global\let\jabbrv@graveaccent=\`
\global\let\jabbrv@accuteaccent=\'
\global\let\jabbrv@circumflex=\^
\global\let\jabbrv@umlaut=\"
\global\let\jabbrv@macronaccent=\=
\global\let\jabbrv@tilde=\~
\global\let\jabbrv@ringa=\aa
\global\let\jabbrv@ringA=\AA
\global\let\jabbrv@aediphthong=\ae
\global\let\jabbrv@AEdiphthong=\AE
\global\let\jabbrv@cedilla=\c
\global\let\jabbrv@slasho=\o
\global\let\jabbrv@slashO=\O
\global\let\jabbrv@oediphthong=\oe
\global\let\jabbrv@OEdiphthong=\OE
\global\let\jabbrv@eszett=\ss
\global\let\jabbrv@tie=\t
\global\let\jabbrv@caron=\v
\global\let\jabbrv@and=\&
% Custom:
\global\let\jabbrv@comma=\J@C
% When outputing abbreviations or un-abbreviated words the diacritic match
% list should be disabled (return things to normal):
\def\jabbrv@normal@diacritic{%
\let\`=\jabbrv@graveaccent%
\let\'=\jabbrv@accuteaccent%
\let\^=\jabbrv@circumflex%
\let\"=\jabbrv@umlaut%
\let\==\jabbrv@macronaccent%
\let\~=\jabbrv@tilde%
\let\c=\jabbrv@cedilla%
\let\aa=\jabbrv@ringa%
\let\AA=\jabbrv@ringA%
\let\ae=\jabbrv@aediphthong%
\let\AE=\jabbrv@AEdiphthong%
\let\o=\jabbrv@slasho%
\let\O=\jabbrv@slashO%
\let\oe=\jabbrv@oediphthong%
\let\OE=\jabbrv@OEdiphthong%
\let\ss=\jabbrv@eszett%
\let\t=\jabbrv@tie%
\let\v=\jabbrv@caron%
\let\&=\jabbrv@and%
% Custom \J@C may be called directly or defined through \textcommabelow:
\let\J@C=\jabbrv@comma%
\let\textcommabelow=\jabbrv@comma%
}
% Define Common Abbreviations (see language definition files for the list):
\providecommand{\DefineJournalAbbreviation}[2]{
\begingroup
\jabbrv@redefine@diacritic
\expandafter\gdef\csname journal@abbrv@#1\endcsname{%
\begingroup%
\jabbrv@normal@diacritic%
#2%
\endgroup%
\@gobble@space@false%
\journal@abbrv@period%
}
\endgroup
}
% Define specific journals that are exceptions:
\providecommand{\DefineJournalException}[2]{
\begingroup
\jabbrv@redefine@diacritic
\expandafter\gdef\csname journal@exception@#1\endcsname{%
\begingroup%
\jabbrv@normal@diacritic%
#2%
\endgroup%
\@gobble@space@false%
}
\endgroup
}
% Define Common Partial Abbreviations (see language definition files for the list):
\providecommand{\DefineJournalPartialAbbreviation}[2]{
\begingroup
\jabbrv@redefine@diacritic
\expandafter\gdef\csname journal@partial@abbrv@#1\endcsname{%
\begingroup%
\jabbrv@normal@diacritic%
#2%
\endgroup%
\@gobble@space@false%
\journal@abbrv@period%
}
\endgroup
}
% Define Suprious Word Removal:
\providecommand{\DefineSpuriousJournalWord}[1]{%
\expandafter\def\csname journal@abbrv@#1\endcsname{\journal@output@space}%
}
\DefineSpuriousJournalWord{of}
\DefineSpuriousJournalWord{in}
\DefineSpuriousJournalWord{and}
\DefineSpuriousJournalWord{the}
% Handle the rather generic \futurelet code:
\newtoks\temp@journal@text
\newtoks\temp@journal@text@
\temp@journal@text{}
\def\journal@char@stop{}
\def\@journal@space{\afterassignment\@journal@space@\let\@tempa= }
\def\@journal@space@{\journal@char@loop}
\def\@journal@gobble#1{\journal@char@loop}
\def\@journal@character#1{%
\temp@journal@text\expandafter{\the\temp@journal@text#1}%
\journal@char@loop%
}
\def\journal@char@loop{%
\futurelet\@jrnl@temp@char%
\journal@char@loop@%
}
% Code for finding the length of a string:
\newcounter{jabbrv@strlen@count}
\def\jabbrv@strlen@stop{}
\def\jabbrv@strlen#1{%
\setcounter{jabbrv@strlen@count}{1}%
\expandafter\jabbrv@strlen@ #1\jabbrv@strlen@stop%
}
\def\jabbrv@strlen@#1{%
\@ifnextchar\jabbrv@strlen@stop%
{}%
{%
\addtocounter{jabbrv@strlen@count}{1}%
\expandafter\jabbrv@strlen@%
}%
}
% The following ``for loop'' command is a convenience function for going over the word's characters
\newcommand{\jabbrv@for@loop}[5][1]{%
\setcounter{#2}{#3}%
\ifnum#4\relax%
#5%
\addtocounter{#2}{#1}%
\jabbrv@for@loop[#1]{#2}{\value{#2}}{#4}{#5}%
\fi%
}
% Gobble a given number of characters off the end of a string
\newcounter{jabbrv@gobble@temp}
\def\jabbrv@gobble@stop{}
\def\jabbrv@gobble@ending#1#2#3{%
\setcounter{jabbrv@gobble@temp}{#3}%
\addtocounter{jabbrv@gobble@temp}{-#2}%
\temp@journal@text@{}%
\expandafter\jabbrv@gobble@ending@ #1\jabbrv@gobble@stop%
}
\def\jabbrv@gobble@ending@#1{%
\expandafter\ifnum\value{jabbrv@gobble@temp} > 0\relax%
\temp@journal@text@\expandafter{\the\temp@journal@text@#1}%
\fi%
\@ifnextchar\jabbrv@gobble@stop%
{}%
{%
\addtocounter{jabbrv@gobble@temp}{-1}%
\expandafter\jabbrv@gobble@ending@%
}%
}
% Find partial title word matches
\newcounter{jabbrv@loop@i}
\newcounter{jabbrv@loop@max}
\def\journal@output@abbrv@partial{%
\@partial@found@false%
\jabbrv@strlen{\the\temp@journal@text}%
\setcounter{jabbrv@loop@max}{\value{jabbrv@strlen@count}}%
\jabbrv@for@loop{jabbrv@loop@i}{0}{\value{jabbrv@loop@i} < \value{jabbrv@loop@max}}{%
\jabbrv@gobble@ending{\the\temp@journal@text}{\value{jabbrv@loop@i}}{\value{jabbrv@loop@max}}%
\expandafter\ifx\csname journal@partial@abbrv@\the\temp@journal@text@\endcsname\relax%
% No known partial abbreviation
\else%
\@partial@found@true%
\csname journal@partial@abbrv@\the\temp@journal@text@\endcsname%
\setcounter{jabbrv@loop@i}{\value{jabbrv@loop@max}}%
\fi%
}%
}
% Output single spaces even when there are multiple spaces together
\def\journal@output@space{%
\if@gobble@space@%
\else%
\space%
\@gobble@space@true%
\fi%
}
% Output the correct abbreviation for a title word
\def\journal@output@abbrv{%
\if@special@period@%
\journal@abbrv@period%
\else%
\if@no@space@%
.% There was a user-entered period with no space after it
\else%
\journal@output@space%
\fi%
\expandafter\ifx\csname journal@abbrv@\the\temp@journal@text\endcsname\relax%
\journal@output@abbrv@partial%
\if@partial@found@%
% Partial match was output, do nothing.
\else%
% No known abbreviation
\if@warn@noabbrv@%
\@latex@warning{No abbreviation defined for `\the\temp@journal@text'}%
\fi%
\begingroup%
\jabbrv@normal@diacritic%
\the\temp@journal@text%
\endgroup%
\global\@end@period@false % reset the "need a period at the end" indicator
\@gobble@space@false%
\fi%
\else%
% Replace with abbreviation
\expandafter\csname journal@abbrv@\the\temp@journal@text\endcsname%
\fi%
\fi%
\@special@period@false%
}
% Allow us to keep track of the number of words in an abbreviation so that when there's only one we can choose not to abbreviate
\newcounter{jabbrv@word@count}
\def\jabbrv@reset@word@count{%
\setcounter{jabbrv@word@count}{0}%
}
\def\jabbrv@step@word@count{%
\addtocounter{jabbrv@word@count}{1}%
}
% Loop through the \futurelet characters finding title words to replace
\def\journal@char@loop@{%
% The space character is the ``special token'' - use this character to find
% title words to abbreviate
\ifx \@sptoken\@jrnl@temp@char%
\journal@output@abbrv%
\jabbrv@step@word@count%
\temp@journal@text{}%
\@no@space@false%
\let\@tempa\@journal@space%
\else%
% \journal@char@stop is specially defined so this routine knows
% when the entire text has been read (where to stop)
\ifx \journal@char@stop\@jrnl@temp@char%
\expandafter\ifnum\value{jabbrv@word@count} > 0\relax%
\journal@output@abbrv%
\else%
\jabbrv@one@word@title%
\fi%
\let\@tempa\@gobble%
\else%
% Measure all other characters and include them in the title word
\@special@period@false%
\let\@tempa\@journal@character%
\fi%
\fi%
\@tempa%
}
% Eat a period at the end of the entry if the next character is also a period
\def\@jrnl@eat@period#1{%
\if@end@period@%
\ifx.#1\else%
\ifx\newblock#1%
.\newblock%
\else%
\journal@abbrv@period@period%
\fi%
\fi%
\fi%
#1%
}
% Skip groups after the \JournalTitle command
\def\@jrnl@eat@period@groupskip{%
\@ifnextchar\egroup%
{\@jrnl@eat@period@groupskip@}%
{\@jrnl@eat@period}%
}
\def\@jrnl@eat@period@groupskip@{%
\egroup \expandafter\@jrnl@eat@period\bgroup%
}
% Call \journal{<title>}, where <title> is the title for which
% journal abbreviation replacements should be performed.
\providecommand{\JournalTitle}[1]{%
\@abbreviate@journal@true%
\global\@end@period@false%
\begingroup%
\jabbrv@redefine@diacritic%
\edef\journal@fulltitle{#1}%
\ifcsname journal@exception@#1\endcsname%
\csname journal@exception@#1\endcsname%
\global\@abbreviate@journal@false%
\fi%
\endgroup%
\if@abbreviate@journal@%
\begingroup%
\@gobble@space@true%
\@special@period@false%
\jabbrv@redefine@diacritic%
\jabbrv@reset@word@count%
\expandafter\journal@char@loop%
#1%
\journal@char@stop%
\endgroup%
\fi%
% If the next character is not a period then add one in
% if the last character would have been a period
\@jrnl@eat@period@groupskip%
}
% Declare an option for disabling periods
\DeclareVoidOption{noperiod}{\@show@period@false}
% Declare an option for abbreviating one word titles
\DeclareVoidOption{oneword}{\@jabbrv@abbrv@one@word@title@true}
% Declare an option for enabling undefined abbreviation warnings
\DeclareVoidOption{warnundef}{\@warn@noabbrv@true}
% Declare an option for the default abbreviation list
\gdef\jabbrv@lang{en}
\define@key{jabbrv}{lang}{\gdef\jabbrv@lang{#1}}
% Process the option list and input the language definitions
\ProcessKeyvalOptions{jabbrv}
\InputIfFileExists{jabbrv-ltwa-all.ldf}{}{%
\@latex@error{The master abbreviation language file `jabbrv-ltwa-all.ldf' was not found}{Make sure the file is in the appropriate folder and recompile.}%
}
\InputIfFileExists{jabbrv-ltwa-\[email protected]}{}{%
\@latex@error{Abbreviation language `jabbrv-ltwa-\[email protected]' not found}{Select a valid language and recompile.}%
}
所有内容均可在以下网址下载永久链接
答案1
就在\begin{document}
之前
\title{Scientific Reports Title to see here}
(我认为,它通常属于这个位置)。
由于chemmacros
在开始文档时正在做生意,所以\abstract
类中的(可怕的)定义破坏了很多东西。
让我们尝试看看会发生什么。在类中我们发现
\def\xabstract{abstract}
\long\def\abstract#1\end#2{\def\two{#2}\ifx\two\xabstract
\long\gdef\theabstract{\ignorespaces#1}
\def\go{\end{abstract}}\else
\typeout{^^J^^J PLEASE DO NOT USE ANY \string\begin\space \string\end^^J
COMMANDS WITHIN ABSTRACT^^J^^J}#1\end{#2}
\gdef\theabstract{\vskip12pt BADLY FORMED ABSTRACT: PLEASE DO
NOT USE {\tt\string\begin...\string\end} COMMANDS WITHIN
THE ABSTRACT\vskip12pt}\let\go\relax\fi
\go}
现在假设我们有
\begin{abstract}
Text
\end{abstract}
和往常一样,LaTeX 会做一些事情,其中\begingroup
最终会发出\abstract
。根据给定的定义,直到第一个\end
标记(包括以下标记或括号标记组)的所有内容都将被吸收。之前的标记\end
变为#1
,而后面的标记或括号组\end
变为#2
,因此我们得到(其中•
表示空格标记,无关部分缩写为...
;这里不考虑结束行)
\def\two{abstract}
\ifx\two\xabstract
\long\gdef\theabstract{\ignorespaces•Text•}•
\def\go{\end{abstract}}
\else
\typeout{...}•Text•\end{abstract}•
\gdef\theabstract{...}\let\go\relax
\fi
\go
条件成立,所以我们最终得到
\long\gdef\theabstract{\ignorespaces•Text•}•
\def\go{\end{abstract}}
\else...\fi
\go
定义执行后,尾随空格标记将被忽略,因为 TeX 处于垂直模式。所有从上到下\else
的标记\fi
都被跳过,我们保留\go
扩展到
\end{abstract}
这就是问题所在!确实存在\end{abstract}
问题\endabstract
它有标准定义,即
\if@twocolumn\else\endquotation\fi
现在我们可以看看,\endquotation
它执行的操作期望列表已经打开(使用\quotation
)。这造成了混乱。
该类应该\let\go\endgroup
代替\def\go{\end{abstract}}
。