Is it possible to use figures exported from LibreOffice draw with pstool in LaTeX documents?

asked 2019-01-18 12:38:21 +0100

WZab gravatar image

updated 2019-01-18 12:49:19 +0100

I have a relatively complex diagram created in LibreOffice Draw (I use that tool, because it has a very nice implementation of connectors automatically adapting to moving objects). I attach the simplified ODG drawing that shows the problem: C:\fakepath\trial.odg

I need to use it in my LaTeX document, but I also need to replace some text placeholders in the diagram with LaTeX generated text. I wanted, as usual, to use pstool for that task. The minimized LaTeX document showing the problem is as follows:

\documentclass{article}
\usepackage{pstool}
\usepackage{hyperref}
\begin{document}
\psfragfig*{trial}{
   \psfrag{sec:b1}{See section ~\ref{sec:bl1}}
   \psfrag{sec:b2_long_placeholder}{See section ~\ref{sec:bl2}}
   \psfrag{eq1}{{\Huge $y=x^{z^v}$}}
}

Some random text before the section.
\pagebreak
\section{Block 1}
\label{sec:bl1}
Here should be description of the block 1.
\pagebreak
\section{Block 2}
\label{sec:bl2}
Here should be description of the block 2.

\end{document}

When I export the diagram to the EPS file with:

lodraw --headless --convert-to eps trial.odg

I get the EPS file with all the text "dissolved". It seems that the export filter converts all the strings into single characters or even splines. When I later process it with:

latex --sheel-escape test.tex
latex --sheel-escape test.tex
dvipdf test.dvi

I get the "placeholders" not replaced: Incorrectly processed image

I have managed to partially solve the problem by exporting the diagram first in the SVG format, and then converting it to EPS:

lodraw --headless --convert-to svg trial.odg
inkscape -z  -Etrial.eps -f trial.svg
latex --sheel-escape test.tex
latex --sheel-escape test.tex
dvipdf test.dvi

However, that solution is also not foolproof. For example the placeholder "sec:b2_long_placeholder" was converted to "(sec:b2_lon)-3(g_place)-3(holder)" instead of just "(sec:b2_long_placeholder)". It seems that short placeholders are converted correctly, but longer ones are broken:

Partially correctly processed image

Is it possible to mark selected strings as "protected" so that they will be passed untouched into EPS file so that they can be used with pstool?

edit retag flag offensive close merge delete

Comments

It seems, that in the case of workaround based on SVG, the problem with breaking long placeholders is caused by the Inkscape. The generated SVG file contains all placeholders as single strings. It is Inkscape who splits strings with length over 6 characters (?) into shorter strings. Of course it does not solve the main problem - why it is not possible to generate the pstool-compatible EPS file directly.

WZab gravatar imageWZab ( 2019-01-18 16:05:11 +0100 )edit