Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Graph doesn't display "en dash" correctly

    One of my users reports that when he runs on his Windows machine, the do-file generates a graph that correctly displays the "en dash" but that when he runs on our Linux server the "en dash" is displayed as a question mark ("?"). The output is going to a PDF. His test program is below, I am mystified by the ??? but perhaps it has meaning, since he says the program works in Windows. Is there a better way to specify the character that will work in both environments?

    Code:
    * Set font to serif "Times New Roman"
    graph set window fontface "Times New Roman"
    
    * en dash (???)
    local endash "???"
    
    clear
    set obs 2
    gen x = _n
    gen y = _n
    twoway scatter y x, title("`c(os)': this is an en-dash: `endash'")
    gr export "serif_symbol_`c(os)'.pdf", replace

  • #2
    Would this wor:
    Code:
    local endash = ustrunescape("\u2013")
    dis "`endash'"
    clear
    set obs 2
    gen x = _n
    gen y = _n
    twoway scatter y x, title("`c(os)': this is an en-dash: `endash'")

    Comment


    • #3
      User reports

      Thanks, but that link didn't help. Interestingly, unicode characters display properly in my putty
      shell, just not in graph output
      .

      Comment


      • #4
        I am also mystified by the ??? which appeared as ??? in my graph when I experimented on my Windows machine. Under Windows, at least, if you paste an en-dash created elsewhere (e.g. in Word) into a do file, it renders correctly in both the resulting Stata graph and an exported pdf (Using the Unicode character does too, but is less concise and isn't wysiwyg).

        Comment

        Working...
        X