Can one export Special symbols / Cyrillic letters in plot labels when exporting graphics to PDF ?

守給你的承諾、 提交于 2019-12-01 16:57:20
Alexey Popkov

One workaround is to export to EMF instead of PDF format:

Export["C:\\1.emf", 
 Plot[Sin[x], {x, 0, Pi}, PlotLabel -> 
   "\:0420\:0443\:0441\:0441\:043a\:0438\:0435 \:0431\:0443\:043a\:0432\:044b"]]

You can further convert EMF to PDF or SWF if you wish. See here general tips on high-quality EMF export from Mathematica.

Another way that seemingly works reliably is to convert only Cyrillic text to outlines and then place it in your graphics with Inset or with Labeled:

plotLabel = 
  First@ImportString[ExportString[
    "\:0420\:0443\:0441\:0441\:043a\:0438\:0435 \:0431\:0443\:043a\:0432\:044b",
       "PDF"], "PDF"];
Labeled[Plot[Sin[x], {x, 0, Pi}], plotLabel, Top]

Or you can use the outlined text directly as PlotLabel:

Export["C:\\1.pdf", Plot[Sin[x], {x, 0, Pi}, PlotLabel -> plotLabel]]

You can generalize this method by writing a simple routine:

cyrFix = First@ImportString[ExportString[#, "PDF"], "PDF"] &

You can use it as follows:

Export["C:\\1.pdf", 
 Plot[Sin[x], {x, 0, Pi}, PlotLabel -> 
  cyrFix@"\:0420\:0443\:0441\:0441\:043a\:0438\:0435 \:0431\:0443\:043a\:0432\:044b"]]

Mathematica's PDF export does not curremtly support Cyrillic, only Roman, Greek, Japanese, and some technical symbols. If you are using a Mac you can choose File > Print > Save As PDF as a workaround.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!