From: Johan Engelen Date: Tue, 29 Jun 2010 21:50:45 +0000 (+0200) Subject: pdf/ps/eps+latex: output tex code to ".pdf_tex" instead of to ".tex" X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=4072e7310cc222d31afc3b4364e492b41de3d5c8;p=inkscape.git pdf/ps/eps+latex: output tex code to ".pdf_tex" instead of to ".tex" --- 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 .tex. + * @param filename This should be the filename without '_tex' extension to which the tex code should be written. Output goes to _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{.tex}\n" +"%% \\input{.pdf_tex}\n" "%% instead of\n" "%% \\includegraphics{.pdf}\n" "%% To scale the image, write\n" "%% \\def{\\svgwidth}{}\n" -"%% \\input{.tex}\n" +"%% \\input{.pdf_tex}\n" "%% instead of\n" "%% \\includegraphics[width=]{.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{}{.tex}\n" +"%% \\import{}{.pdf_tex}\n" "%% Alternatively, one can specify\n" "%% \\graphicspath{{/}}\n" "%% \n"