On Monday 17 October 2005 09:34 am, Francesc Serra Graells wrote:
....
After some tests, I think that a transparent way to implement the above feature could be through the following script:
- Open a text box to input TeX commands (e.g. text)
- Run copy header.tex + text + footer.tex > clip.tex
- Run pdfelatex clip.tex
- Run pstoedit -dt -f svg clip.pdf clip.svg
- File-Import: clip.svg
- Run delete clip.*
where header.tex could be something like:
\documentclass{article} \usepackage[latin1]{inputenc} \usepackage[english]{babel} \usepackage[T1]{fontenc} \begin{document} \thispagestyle{empty}
and footer.tex:
\end{document}
I have tested this path manually under MSWindows using pstoedit 3.42 without problems. I know the SVG backend of pstoedit is not freeware, but as long as text is converted to curves by -dt, the output does not seem distorted (e.g. fontname distortion).
Does Inkscape supply any scripting to perform all the above tasks in order to integrate them as a simple menu option?
Thanks for your answers.
Best regards,
Paco
Hi myself,
The best way to implement it is through the scripting extensions of Inkscape! For that purpose, I have created the latex2svg.inx file in the extensions directory, containing:
<inkscape-extension> <name>LaTeX to SVG</name> <id>org.inkscape.input.tex</id> <dependency type="executable" location="extensions">latex2svg.pl</dependency> <param name="header" type="string" gui-text=" LaTeX preamble: ">""latex2svg-header.tex""</param> <param name="source" type="string" gui-text=" LaTeX source: ">""$\displaystyle \frac{\pi}{\pi}=1$""</param> <param name="basename" type="string" gui-text=" Temp Basename: ">""latex2svg-clip""</param> <effect> <object-type>all</object-type> </effect> <script> <command reldir="extensions" interpreter="perl">latex2svg.pl</command> </script> </inkscape-extension>
and also the Perl file latex2svg.pl in the same directory to implement the initial script. Unfortunately, I still have a problem (maybe out of topic) when passing the three parameters to Perl! In order to parse them, I use the following code inside latex2svg.pl:
use Getopt::Long;
GetOptions("header" => $LaTeXHeader, "source" => $LaTeXSource, "basename" => $TempBaseName);
However, after executing 'Effects->LaTeX to SVG' from the Inkscape menu and accepting the correct fill-form window, the following message is returned from Perl:
Option header does not take an argument Option source does not take an argument Option basename does not take an argument
Then, changing the above Perl code by:
die("$ARGV[0] $ARGV[1] $ARGV[2] $ARGV[3] \n");
the answer is:
--header="latex2svg-header.tex" --source="$\displaystyle \frac{\pi}{\pi}=1$" --basename="latex2svg-clip"
which seems correct! Any idea??
Thanks in advance,
Paco