summaryrefslogtreecommitdiff
path: root/support/autolatex/translators/svg2pdf+tex_inkscape.transdef
diff options
context:
space:
mode:
Diffstat (limited to 'support/autolatex/translators/svg2pdf+tex_inkscape.transdef')
-rw-r--r--support/autolatex/translators/svg2pdf+tex_inkscape.transdef63
1 files changed, 63 insertions, 0 deletions
diff --git a/support/autolatex/translators/svg2pdf+tex_inkscape.transdef b/support/autolatex/translators/svg2pdf+tex_inkscape.transdef
new file mode 100644
index 0000000000..da5c2f7ab7
--- /dev/null
+++ b/support/autolatex/translators/svg2pdf+tex_inkscape.transdef
@@ -0,0 +1,63 @@
+# autolatex - svg2pdf+tex_inkscape.transdef
+# Copyright (C) 2013 Stephane Galland <galland@arakhne.org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+#--------------------------------------------
+# See template.txt for details on the fields
+#--------------------------------------------
+
+INPUT_EXTENSIONS = .svgt .svg_t .svgtex .svg+tex .tex.svg +tex.svg .svgzt .svgz_t .svgztex .svgz+tex .tex.svgz +tex.svgz
+
+OUTPUT_EXTENSIONS for pdf = .pdf .pdftex_t
+OUTPUT_EXTENSIONS for eps = .eps .pstex_t
+
+TRANSLATOR_FUNCTION =<<EOL {
+ my ($ext1, $ext2, $opt);
+ if ($ispdfmode) {
+ $ext1 = '.pdf_tex';
+ $ext2 = '.pdftex_t';
+ $opt = '--export-pdf';
+ }
+ else {
+ $ext1 = '.eps_tex';
+ $ext2 = '.pstex_t';
+ $opt = '--export-eps';
+ }
+ # Compute the name of the generated PDFTEX file
+ my $pdftexfile = File::Spec->catfile(
+ dirname("$in"),
+ basename("$out", @outexts).$ext1);
+ # Compute the name of the generated PDFTEX file
+ my $pdftexfile2 = File::Spec->catfile(
+ dirname("$in"),
+ basename("$out", @outexts).$ext2);
+ # Generation of the output from SVG
+ runCommandOrFail(
+ 'inkscape',
+ '--without-gui',
+ '--export-area-page',
+ $opt,
+ "$out",
+ '--export-latex',
+ "--file=$in");
+ # Remove temp file
+ move("$pdftexfile", "$pdftexfile2") or printErr("$pdftexfile -> $pdftexfile2: $!");
+}
+EOL
+
+FILES_TO_CLEAN = $out.pdftex_t $out.pstex_t
+