Saving a canvas in eps format

Hi all,

I m trying to save a canvas in batch mode with root 3.02…
It used to work with:

but in batch mode, it creates a C++ macro file, I get the following message:
C++ Macro file: xxx.eps has been generated
(BTW, this file is not readable with $.x xxx.eps; some of the names are like (0x34944) and it seems that root doen’t really like that)…

Therefore I tried the alternative approach:
but I got the same answer (C++ Macro file generated).
What it is the solution?

Thanks by advance,


PS: I don t know if there is connected but, to run in batch mode, as I compile my own job with root libraries, I ve just put gROOT->SetBatch() and it seems to work, no canvas appears on the screen and it doesn’t try to make the X-connection…

I have no problem generating a .eps file in batch mode. I used the macro tutorials/latex.C (it generates a postscript file) the following way:

root -b latex.C

I get a PostScript file. Not a .C one.


I don’t use a macro tourine launch by root with root -b myRoutine.C… I use my own application with uses root libraries as a usual library.



can you tried the same thing I did with your root version ? Thanks.



when I try the latex.C with root -b latex.C it works…
I didn’t even manage to reproduce the problem by changing:
1- c1.Print(“”) ==> c1.Print(“latex.eps”);
2- compiling myself the code by putting gROOT->SetBatch() and using my standard makefile (the same I used for my application and no direct call to root.exe). It is still working.

I will try to reproduce the problem with this little example but this is very strange…



I got it,

it is related to the name of the file to save. I didn’t manage to find out exactly what is the problem, it doesn’t seem to be related with the length of the name but this, I can not tell for sure… Anyway, if I replace in the latex.C example the name :” == with ==> “/afs/”

then I get:
C++ Macro file: xxxx.eps file generated ; where xxxx is the name above.
instead of an eps file.
More over, the problem doesn’t seem to be related with the fact that you run iin batch mode or not. So just by replacing the name I got the problem with the command:
root -l latex.C

Is there any prescription about the names to give to eps files or is it more likely a root bug?


Can you try with a more recent ROOT version ? I cannot reproduce your problem even with a very very long name containing dots and “_”

I tried with root 4.00/02 and again I got a C++ Macro file instead of the eps I asked for…


Sorry for this second post. I guess the problem is not (at least not only) related with the length of the name but more likely eith the name of the subdirectories you uses, but I still don’t know exactly the perfect dosage of “_”, “.”, numbers and subdirectories…



Fabrice is not running with the ROOT main program. He has his main executable.
My guess is that he does not create a TApplication (or TRint) object.
As a result, the plug-in manager does not exist and the auto-loading of the postscript/etc
drivers does not work.

Fabrice, please have examples of main programs using ROOT in $ROOTSYS/test


The point is that I have the problem when I just use the example quoted above by launching the routine latex.C with:

root -l latex.C

and in this case I run the root main progam…


We cannot reproduce your problem here. I have even tried to create a file name like yours, and it works. Are you sure your environment is correct ? are your environment variables pointing are the right places ? (ROOTSYS, LD_LIBRARY_PATH etc …)


I am using v. 5.34/32 and I’ve encountered the same problem. Instead of saving it using


I used

c->Print(“xxx.eps”, "eps);

and it worked.