I'm using the gnuplot epslatex terminal to generate LaTeX files which I then convert to .pdf files using latexdvipsps2pdf. The .ps file produced by dvips is fine (the first image). However, once I run ps2pdf on the file, it garbles the text (second image). What could be causing this issue?

postscript file generated by <code>dvips</code>

pdf file generated by <code>ps2pdf</code>

The gnuplot code used to generate the latex file looks like this:


set terminal epslatex size 5.0,3.5 standalone header "\\usepackage{cmbright}\n" color colortext
set output '$0.tex'

# Line styles
set border linewidth 2
set style line 1 linecolor rgb '#FF0000' linetype 1 linewidth 3 # red
set style line 2 linecolor rgb '#FF8080' linetype 1 linewidth 2 # ltred
set style line 3 linecolor rgb '#00FF00' linetype 1 linewidth 3 # green
set style line 4 linecolor rgb '#80FF80' linetype 1 linewidth 2 # ltgreen

# Axis labels
set xlabel '$$t$$ (sec)'
set ylabel 'Events per second'

# Axis ranges
#set yrange [0:25]
set xrange[0:100]

# Tics in latex format
set format '$$%g$$'

# Key
set key right

plot "$1" index 0 using 1:2 with lines linestyle 1 title 'Underlying Function $$S_A$$',    "$1" index 1 using 1:2 with lines linestyle 2 title '$$s_A$$ counts',    "$2" index 0 using 1:2 with lines linestyle 3 title 'Underlying Function $$S_B$$',    "$2" index 1 using 1:2 with lines linestyle 4 title '$$s_B$$ counts'

The resulting LaTeX file is converted to a .pdf with

latex -interaction=nonstopmode file.tex
dvips -o file.ps file.dvi
ps2pdf file.ps

I managed to fix the tics appearing in the .pdf by changing the tics format from set format "%g" to set format "$$%g$$", which makes me think it might be something to do with that. I tried removing all math sections from the file, but the issue did not go away. For whatever reason, gnuplot complains ("../plots/twostreams.plt", line 22: Invalid substitution $%) if I only use a single $ to initiate math blocks, which appears to be the way to do it according to this link. Incidentally, the example on that page can be converted to .pdf without any issues. The only difference that I can see is that I am using the call function of gnuplot to pass in files as parameters.

Edit: After a little further poking around, I found that changing the font to another font I'm using (the libertine package) ended up producing plots as expected. I've not tried anything new, but I am on a new system, and the cmbright font still does not render correctly.

closed as unclear what you're asking by Christoph, jub0bs, Jesse, Svend Tveskæg, Heiko Oberdiek Mar 14 '14 at 2:45

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

Browse other questions tagged or ask your own question.