Question

I am using GNUPlot 4.7 on Windows with the epslatex terminal. Using latex commands in labels in single quotes works fine. Now I'd like to plot a datafile with a text column including latex commands using the labels plotting style in gnuplot:

data.txt

"\textalpha\n Ge" 0.6 1.05
"\textalpha\n Si" 1.09 0.7
"\ce{GaAs}" 1.43 1.05

Plotting command:

plot 'data.txt' u (column(2)):(column(3)):(column(1)) axes x2y1 w labels center offset 0,1 notitle

However, in the resulting tex file the backslashes and immediately following charakters are missing because they were parsed by GNUPlot. How can I make GNUPlot use the unchanged text within the quotes for its labels? I have tried with no success:

  1. single quotes, both alone and nested within the double quotes
  2. double backslashes
  3. escaping the backslashes using $\ or $\\
  4. using curly brackets within or instead of the double quotes
Was it helpful?

Solution

You need four backslashes to escape one: use "$\\\\alpha$" in your data file to get $\alpha$ in the tex file. Don't ask me why. Out of curiosity, you're plotting what against band gap?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top