我无法使用 ASPR 模板编译我的文件

我无法使用 ASPR 模板编译我的文件

我正在尝试按照《美国政治科学评论》的风格编写一篇论文。以下是 cls 文件:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% apsr_submission.cls, v1.1, 2017/12/06
% Developed by Overleaf
% 
% This class file enables authors to prepare 
% manuscripts for submission to APSR.
%
% v1.01: corrected ASPR typos to APSR
% v1.1: Uses chicago-apsr.bst that doesn't shorten first names
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{apsr_submission}[2017/12/06 v1.1]

\newif\if@biblatex
\newif\if@blind
\newif\if@twocol
\newif\if@onehalfspace
\newif\if@doublespace
\newif\if@extracover
\newif\if@autowc
\DeclareOption{biblatex}{\@biblatextrue}
\DeclareOption{bibtex}{\@biblatexfalse}
\DeclareOption{twocolumn}{\@twocoltrue}
\DeclareOption{blind}{\@blindtrue}
\DeclareOption{nonblind}{\@blindfalse}
\DeclareOption{singlespace}{\@onehalfspacefalse\@doublespacefalse}
\DeclareOption{onehalfspace}{\@onehalfspacetrue\@doublespacefalse}
\DeclareOption{doublespace}{\@onehalfspacefalse\@doublespacetrue}
\DeclareOption{autowc}{\@autowctrue}
\DeclareOption{titlepage}{\@extracovertrue}
\ExecuteOptions{blind,doublespace}
\ProcessOptions\relax
\LoadClass[twoside,12pt]{article}

\RequirePackage{silence}
\WarningFilter*{hyperref}{Ignoring empty anchor}
\WarningFilter*{hyperref}{Rerun to get}
\WarningFilter*{microtype}{Unknown slot number of character}

%% Language and font encodings
\RequirePackage[english]{babel}
\RequirePackage{ifxetex,ifluatex,ifpdf}
\ifxetex\else
  \ifluatex\else
    \RequirePackage[utf8]{inputenc}
\fi\fi
\RequirePackage[T1]{fontenc}
\RequirePackage{newtxtext,newtxmath}
\RequirePackage{microtype}
\RequirePackage{textcase}
\RequirePackage{lettrine}
\RequirePackage{xpatch}
\RequirePackage[framemethod=tikz]{mdframed}

%% Sets page size and margins
\RequirePackage[letterpaper,top=1.8cm,bottom=2.2cm,left=2.1cm,right=2.5cm,columnsep=0.65cm,footskip=2.5\baselineskip,headsep=1.5\baselineskip]{geometry}


%% Front matters
\def\@authorlist{}
\def\@authorinfo{}
\def\@authorlistblind{}
\def\@authorinfoblind{}
\def\@runningauthor{}
\def\@runningtitle{}
\def\@journalname{American Political Science Review}
\def\@publishername{American Political Science Association}
\def\@publishedyear{\the\year}

