Translate brass

I started using the awesome knitr package, and although I like the idea of ​​using tikz graphics, it is not always very practical (time consuming). Thus, I finish switching between the old old pdf and tikz . Mathematical expressions, as a rule, are not processed equally in both devices; It is much more convenient for me to use LaTeX syntax in tikz , but it becomes difficult to read it in pdf , and vice versa.

Were there any attempts to provide a platform for seamless switching from one notation to another? Something like the translate(x, from="plotmath", to="tex", ams=TRUE, ...) function translate(x, from="plotmath", to="tex", ams=TRUE, ...) , which can be connected internally using knitr to the device you are using. How can this be done?

+4
source share
1 answer

It’s hard for me. Translating from plotmath to LaTeX might be easier, for example. replace alpha with \alpha and x[i] with x_{i} , etc., but the other way might be difficult, since plotmath is just a "subset" of LaTeX expressions.

If long-term generation of tikz graphics is a problem for you, you might consider turning on the cache (as it was in the knitr and many other sample documents). When the tikz digit is generated, it will not be restored the next time if cache=TRUE , so it will be quite fast, and it will be even faster if you also convert tikz to pdf using the chunk external=TRUE option.

The only reason I cannot use tikz is because the graph is too large in size, as I explained in the manual. Other than that, tikz is always preferable for me. However, this is a little off topic.

+4
source

Source: https://habr.com/ru/post/1391222/


All Articles