summaryrefslogtreecommitdiffstats
path: root/src/extension
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2010-06-29 21:50:45 +0000
committerJohan Engelen <goejendaagh@zonnet.nl>2010-06-29 21:50:45 +0000
commit62dc9985efff58d201f5272baebfcbeed8de8c82 (patch)
treed265d2c8b67330b0597c93ea52b012ec2e0fc90c /src/extension
parentminor fix in Dutch translation of win32 installer (diff)
downloadinkscape-62dc9985efff58d201f5272baebfcbeed8de8c82.tar.gz
inkscape-62dc9985efff58d201f5272baebfcbeed8de8c82.zip
pdf/ps/eps+latex: output tex code to ".pdf_tex" instead of to ".tex"
Fixed bugs: - https://launchpad.net/bugs/595312 (bzr r9547)
Diffstat (limited to 'src/extension')
-rw-r--r--src/extension/internal/cairo-ps-out.cpp14
-rw-r--r--src/extension/internal/cairo-renderer-pdf-out.cpp7
-rw-r--r--src/extension/internal/latex-text-renderer.cpp10
3 files changed, 8 insertions, 23 deletions
diff --git a/src/extension/internal/cairo-ps-out.cpp b/src/extension/internal/cairo-ps-out.cpp
index 61760e9d9..16adebac3 100644
--- a/src/extension/internal/cairo-ps-out.cpp
+++ b/src/extension/internal/cairo-ps-out.cpp
@@ -195,12 +195,7 @@ CairoPsOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar con
// Create LaTeX file (if requested)
if (new_textToLaTeX) {
- gchar * tex_filename;
- //strip filename of ".ps", do not add ".tex" here.
- gsize n = g_str_has_suffix(filename, ".ps") ? strlen(filename)-3 : strlen(filename);
- tex_filename = g_strndup(filename, n);
- ret = latex_render_document_text_to_file(doc, tex_filename, new_exportId, new_areaDrawing, new_areaPage, false);
- g_free(tex_filename);
+ ret = latex_render_document_text_to_file(doc, filename, new_exportId, new_areaDrawing, new_areaPage, false);
if (!ret)
throw Inkscape::Extension::Output::save_failed();
@@ -283,12 +278,7 @@ CairoEpsOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar co
// Create LaTeX file (if requested)
if (new_textToLaTeX) {
- gchar * tex_filename;
- //strip filename of ".eps", do not add ".tex" here.
- gsize n = g_str_has_suffix(filename, ".eps") ? strlen(filename)-4 : strlen(filename);
- tex_filename = g_strndup(filename, n);
- ret = latex_render_document_text_to_file(doc, tex_filename, new_exportId, new_areaDrawing, new_areaPage, false);
- g_free(tex_filename);
+ ret = latex_render_document_text_to_file(doc, filename, new_exportId, new_areaDrawing, new_areaPage, false);
if (!ret)
throw Inkscape::Extension::Output::save_failed();
diff --git a/src/extension/internal/cairo-renderer-pdf-out.cpp b/src/extension/internal/cairo-renderer-pdf-out.cpp
index 808590e04..e8eff20b7 100644
--- a/src/extension/internal/cairo-renderer-pdf-out.cpp
+++ b/src/extension/internal/cairo-renderer-pdf-out.cpp
@@ -213,12 +213,7 @@ CairoRendererPdfOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc,
// Create LaTeX file (if requested)
if (new_textToLaTeX) {
- gchar * tex_filename;
- //strip filename of ".pdf", do not add ".tex" here.
- gsize n = g_str_has_suffix(filename, ".pdf") ? strlen(filename)-4 : strlen(filename);
- tex_filename = g_strndup(filename, n);
- ret = latex_render_document_text_to_file(doc, tex_filename, new_exportId, new_exportDrawing, new_exportCanvas, true);
- g_free(tex_filename);
+ ret = latex_render_document_text_to_file(doc, filename, new_exportId, new_exportDrawing, new_exportCanvas, true);
if (!ret)
throw Inkscape::Extension::Output::save_failed();
diff --git a/src/extension/internal/latex-text-renderer.cpp b/src/extension/internal/latex-text-renderer.cpp
index bebc21f2f..0d98f6b9c 100644
--- a/src/extension/internal/latex-text-renderer.cpp
+++ b/src/extension/internal/latex-text-renderer.cpp
@@ -51,7 +51,7 @@ namespace Internal {
/**
* This method is called by the PDF, EPS and PS output extensions.
- * @param filename This should be the filename without extension to which the tex code should be written. Output goes to <filename>.tex.
+ * @param filename This should be the filename without '_tex' extension to which the tex code should be written. Output goes to <filename>_tex, note the underscore instead of period.
*/
bool
latex_render_document_text_to_file( SPDocument *doc, gchar const *filename,
@@ -132,7 +132,7 @@ LaTeXTextRenderer::setTargetFile(gchar const *filename) {
_filename = g_path_get_basename(filename);
- gchar *filename_ext = g_strdup_printf("%s.tex", filename);
+ gchar *filename_ext = g_strdup_printf("%s_tex", filename);
Inkscape::IO::dump_fopen_call(filename_ext, "K");
FILE *osf = Inkscape::IO::fopen_utf8name(filename_ext, "w+");
if (!osf) {
@@ -176,12 +176,12 @@ LaTeXTextRenderer::setTargetFile(gchar const *filename) {
static char const preamble[] =
"%% To include the image in your LaTeX document, write\n"
-"%% \\input{<filename>.tex}\n"
+"%% \\input{<filename>.pdf_tex}\n"
"%% instead of\n"
"%% \\includegraphics{<filename>.pdf}\n"
"%% To scale the image, write\n"
"%% \\def{\\svgwidth}{<desired width>}\n"
-"%% \\input{<filename>.tex}\n"
+"%% \\input{<filename>.pdf_tex}\n"
"%% instead of\n"
"%% \\includegraphics[width=<desired width>]{<filename>.pdf}\n"
"%%\n"
@@ -190,7 +190,7 @@ static char const preamble[] =
"%% installed) using\n"
"%% \\usepackage{import}\n"
"%% in the preamble, and then including the image with\n"
-"%% \\import{<path to file>}{<filename>.tex}\n"
+"%% \\import{<path to file>}{<filename>.pdf_tex}\n"
"%% Alternatively, one can specify\n"
"%% \\graphicspath{{<path to file>/}}\n"
"%% \n"