我在使用 degruyter latex 模板处理文章时遇到了一些问题。除了语法树和 lfg AVM 之外,其他一切都正常。我正在使用 xelatex 进行编译,并且使用 forest 和 langsci-avm 进行编译语言学和左转作为选项。有人能帮我吗?谢谢。这是最简代码。
\documentclass[english]{article}
\RequirePackage[no-math]{fontspec}[2017/03/31]%(only for the luatex or the xetex engine)
\usepackage{fontspec}
\setmainfont{Linux Libertine}
\usepackage[small]{dgruyter}
% get packages from local sty-file
\usepackage{packages}
% Note: A different font will be used in the final version
%\usepackage{times}
% Names for Tables, Figures
\AtBeginDocument{%
\renewcommand\tablename{Table}
}
\AtBeginDocument{%
\renewcommand\figurename{Figure}
}
% We use todonotes for margin notes
\newcommand{\jdg}[1]{\makebox[0pt][r]{\normalfont#1\ignorespaces}}
\usepackage{ifthen}
\newboolean{finalcompile}
% Please set finalcompile to true for the final version, to false otherwise
\setboolean{finalcompile}{true}
%\setboolean{finalcompile}{false}
\ifthenelse{\boolean{finalcompile}}{
\usepackage[disable]{todonotes}
\usepackage[final]{showlabels}
}{
\usepackage{todonotes}
\newcommand{\todonote}[2][]{\tikzexternaldisable\todo[#1]{#2}\tikzexternalenable} %needed for externalization
\usepackage[right]{showlabels}
\paperwidth=\dimexpr \paperwidth + 6cm\relax
\marginparwidth=\dimexpr \marginparwidth + 6cm\relax
%\makeatletter
%\@mparswitchfalse
%\makeatother
%\normalmarginpar
%\reversemarginpar
}
\usepackage[linguistics]{forest}
\usepackage[lfg]{langsci-avm}
\usepackage{pst-node}
\avmdefinestyle{plain}{attributes=\scshape,
values=\scshape,
types=\normalfont}
\begin{document}
\begin{forest}
[IP[DP][I']]
\end{forest}
\avm[style=plain]{
[pred & `silue']}
\end{document}
错误信息如下:
! Misplaced \noalign.
\bottomrule ->\noalign
{\ifnum 0=`}\fi \@aboverulesep =\aboverulesep \global...
l.67 \end{forest}
I expect to see \noalign only after the \cr of
an alignment. Proceed, and I'll ignore this case.
! Missing } inserted.
<inserted text>
}
l.67 \end{forest}
I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.
! Missing \endgroup inserted.
<inserted text>
\endgroup
l.67 \end{forest}
I've inserted something that you may have forgotten.
(See the <inserted text> above.)
答案1
DeGruyter 包将所有 tabular 重新定义为booktabs
tabular,这搞砸了内部使用常规 tabular 环境的包。幸运的是,他们还提供了一种撤消更改的方法,因此对于任何forest
导致此错误的环境,您都可以使用:
\AtBeginEnvironment{forest}{\baretabulars}
如果langsci-avm
命令是宏而不是环境,则可以使用from\avm
修补命令:\pretocmd
etoolbox
\usepackage{etoolbox}
\pretocmd{\avm}{\baretabulars}{}{\fail}
如果修补由于您尝试修补的特定命令的定义方式而失败,则宏\fail
将返回未定义的控制序列错误,在这种情况下您需要找到另一种方法来修补该特定命令。
这是一个最小的工作示例(并且您的非工作示例应该是这样的)。
\documentclass[english]{article}
\RequirePackage[no-math]{fontspec}[2017/03/31]%(only for the luatex or the xetex engine)
\usepackage{fontspec}
\usepackage[small]{dgruyter}
\usepackage[linguistics]{forest}
\AtBeginEnvironment{forest}{\baretabulars}
\usepackage[lfg]{langsci-avm}
\pretocmd{\avm}{\baretabulars}{}{\fail}
\avmdefinestyle{plain}{attributes=\scshape,
values=\scshape,
types=\normalfont}
\begin{document}
\begin{forest}
[IP[DP][I']]
\end{forest}
\avm[style=plain]{
[pred & `silue']}
\end{document}