pdfgnuplotsmallcaps

Small Caps for Gnuplot Labels


I'm looking for a command or something equivalent to draw labels in Gnuplot with small caps, like using \texsc{Mylabel} in LaTeX. Is there any chance to do so without using latex as terminal? I prefer to generate PDF directly.


Solution

  • I figured out a workaround using the same strategy used by @mjp and @theozh in this answer.

    # Implements a 'textsc' function like in (La)TeX.
    # Based on original answer at https://stackoverflow.com/a/54174759/11369382
    
    reset
    set encoding utf8 # mandatory
    
    LCases="abcdefghijklmnopqrstuvwxyz"
    SCases="ᴀʙᴄᴅᴇғɢʜɪᴊᴋʟᴍɴᴏᴘǫʀsᴛᴜᴠᴡxʏᴢ"
    
    toscchr(c)= c eq ""  ?  ""  :  substr( SCases.c, strstrt(LCases.c, c), strstrt(LCases.c, c) )
    
    texsc(s) = strlen(s) <= 1 ? toscchr(s) : texsc(s[1:strlen(s)/2]).texsc(s[(strlen(s)/2)+1:strlen(s)])
    
    Mylabel = "The Quick Brown Fox jumps over the Lazy Dog"
    
    position = "at graph 0.2,0.60"
    
    set label Mylabel        @position offset 0, 0
    set label texsc(Mylabel) @position offset 0,-1
    
    plot x w p pt -1 not
    

    Result

    result