I have this gnuplot script and works fine:
set term png
set output 'test.png'
plot sin(x) ti "Eñe"
Note de 'ñ' in the label. This produces an image and you can read the 'ñ'.
Now I try to change the term to epslatex
:
set term epslatex color
set output 'test.tex'
plot sin(x) ti "Eñe"
Run gnuplot, and it generates test.tex
and test.eps
. Then I have a master file:
% master.tex
\documentclass{report}
\usepackage[spanish]{babel}
\usepackage[latin1]{inputenc}
\begin{document}
\input{test.tex}
\end{document}
When I compile master.tex
(either with texmaker or from console with pdflatex) I get an error. If I open test.tex
with texmaker, instead of 'eñe' I have 'Eñe'. But if I open it with gvim, I have 'ñ'. When I fix it from textmaker, everything works just fine.
There is a workaround that I don't want to use: In the gnuplot script, instead of 'eñe' I can write 'e\\~ne'. That works, but I really don't want to do it that way.
I've tried using set encoding
to utf8
and iso_8859_1
in the gnuplot script with no luck.
Any ideas?
set encoding iso_8859_1
in the gnuplot file, you must also save it as Latin-1; the output "Eñe" is a clear indication of a two byte UTF-8 character interpreted as Latin-1. Why don't you switch to UTF-8 in all cases? – egreg Sep 21 '13 at 22:59set enconding iso_8859_1
and saving the script as Latin-1 worked. Why I don't switch to UTF-8 in all cases? I don't know, maybe historical reasons, maybe in the future I'll ask myself the same question and change. Thank you very much – Nico Sep 21 '13 at 23:14