\renewcommand{\author}[3]{%
  \appto{\@authorlist}{%
    {\noindent\Large%
      \ifxetex\MakeUppercase{#1}%
      \else\ifpdf
        \textls[80]{\MakeUppercase{#1}}%
          \else\MakeUppercase{#1}%
      \fi\fi%
    }\hspace{1em}%
    {\itshape\large #2}\par\vskip3pt}%
    \authorinfo{#3\par}
}

\RequirePackage[style]{abstract}
\RequirePackage{environ}
\RequirePackage[explicit]{titlesec}
\RequirePackage{tikz,pgffor}
\RequirePackage{fancyhdr}
\RequirePackage{setspace}
\RequirePackage{lastpage}

\AtBeginDocument{\RequirePackage[hidelinks]{hyperref}}

\setcounter{DefaultLines}{3}
\setlength{\DefaultFindent}{0.25em}
\setlength{\DefaultNindent}{0pt}
\appto{\LettrineFontHook}{\bfseries}
\renewcommand{\LettrineTextFont}{\upshape}
\renewcommand{\LettrineSecondString}{l}
\newcommand{\dropcap}[2][]{\lettrine[#1] #2}

\renewcommand{\abstitlestyle}[1]{}
\setlength{\absleftindent}{2em}
\setlength{\absrightindent}{2em}
\setlength{\absparindent}{0pt}
\renewcommand{\abstracttextfont}{\itshape\noindent\dropcap[findent=0.5em]}

\let\maketitle\relax

\newcommand{\authorinfo}[1]{\appto{\@authorinfo}{#1}}
\let\thanks\authorinfo
\newcommand{\runningauthor}[1]{\def\@runningauthor{#1}}
\newcommand{\runningtitle}[1]{\def\@runningtitle{#1}}
\newcommand{\publishedyear}[1]{\def\@publishedyear{#1}}

\RequirePackage[marginal]{footmisc}
\setlength{\footnotemargin}{0.25em}
\def\blfootnote{\gdef\@thefnmark{}\@footnotetext}
\renewcommand{\footnotelayout}{\small}
\if@doublespace
  \appto{\footnotelayout}{\doublespacing}
\fi
\if@onehalfspace
  \appto{\footnotelayout}{\onehalfspacing}
\fi

\renewcommand{\@maketitle}{%
  \vspace*{\baselineskip}
  {\fontfamily{qhvc}\fontseries{b}\fontsize{20pt}{24pt}\selectfont\raggedright\@title\par\vskip3pt}
  {\@authorlist\par}
}

\if@blind
  \newcommand{\@anonymizeauthors}{
    \def\@authorlistblind{}
    \def\@authorinfoblind{}
    \patchcmd{\author}{\@authorlist}{\@authorlistblind}{}{}
    \patchcmd{\authorinfo}{\@authorinfo}{\@authorinfoblind}{}{}
    \author{Anonymised Author(s)}{Anonymised Institution(s)}{Anonymised submission.\par\medskip\textbf{This is a  manuscript submitted for review.}}
    \gdef\@runningauthor{Anonymised Author(s)}
    \let\@authorlist\@authorlistblind
    \let\@authorinfo\@authorinfoblind
}
\else
  \let\@anonymizeauthors\relax
\fi

\def\@totalwordcount{0}
\newcommand{\totalwordcount}[1]{%
  %% Only allow total word count to be changed it if it's still 0
  \if@autowc%
    \ClassWarning{apsr_submission.cls}{\string\totalwordcount{} is ignored when autowc is active.}
  \else
    \def\@totalwordcount{#1}
  \fi
}
\if@autowc
  \RequirePackage{bashful}
  \newcommand{\@autowordcount}{%
    \def\@totalwordcount{\splice{texcount -1 -sum=1,1,1,0,0,0,0 -merge -incbib -utf8 \jobname.tex}}}%
\else
  \let\@autowordcount\relax
\fi


\NewEnviron{frontmatter}{%
  \def\apsr@frontmatter{
    \@maketitle\BODY%
    \if@autowc\@autowordcount\fi%
    {\centering Word Count: \@totalwordcount\par}%
  }
  \appto{\@authorinfo}{\par\medskip\textbf{This is a  manuscript submitted for review.}\par}
  \if@twocol
    \if@extracover
      \setcounter{page}{0}
      \onecolumn\apsr@frontmatter
      \blfootnote{\hspace*{-\footnotemargin}\@authorinfo}
      \thispagestyle{empty}\clearpage
    \fi
    %% Anonymise main text only
    \if@blind\@anonymizeauthors\fi
    \twocolumn[\apsr@frontmatter\bigskip]
  \else
    \if@extracover
      \setcounter{page}{0}
      \apsr@frontmatter
      \blfootnote{\hspace*{-\footnotemargin}\@authorinfo}
      \thispagestyle{empty}\clearpage
    \fi
    %% Anonymise main text only
    \if@blind\@anonymizeauthors\fi
    \apsr@frontmatter
  \fi
  \thispagestyle{titlepage}
  \blfootnote{\hspace*{-\footnotemargin}\@authorinfo}
}{}

\AfterEndEnvironment{frontmatter}{
  \if@onehalfspace\onehalfspacing\fi%
  \if@doublespace\doublespacing\fi%
}


\setcounter{secnumdepth}{3}

\titleformat{\section}{\sffamily\bfseries\large\raggedright}{}{0pt}{\MakeTextUppercase{#1}}

\titleformat{\subsection}{\sffamily\bfseries\large\raggedright}{}{0pt}{#1}

\titleformat{\subsubsection}[runin]{\itshape\bfseries}{}{0pt}{#1}

\titlespacing*{\section}{0pt}{1.25\baselineskip}{0.25\baselineskip}

\titlespacing*{\subsection}{0pt}{1.25\baselineskip}{0.25\baselineskip}

\RequirePackage{enumitem}
\setlist{noitemsep,topsep=0.5\baselineskip,leftmargin=2\parindent}

\RequirePackage{quoting}
\quotingsetup{font=small,indentfirst=false,begintext={``},endtext={''},vskip=0.5\baselineskip,leftmargin=\parindent,rightmargin=0pt}

\fancyhf{}
\renewcommand{\headrulewidth}{1pt}
\fancyhead[RO]{\footnotesize\@runningtitle}
\fancyhead[LE]{\footnotesize\@runningauthor}
\fancyfoot[LE,RO]{\thepage}
\pagestyle{fancy}
\fancypagestyle{titlepage}{%
  \pagestyle{fancy}
  \fancyhead[RO]{\footnotesize Page \thepage{} of \pageref{LastPage}}
  \fancyhead[LO]{\footnotesize%
  \textit{Submission to \@journalname}\\[-\baselineskip]%
  \raisebox{-1.25\baselineskip}[0pt][0pt]{doi:xx.xxxx/xxxxx}
  }
}
\cfoot{%
  \tikz[remember picture,overlay]
  \ifnumodd{\thepage}{%
    \node[transform shape,rotate=90,anchor=north,yshift=-2pt,text=gray!10,font=\scriptsize] at (current page.west) 
  }{%
     \node[transform shape,rotate=-90,anchor=north,yshift=-2pt,text=gray!10,font=\scriptsize] at (current page.east) 
   }
      {\foreach \n in {1,...,10}{APSR Submission Template\hspace{1em}}};
}

%% Easiest way to get framed floats, both single-column and wide
\RequirePackage[framestyle=fbox,framefit=yes,heightadjust=all,framearound=all,font=sf]{floatrow}
\RequirePackage{booktabs}
\RequirePackage{caption}
\RequirePackage{mdframed}
\newcommand{\makeframedenv}[1]{%
  \cspreto{#1}{\begin{mdframed}}
  \csappto{end#1}{\end{mdframed}}
}
\AtBeginDocument{%
  \@ifpackageloaded{longtable}{
    \floatsetup[longtable]{LTcapwidth=table}
    \makeframedenv{longtable}
  }{}
  \@ifpackageloaded{supertabular}{
    \makeframedenv{supertabular}
  }{}
  
  
}
\floatsetup{capposition=top,midcode=rule,}
\captionsetup*{
  figurename=FIGURE,tablename=TABLE,
  font={bf,sf},
  labelsep=period,
  justification=justified,
  footfont={sf,md,small},
  singlelinecheck=false}
\pretocmd{\floatfoot}{\rule{\hsize}{0.4pt}\vskip-0.75em}{}{}
\newcommand{\floatnote}[1]{\floatfoot{\textit{Note: }#1}}

\if@biblatex
  \RequirePackage{csquotes}
  \RequirePackage[natbib,style=chicago-authordate,backend=biber,sorting=nyt]{biblatex}
\else
  \RequirePackage{natbib}
  \bibliographystyle{chicago}
  \setcitestyle{aysep={}}
\fi
\renewcommand{\bibfont}{\small}

\endinput

然后我有以下文件:

\documentclass[bibtex]{apsr_submission}

\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{lscape}
\usepackage[counterclockwise]{rotating}
\usepackage{bm}
\usepackage{multirow}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage{epstopdf}
\usepackage{pdflscape}
\usepackage{siunitx}
\usepackage{afterpage}
\usepackage{soul}
\soulregister\citealp7
\soulregister\ref7
\soulregister\pageref7
\usepackage{xcolor}
\setstcolor{red}
\setul{}{2pt}


\sisetup{detect-family, 
input-symbols=() Coef S.E}% 

\newcommand\mc[1]{\multicolumn{1}{c}{#1}}\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}

\newcommand\mca[1]{\multicolumn{2}{c}{#1}}\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}

\newcommand\mcb[1]{\multicolumn{4}{c}{#1}}\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}

\newcommand\mcc[1]{\multicolumn{6}{c}{#1}}\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}

\newcommand{\overbar}[1]{\mkern 1.5mu\overline{\mkern-1.5mu#1\mkern-1.5mu}\mkern 1.5mu}

\title{Title}


\author{Auth1}
       {University 1}
       {Something about me \dots}
       
\author{Auth2}
       {University 2}
       {Something about me \dots}

\author{Auth3}
       {University 3}
       {Something about me \dots}

\thanks{We wish to thank \dots}

\runningtitle{Title}
\runningauthor{Auth1, Auth2, and Auth3} 

\usepackage{pdflscape}

\begin{document}

\begin{frontmatter}
\begin{abstract}
This is the abstract
\end{abstract}
\totalwordcount{XXXX}
\end{frontmatter}


\section{Introduction}

\dropcap{This} is the introduction....

Then I want to introduct tab.1, which is stored in folder ``Table'' in my wd:

\input{Tables/t1}


\end{document}

表 t1 如下所示:

\begin{table}[hbt!]
\setlength{\tabcolsep}{10pt}
\caption{Summary statistics}
\label{tab:sumstat}
\centering
\begin{tabular}{| 
S[table-format=3.3, table-align-text-post = false]
S[table-format=1.3, table-align-text-post = false]
S[table-format=1.3, table-align-text-post = false]
S[table-format=1.3, table-align-text-post = false]
S[table-format=1.3, table-align-text-post = false]}

Variables   &\mc{Obs.}  &\mc{Mean}  &\mc{S.D.}  &\mc{Min.}  &\mc{Max.} \\ \midrule
HP          &104,862        &0.848          &0.359          &\mc{0}         &\mc{1} \\ 
CAF         &104,862        &0.011          &2.148          &-7.427         &4.448 \\
GLOB        &104,862        &0.199          &0.400          &\mc{0}         &\mc{1}
\end{tabular}
\floatnote{Some notes}
\end{table}

当我尝试编译该文件时,收到以下错误消息:

! Missing \endcsname inserted.
<to be read again> 
                   \__int_eval_end: 
l.13 V
      ariables  &\mc{Obs.}  &\mc{Mean}  &\mc{S.D.}  &\mc{Min.}  &\mc{Max.} \\...

实际上,我以前能够编译该文件,但现在却不能。我尝试检查是否有任何 Unicode 字符,因为此错误可能由此引起,但似乎没有。

我删除了所有辅助文件,如 AUX 等。但它仍然不起作用。知道为什么会发生这种情况吗?

编辑

@UlrikeFischer。感谢回到 siunitx v2,让我能够编译该文件。我还在 t1 文件中添加了一个新行,即:

\begin{tabular}{| 
S[table-format=3.3, table-align-text-post = false]
S[table-format=1.3, table-align-text-post = false]
S[table-format=1.3, table-align-text-post = false]
S[table-format=1.3, table-align-text-post = false]
S[table-format=1.3, table-align-text-post = false]
**S[table-format=1.3, table-align-text-post = false]**}

因为我意识到我有六列而不是五列。我只遇到了一个小问题。表 1 如下所示:

在此处输入图片描述

我不明白该如何修复它。为什么不显示“i”而是插入一个空格?

相关内容