MathView(Katex):如何使用“ \ newline”?

时间:2019-09-09 10:33:09

标签: java android katex

我正在编写一个具有数学定义的应用程序。因此,我(想)将MathView与Katex一起使用。问题是我无法添加换行符(例如“ \ newline”或“ \\”)

我尝试使用“ \\\\”和“ \\ newline”(转义),但没有用

formula_MathView = findViewById(R.id.formulaMathView);
formula_MathView.setText(tex);
String tex = "A Cryptosystem is a tuple $$ S = (X, K, Y, e, d)$$ with \\newline a non-empty set X of plaintexts \\newline a non-empty, finite set K of keys";

它仅输出“ ... \ newline ...”(而不是应用\ newline)

我获得arround的唯一方法是对每行使用“ $$ $$”,因为这将插入公式内联。 所以我写公式要用“ $$ SOME_FORMULA $$”,写文本要用“ $$ \ text {SOME_TEXT} $$”。

String tex = "A Cryptosystem is a tuple $$ S = (X, K, Y, e, d)$$ with $$ **\\text{a non-empty set X of plaintexts}**$$ $$ \\text{a non-empty, finite set K of keys} $$ ";

根据https://github.com/KaTeX/KaTeX/pull/1298 \ newline应该实现,但至少找不到关于android studio或Java的任何代码。

0 个答案:

没有答案