Slightly Strange Idea: Embed ".C" format into produced graphical files

I usually save plots in .pdf format because I can reasonably assume when I email them to colleagues, they will be able to open them. Unfortunately the same cannot be said for .C or .root files (the colleagues may not have ROOT installed). Thus I often end up saving parallel .C and .pdf when using the TCanva::SaveAs method.

Unfortunately I get lazy (as anyone would) and usually just save in .pdf form, but then when I later need to edit the plot (e.g. my supervisor says my colours are ugly, or font size is hard to read, or change label), this is now difficult. Sometimes the exact script that made the plot is available to be re-run, but sometimes it is not (or it is expensive to run).

My proposal is this: when saving a plot in a graphical format like .pdf or .(e)ps, is it possible to also embed the “.C” format in the same file? Then ROOT could be configured to look for the .C format information if you ask it to open a .pdf or .eps file.


  1. am fully aware that this is me looking for a technical solution to a human-organization problem, but maybe others think this is a good idea
  2. I don’t really know how much the .pdf file size would be inflated by this procedure. Certainly it would be optional (e.g. SaveAs(“foo.pdf+C”) or some such syntax) to avoid making everyone’s pdfs bigger.
  3. I don’t know enough about graphical file formats to know when this is actually possible. Certainly for ps/eps, the “.C” information could be contained in specially-formatted comments for example.


The quick answer to this is “No”…

Let me try to elaborate a bit:

It may increase the size of the file a lot.
How should it be saved in the file ? as comments ? Realise that for PS the comments are used to structure the documents and a complete macro saved that way may disturb the PS readers… but assume it does not… How will it be used later ? ROOT should be able to extract the macro from the file ? … you would type “.x” ? … sounds weird
For Pdf it is even more tricky because the PDF format is very strict and each byte is counted, some part of the file is even binary compressed…
Seems to me a such feature will introduce a lot of side effects for very little advantages… you can always write a macro which generate both files.
PS and PDF are the final output. They are not meant to be change (or only a little via specialised editors)>