如何处理 TikZ 动画中的汉字?

2020-02-19 00:26发布

```tex \documentclass[dvisvgm]{article} \usepackage{tikz} \usetikzlibrary{animations} \begin{documen...

```tex \documentclass[dvisvgm]{article} \usepackage{tikz} \usetikzlibrary{animations} \begin{document} \tikz [animate = { n:shift = { 0s = "{(0,0)}", 2s = "{(0,5mm)}", 4s = "{(5mm,5mm)}", 6s = "{(5mm,10mm)}", 8s = "{(10mm,10mm)}", begin on = {click, of next=begin}}, }]{ \draw[help lines] (0,0) grid (3,3); \path node (n) [fill = blue!20, draw=blue, very thick] {The node}; \node at(0,-2)(begin){开始}; } \end{document} ``` 上面文件命名为 `st.tex`, 编译方式是 `xelatex -no-pdf st.tex` 然后 `dvisvgm st.xdv` 再用 Firefox 打开 st.svg, 看不到原来 tex 文件中的汉字“开始”。 这种情况下如何处理汉字呢?
2条回答
需要支持中文,`\usepackage{ctex}`先支持中文。

作者追问:2020-02-19 08:46

用的是 texlive2019 ```tex \documentclass{article} \usepackage{ctex} \usepackage{tikz} \usetikzlibrary{animations} \begin{document} \pagestyle{empty} \tikz [animate = { n:shift = { 0s = "{(0,0)}", 2s = "{(0,5mm)}", 4s = "{(5mm,5mm)}", 6s = "{(5mm,10mm)}", 8s = "{(10mm,10mm)}", begin on = {click, of next=begin}}, }]{ \draw[help lines] (0,0) grid (3,3); \path node (n) [fill = blue!20, draw=blue, very thick] {The node}; \node at(0,-2)(begin){开始}; } \end{document} ``` 用 `xelatex -no-pdf` 编译报错: Package pgf Warning: Your graphic driver pgfsys-xetex.def does not support animations. This warning is given only once on input line 14. 把 ctex 宏包换成 fontspec 也会出相同的错误。

一周热门 更多>