WeHack BBS
asymptote使用中文 - 可打印的版本

+- WeHack BBS (https://bbs.wehack.space)
+-- 版块: 计算机技术 (https://bbs.wehack.space/forum-5.html)
+--- 版块: GNU/Linux 讨论区 (https://bbs.wehack.space/forum-6.html)
+--- 主题: asymptote使用中文 (/thread-46.html)



asymptote使用中文 - vimacs - 07-12-2018

Hmm, asymptote是可以用中文的。我这里参考 http://bbs.ctex.org/forum.php?mod=viewthread&tid=50391

在源文件中设置字体:
代码:
texpreamble("\usepackage{fontspec}");
texpreamble("\setmainfont{Source Han Sans CN}");

draw((0,0)--(100,100));
label("$测试$", (0,0), SW);


用asymptote时指定tex为xelatex即可:
代码:
asy -V -tex xelatex -pdfviewer=mupdf test.asy