我怎样才能摆脱这些错误?
\RequirePackage{fix-cm}
\documentclass[twocolumn]{svjour3} % twocolumn
\smartqed % flush right qed marks, e.g. at end of proof
%\usepackage[english]{babel} %%% 'french', 'german', 'spanish', 'danish', etc.
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{txfonts}
\usepackage{mathdots}
\usepackage{kpfonts}
\usepackage{epstopdf}
\usepackage[linesnumbered, ruled]{algorithm2e}
\begin{document}
content\begin{algorithm}
%\DontPrintSemicolon
\SetKwInOut{Input}{input}
\SetKwInOut{Output}{output}
\Input{Total = W\\
Total cycles = cyc $_{total}$\\
f$_{Cyc}$ = Q : Area\\
$\left( x{}_{Sk},y{}_{Sk} \right)$ : Sk\\
$\alpha$= Parameter1 \\
}
\Output{ Xi $\leftarrow$ rand(0,1)*Q\\
}
\For{each, i}{$Z_{O} = 450\\ Li \leftarrow sqrt \left( \left( x_{i}-x_{Sk}\right)^2 + \left( y_{i}-y_{Sk}\right) ^2\right) $}
$L_{ave}\leftarrow\left( sum \left(L_{i} \right) \right) / n$\space // Parameter Sk \\
$L{}_{Tr} \leftarrow \alpha * L_{ave }$
// First Parameter based\\
\end{algorithm}...
\end{document}
svjour3class 基于 Springers 文章模板
答案1
您缺少几个$
用于启动或终止数学模式的符号。
一些额外的建议:
无需加载
fix-cm
,txfonts
因为您稍后再加载kpfonts
。不要过度使用
\left
和\right
,除非您喜欢代码混乱。包裹下标材料应该不是
\text{...}
在指令中使用数学斜体。
另外,它应该是“ Xi
”(大写希腊字母)还是“ X_{i}
”(“X sub i”)?如果是后者,也应该将其置于数学模式。
%%%%%\RequirePackage{fix-cm}
\documentclass[twocolumn]{svjour3} % from http://www.e-publications.org/springer/support/spr-chicago.html
\smartqed % flush-right qed marks, e.g. at end of proof
\usepackage{amssymb}
\usepackage{amsmath}
%%%%\usepackage{txfonts}
\usepackage{mathdots}
\usepackage{kpfonts}
%%%%\usepackage{epstopdf}
\usepackage[linesnumbered, ruled]{algorithm2e}
\begin{document}
\begin{algorithm}
%\DontPrintSemicolon
\SetKwInOut{Input}{input}
\SetKwInOut{Output}{output}
\Input{Total = W\\
Total cycles = cycr$_{\text{total}}$\\
f$_{\text{Cyc}}$ = Q : Area\\
$( x_{\text{Sk}},y_{\text{Sk}} )$ : Sk\\
$\alpha$ = Parameter1 \\
}
\Output{ Xi $\leftarrow$ rand(0,1)*Q\\
}
\For{each i}{
$Z_{0} = 450$\\ % _{0} rather than _{O}, right?
$L_i \leftarrow sqrt \left( ( x_{i}-x_{\text{Sk}})^2 +
( y_{i}-y_{\text{Sk}}) ^2\right) $
}
$L_{\text{ave}}\leftarrow$ (sum ($L_{i}$) ) / $n$\quad // Parameter Sk \\
$L_{\text{Tr}} \leftarrow \alpha * L_{\text{ave}}$\quad // First Parameter based\\
\end{algorithm}
\end{document}
答案2
这是一个解决方案。
\For{each, i}{$Z_{O} = 450\\ Li \leftarrow
用。。。来代替 \For{each, i}{$Z_{O} = 450$\; $Li \leftarrow
\RequirePackage{fix-cm}
\documentclass[twocolumn]{svjour3} % twocolumn
\smartqed % flush right qed marks, e.g. at end of proof
%\usepackage[english]{babel} %%% 'french', 'german', 'spanish', 'danish', etc.
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{txfonts}
\usepackage{mathdots}
\usepackage{kpfonts}
\usepackage{epstopdf}
\usepackage[linesnumbered, ruled]{algorithm2e}
\begin{document}
content\begin{algorithm}
%\DontPrintSemicolon
\SetKwInOut{Input}{input}
\SetKwInOut{Output}{output}
\Input{Total = W\\
Total cycles = cyc $_{total}$\\
f$_{Cyc}$ = Q : Area\\
$\left( x{}_{Sk},y{}_{Sk} \right)$ : Sk\\
$\alpha$= Parameter1 \\
}
\Output{ Xi $\leftarrow$ rand(0,1)*Q\\
}
\For{each, i}{$Z_{O} = 450$\; $Li \leftarrow sqrt \left( \left( x_{i}-x_{Sk}\right)^2 + \left( y_{i}-y_{Sk}\right) ^2\right) $}
$L_{ave}\leftarrow\left( sum \left(L_{i} \right) \right) / n$\space // Parameter Sk \\
$L{}_{Tr} \leftarrow \alpha * L_{ave }$
// First Parameter based\\
\end{algorithm}...
\end{document}