2

I have a problem with corrupted eps figures. It is maybe the same kind of problem in this question asked 2 years ago, which did not find an answer :

Corrupted eps figures - Tikz externalizes EPS figures correctly but Photoshop does not open them

Indeed, as same as presented in this previous topic, I send eps figures to an editor who answers me they are corrupted. I don't know the reason at all, and I can open my eps figures without any problem. So, where is the problem ?

I make my figures with a Latex file called fig.tex, using gnuplottex :

\documentclass{article}
\usepackage{gnuplottex}
\usepackage{amsmath,amssymb}
\usepackage{graphicx}
\pagestyle{empty}

\begin{document}

\begin{figure}\label{fig_U1}
\begin{gnuplot}[scale=1.0]

set terminal epslatex color 
set output "fig_U1.tex"
set style data linespoints
set key top center 
set style line 1 lt 1 lc rgb "red" lw 2
set style line 2 dt 3 lc rgb "red" lw 4
set style line 3 lt 1 lc rgb "green" lw 2
set style line 4 dt 3 lc rgb "green" lw 4
set style line 5 lt 1 lc rgb "dark-yellow" lw 2
set style line 6 dt 3 lc rgb "dark-yellow" lw 4
set style line 7 lt 1 lc rgb "dark-violet" lw 2
set style line 8 dt 3 lc rgb "dark-violet" lw 4
set style line 9 lt 1 lc rgb "blue" lw 2
set style line 10 dt 3 lc rgb "blue" lw 4
set style line 11 lt 1 lc rgb "dark-orange" lw 2
set style line 12 dt 3 lc rgb "dark-orange" lw 4
set style line 13 lt 1 lc rgb "black" lw 2
set style line 14 dt 3 lc rgb "black" lw 4
set style line 15 lt 1 lc rgb "purple" lw 2
set style line 16 dt 3 lc rgb "purple" lw 4
set style line 17 lt 1 lc rgb "#483D8B" lw 2
set style line 18 dt 3 lc rgb "#483D8B" lw 4

unset arrow
set ylabel "impurity correlation energy / $U$" font "Helvetica,22"
set title "$U$ = 1" font "Helvetica,25"

plot 3*x*x with lines ls 7 title "exact 1";
\end{gnuplot}
\end{figure}

\begin{figure}\label{fig_U10}
\begin{gnuplot}[scale=1.0]
set terminal epslatex color 
set output "fig_U10.tex"
set style data linespoints
set key top center 
set style line 1 lt 1 lc rgb "red" lw 2
set style line 2 dt 3 lc rgb "red" lw 4
set style line 3 lt 1 lc rgb "green" lw 2
set style line 4 dt 3 lc rgb "green" lw 4
set style line 5 lt 1 lc rgb "dark-yellow" lw 2
set style line 6 dt 3 lc rgb "dark-yellow" lw 4
set style line 7 lt 1 lc rgb "dark-violet" lw 2
set style line 8 dt 3 lc rgb "dark-violet" lw 4
set style line 9 lt 1 lc rgb "blue" lw 2
set style line 10 dt 3 lc rgb "blue" lw 4
set style line 11 lt 1 lc rgb "dark-orange" lw 2
set style line 12 dt 3 lc rgb "dark-orange" lw 4
set style line 13 lt 1 lc rgb "black" lw 2
set style line 14 dt 3 lc rgb "black" lw 4
set style line 15 lt 1 lc rgb "purple" lw 2
set style line 16 dt 3 lc rgb "purple" lw 4
set style line 17 lt 1 lc rgb "#483D8B" lw 2
set style line 18 dt 3 lc rgb "#483D8B" lw 4

unset arrow
set ylabel "impurity correlation energy / $U$" font "Helvetica,22"
set title "$U$ = 10" font "Helvetica,25"

plot x with lines ls 9 title "exact 2";
\end{gnuplot}
\end{figure}

\begin{figure}\label{fig_U100}
\begin{gnuplot}[scale=1.0]

