![关键词 algorithm2e 翻译](https://linux22.com/image/350615/%E5%85%B3%E9%94%AE%E8%AF%8D%20algorithm2e%20%E7%BF%BB%E8%AF%91.png)
我想使用algorithm2e
翻译关键字选项(例如frenchkw
),它应该按照文档说明工作,但它对我来说没有任何作用。
\usepackage[vlined, lined, french, frenchkw]{algorithm2e}
\begin{algorithm}[H]
\KwData{this text}
\KwResult{how to write algorithm with \LaTeX2e }
initialization\;
\While{not at end of this document}{
read current\;
\eIf{understand}{
go to next section\;
current section becomes this one\;
}{
go back to the beginning of current section\;
}
}
\caption{How to write algorithms}
\end{algorithm}
结果,请注意算法标题是如何正确翻译的,但关键字却没有。
答案1
您必须指定仅使用onelanguage
此功能才能工作:
\documentclass{article}
\usepackage[vlined, french, onelanguage]{algorithm2e}
\begin{document}
\begin{algorithm}[H]
\KwData{this text}
\KwResult{how to write algorithm with \LaTeX2e }
initialization\;
\While{not at end of this document}{
read current\;
\eIf{understand}{
go to next section\;
current section becomes this one\;
}{
go back to the beginning of current section\;
}
}
\caption{How to write algorithms}
\end{algorithm}
\end{document}
尽管algorithm2e
确实提供了使用不同语言的选项,而无需onelanguage
用户为这些语言指定不同的输入。因此,人们需要使用-定义,而不是\KwData
- /default 定义。english
\Donnees
french
\documentclass{article}
\usepackage[vlined, french]{algorithm2e}
\begin{document}
\begin{algorithm}[H]
\Donnees{this text}
\Res{how to write algorithm with \LaTeX2e }
initialization\;
\Tq{not at end of this document}{
read current\;
\eSi{understand}{
go to next section\;
current section becomes this one\;
}{
go back to the beginning of current section\;
}
}
\caption{How to write algorithms}
\end{algorithm}
\end{document}