TMathText and transparency on the same PDF

Hi ROOT folks,

I have a plot that I need output as a (vector) PDF. It needs to have the curly “\ell” character, which as far as I know is only available with TMathText, which doesn’t work with PDF. This is ok: I print the canvas as an .eps file and it’s easy to convert it to what I need with a call to epstopdf after ROOT as saved the .eps.

Now I also need to add a couple of transparent elements to the plot, which works if you print directly to PDF but as I understand it doesn’t work for EPS.

Is there a way to do this? TMathText doesn’t work for SVG either, and the need for a vector PDF rules out most of the other options. I don’t mind converting to PDF after the fact with something like epstopdf or rsvg-convert but I’m not sure what else to try.

Thanks,
Nate

It looks like a “chicken and egg” problem …

The immediate solution I am thinking about would be to go to a png output but that’s not vector graphics and I understand you do not want that.

png2pdf converter exists but the generated pdf will be some bitmap inside a pdf file… not what you need.

Using an other character than \ell is not acceptable either …

I guess trying to avoid transparency is not an option too…

I just emailed the author of TMathText to ask him if he can have a other look on the possibility to have it working for PDF.

Thanks for taking a look! It will be really nice if you can get TMathTex working for PDF and/or SVG. Unfortunately, I really do need a vector PDF as it’s a requirement for the journal, so the raster-to-PDF idea won’t work.

I managed to get something reasonable by saving the canvas as a .tex, embedding that into an otherwise empty LaTeX file and compiling that file to a PDF. It’s a few extra steps, but it seems to preserve both histogram transparency and TeX characters. Because I know others have had this issue and might be interested, the frame file I used to compile contains simply (for a canvas printed to c.tex)

\documentclass[tikz]{standalone}
\usepackage{amsmath}
\usepackage{standalone}
\usetikzlibrary{patterns}
\usetikzlibrary{plotmarks}
\begin{document}
  \input{c.tex}
\end{document}

and is compiled by pdflatex as long as you have the standalone package (if you don’t, you just have to import the tikz packages and set the pagesize and margins yourself).

It would be cool to have an option in ROOT to include the few lines at the beginning and end to make the .tex compilable out-of-the-box, but I think this is an easy enough workaround.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.