在分数中添加文字会引起错误

在分数中添加文字会引起错误

我是 LaTeX 新手。我搜索了一段时间,但找不到任何答案,所以决定在这里提问。

我正在尝试为我的论文创建一个包含文本的多行分数。当我编译单独文件中的命令时,它运行良好,我得到了我想要的结果,但是当我将它添加到包含thesis.tex我的大学论文包的文件中时,它会引发“!未定义的控制序列”。

有办法解决这个问题吗?

这就是我所拥有的:

\usepackage{etex}
\usepackage{frcursive}
\usepackage{enumitem}
\usepackage{arrayjobx}
\usepackage[table]{xcolor}
\usepackage{multirow}
\usepackage{citesort}
\usepackage{graphics}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage[center,normalsize]{subfigure}
\usepackage{amssymb}
\usepackage{amsmath}



\begin{document}
\begin{multline*}
G
=
\frac
{
\text{
\begin{tabular}{c}
number of subset of four nodes
\\
such that condition
\end{tabular}
}
}
{
\text{ 
\begin{tabular}{c}
number of all possible combinations of four nodes 
\\
that contribute to condition
\end{tabular}
}
}
\\
=
\frac
{
\text{
\begin{tabular}{c}
number of subset of four nodes 
\\
such that condition
\end{tabular}
}
}
{
\sum_{1\leq j\leq t \colon n_j>3} \binom{n_j}{4} 
}
<
1-\eta
\end{multline*}
\end{document}

如果我在单独的文件中运行,则会得到以下结果:

在此处输入图片描述

但是当我在我的程序中运行它时thesis.tex出现这个错误

! Undefined control sequence.
\text #1->\hbox {\rm
\ #1\ \/}
l.1018 \end{multline*}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

答案1

您不需要任何\text命令:\begin{tabular} 进入文本模式。不过我建议使用该包使用更短的语法stackengine

另外,请注意,etex自 2015 年以来,不再需要包,该包subfigure已过时且不再维护。请改用subfigure来自的环境subcaption。最后,无需同时加载graphicxgraphics,因为前者会加载后者。

\documentclass{report}
\usepackage{frcursive}
\usepackage{enumitem}
\usepackage{arrayjobx}
\usepackage[table]{xcolor}
\usepackage{multirow}
    \usepackage{citesort}%
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage[usestackEOL]{stackengine}

\begin{document}

\begin{multline*}
G =
\frac{\Centerstack{number of subset of four nodes\\such that condition}}
{\Centerstack{number of all possible combinations of four nodes \\
that contribute to condition}}%
\\
=
\frac{\Centerstack{number of subset of four nodes \\ such that condition}}
{\sum_{1\leq j\leq t \colon n_j>3} \binom{n_j}{4}}%
< 1-\eta
\end{multline*}

\end{document} 

在此处输入图片描述

相关内容