[Tex/LaTex] Psfrag or comparable tagging method with XeTeX

psfragxetex

I understand from this question that using psfrag to replace tags in eps-files works well with pdfLaTeX. I also think I understand from this question that there was no working mechanism to accomplish the same thing using Xe(La)TeX?

I have tried nonetheless to retag an image with psfrag and the pstool workaround, and was slightly surprised by the error message Undefined control sequence which reproduceably rendered the first (and reduced to only) \psfrag command undefined. Working without pstool, the Undefined control sequence turned out to be the \includegraphics command.
Is there any workaround known for replacing eps-image tags in or around XeTeX? If possible, I would like to have the appropriate font inserted no earlier than compilation, so I can compile the document to two different pdfs with two different fonts.

May I present the following as a minimal non-working examples? They contain the only changes to the code of a working document which caused the above cited error:

Version 1: No pstool:

\usepackage{psfrag}
[... some document text]
\begin{figure}\psfrag{pfeildreiunten}{Dioxan/HCl konz}
\includegraphics{imagefilename.eps}
\caption{arbitrary caption}
\label{recognise}
\end{figure}

Version 2: with pstool:

\usepackage{psfrag}
\usepackage{pstool}
[... some document text]
\begin{figure}\psfragfig{imagefilename}{ %
\psfrag{pfeildreiunten}{Dioxan/HCl konz}}
\caption{arbitrary caption}
\label{recognise}
\end{figure}

One more pinch of information that might be useful: The eps was generated with ChemDraw. The label as I entered it was in one text box in the ChemDraw-drawing. I hope that was generaly the right usage for \psfrag.

Edit (16/07/2012)
After doing even more search engine research, I am pretty positive that I won't get psfrag or a direct workaround to work directly in XeLaTeX. Now I'm asking myself which of the following ideas would be feasible or are maybe already implemented (and I haven't found them because I'm not looking hard enough):

Idea 1:
I have no clue how text parts are handled in (E)PS or PDF files. All I know is that one can mark and search for text in PDFs, so it must be encoded in a somehow plaintext way. Is it possible to convert the EPS files I have to PDF, include them, and still tell Xe(La)TeX to look for tag xyz in the file and replace it with tag abc? If so, which packages can do that?

I have found this question which renders the answer to my idea 1 'no'.

Idea 2:
Many of the workarounds I have found are made to work with pdfLaTeX. Even some suggest creating the properly replaced text with LaTeX, creating a PDF file out of the EPS and inserting that later. Problem: I'm using one of the benefits of XeTeX, i.e. a non-TeX-standard font (Liberation family). Is it 'easy' to get this to work with LaTeX, create the correct labels, convert PDF, insert?

Before this is suggested, the following is not an immediate option:
I cannot (atm) create the images using the correct font directly. ChemDraw, which I use for generating images, is running on my Windows-based desktop, while XeLaTeX is used on my Lubuntu-based laptop (where Liberation is installed). If all else fails, I will probably resort to Arial text in graphics and leave it unfitting to the font used in the text.

Best Answer

I have found an equally good working mechanism for my problem: If I leave the original eps files blank, I can position text across them anywhere using the overpic package. Their minimalistic documentation, to be found via CTAN or other sources, tells you everything you need to know. Positioning might be tricky and trial and error, but on the other hand, graph data from gnuplot always follows the same proportions when exported via set term postscript eps (and a few other options), so I can recycle optimised coordinates.

The biggest advantage is the ability to use tags, so now my compounds are properly automatically labelled all through my schemes with the chemcompounds package.

Related Question