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

后端 未结 2 853
北海茫月
北海茫月 2021-01-18 03:54

I am trying to export a list of graphics as separate frames in PDF format in order to then compile a vector SWF animation with the aid of external utility (such as pdf2swf).

相关标签:
2条回答
  • 2021-01-18 04:22

    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"]]
    
    0 讨论(0)
  • 2021-01-18 04:36

    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.

    0 讨论(0)
提交回复
热议问题