Francesc Serra Graells wrote:
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 (again),
#$%! it was just a Perl error. Finally, here are the files to be located
in the Inkscape\share\extensions directory:
latex2svg.inx : Inkscape extension interface
latex2svg.pl : Perl script
Also, a simple LaTeX header example is supplied (latex2svg.tex)...
This extension effectively creates the latex2svg-clip.svg file in the
selected temp directory with all the compiled LaTeX material.
The question is, how can I execute in the *.inx file an automatic
File->Import action for such a file???
Thanks in advance!
Paco
--
Dr. Francesc Serra-Graells
Integrated Circuits and Systems Group
Institut de Microelectrònica de Barcelona
Centre Nacional de Microelectrònica (CSIC)
Post: Campus UAB, E-08193 Bellaterra, Spain
Tel: +34 93 594 77 00
Fax: +34 93 580 14 96
mailto:paco.serra@...1201...
http://www.cnm.es/~pserra
<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: ">C:\Programs\Inkscape\share\extensions\latex2svg-header.tex</param>
<param name="source" type="string" gui-text=" LaTeX source: ">$\displaystyle \frac{\pi}{\pi}=1$</param>
<param name="tempdir" type="string" gui-text=" Temp dir: ">C:\Temp</param>
<effect>
<object-type>all</object-type>
</effect>
<script>
<command reldir="extensions" interpreter="perl">latex2svg.pl</command>
</script>
</inkscape-extension>
#!/usr/bin/perl
#
# latex2svg.pl, a LaTeX-to-SVG converter.
#
my $version = "2005.10.18";
use strict;
use Getopt::Long;
use File::Spec;
use File::Copy;
my $LaTeXHeader="C:\Programs\Inkscape\share\extensions\latex2svg-header.tex";
my $LaTeXSource="$\displaystyle\frac{\pi}{\pi}=1$";
my $TempDir="C:\Temp";
my $Compiler = "pdfelatex";
my $Converter = "C:\Programs\pstoedit\pstoedit";
my $TempBaseName;
my $FileId;
my $SVGline;
GetOptions("header=s" => $LaTeXHeader,
"source=s" => $LaTeXSource,
"tempdir=s" => $TempDir);
$TempBaseName=File::Spec->catfile($TempDir,"latex2svg-clip");
copy($LaTeXHeader,"$TempBaseName.tex");
open($FileId,">>$TempBaseName.tex") or die("Can't open $TempBaseName.tex!\n");
printf $FileId "$LaTeXSource\n" or die("Can't write to $TempBaseName.tex!\n");
printf $FileId "\end{document}\n" or die("Can't write to $TempBaseName.tex!\n");
close($FileId) or die("Can't close $TempBaseName.tex!\n");
system("$Compiler -output-directory=$TempDir $TempBaseName.tex");
system("$Converter -dt -f svg $TempBaseName.pdf $TempBaseName.svg");