set terminal epslatex color 
set output "fig_U100.tex"
set style data linespoints
set key top center 
set style line 1 lt 1 lc rgb "red" lw 2
set style line 2 dt 3 lc rgb "red" lw 4
set style line 3 lt 1 lc rgb "green" lw 2
set style line 4 dt 3 lc rgb "green" lw 4
set style line 5 lt 1 lc rgb "dark-yellow" lw 2
set style line 6 dt 3 lc rgb "dark-yellow" lw 4
set style line 7 lt 1 lc rgb "dark-violet" lw 2
set style line 8 dt 3 lc rgb "dark-violet" lw 4
set style line 9 lt 1 lc rgb "blue" lw 2
set style line 10 dt 3 lc rgb "blue" lw 4
set style line 11 lt 1 lc rgb "dark-orange" lw 2
set style line 12 dt 3 lc rgb "dark-orange" lw 4
set style line 13 lt 1 lc rgb "black" lw 2
set style line 14 dt 3 lc rgb "black" lw 4
set style line 15 lt 1 lc rgb "purple" lw 2
set style line 16 dt 3 lc rgb "purple" lw 4
set style line 17 lt 1 lc rgb "#483D8B" lw 2
set style line 18 dt 3 lc rgb "#483D8B" lw 4

unset arrow
set xlabel '$N$'  font "Helvetica,28"
set ylabel "impurity correlation energy / $U$" font "Helvetica,22"
set title "$U$ = 100" font "Helvetica,25"

plot 2*x with lines ls 11 title "exact 3";

\end{gnuplot}
\end{figure}
\end{document}

This file is included in a script called fig-tex.sh :

latex fig.tex
latex fig.tex

gnuplot fig-gnuplottex-fig1.gnuplot
gnuplot fig-gnuplottex-fig2.gnuplot
gnuplot fig-gnuplottex-fig3.gnuplot

echo "\documentclass{article}
\usepackage{graphicx}
\begin{document}
\pagenumbering{gobble}
\clearpage
\thispagestyle{empty}
\begin{figure}
\begin{center}
\scalebox{0.7}{\input{fig_U1.tex}}
\scalebox{0.7}{\input{fig_U10.tex}}
\scalebox{0.7}{\input{fig_U100.tex}}
\end{center}
\end{figure}
\end{document}" > final-fig.tex

pdflatex final-fig.tex

Such that it creates my final-fig.pdf figure. Then, I use :

$> pdf2ps final-fig.pdf
$> ps2eps final-fig.ps

to generate my final-fig.eps

Does anyone see something wrong, or an improvement that could explain why editors say these figures are corrupted ?

B_runo
  • 115
  • 4
  • I don't think you are using the gnuplottex package correctly. The command set output "fig_U1.tex" generates the following error on my machine: ! Output loop---100 consecutive dead cycles. – Ian Thompson Apr 25 '16 at 21:59
  • Yes, I don't know why but this error appears when I plot only one figure. If I have more figure in my .tex file, this error does not appear. But you can force it and it will still work. I will edit my question so that this error should not appear again. – B_runo Apr 29 '16 at 13:53
  • 1
    It's not clear what's going on here, but on my machine the process goes wrong at the pdf2ps stage. You could try using pdftops instead, but I would recommend avoiding going from pdf to ps, so use latex final-fig dvips final-fig and then ps2eps --ignoreBB final-fig.ps. – Ian Thompson Apr 29 '16 at 15:09
  • Ok. For me pdf2ps works so I don't know where is the issue here. But concerning your comment, do you think the corruption can be due to going from pdf to ps ? In that case, thank you for your last suggestion with dvips. I can't see if this lead to corrupted figures or not, because I don't have any connection with the editor anymore, for the moment. – B_runo May 02 '16 at 11:49
  • 1
    Yes, I'd say that conversion from pdf to ps is the most likely culprit, but it's impossible to be sure without seeing what happens on the editor's computer. – Ian Thompson May 03 '16 at 10:16
  • Ok, then I'll do what you said and avoid this pdf to ps conversion. Next time I will send figures to editors, I'll do what you said. And if they do not find any corruption, I'll come back to this post to ensure you fixed the problem :) – B_runo May 03 '16 at 13:04
  • @B_runo Are you aware you could use \begin{gnuplot}[terminal=cairolatex] which would directly create pdf output, which seems cleaner to me, as in your approach you are converting eps into pdf and then into ps. Cairolatex would at least avoid the eps->pdf conversion. – John May 27 '16 at 13:49
  • @John No I was not aware, thanks for the information. I'll try this instead. – B_runo May 30 '16 at 08:11

0 Answers0