eps/ps/pdf+LaTeX format overwrites a file

Bug #595312 reported by alejandro.erickson@gmail.com on 2010-06-16
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Johan Engelen

Bug Description

I'm VERY grateful for this feature and will abandon xfig for inkscape if it works properly.

This is for 0.47+devel June 16

If I have a file named foo.tex it will be overwritten without warning when I Save (or Save As) eps/ps/pdf and select the new +LaTeX export feature. This can be a problem if I decided to manually change foo.tex after a previous save, or I simply had a foo.tex before making the Inkscape document of the same name.

xfig had a partial fix for this by calling this file foo.pstex_t or something (that prevents someone who is adding the picture foo.eps to the LaTeX document foo.tex from killing their LaTeX document).

su_v (suv-lp) on 2010-06-17
tags: added: exporting latex
Johan Engelen (johanengelen) wrote :

the problem of manually changing foo.tex after previous save cannot be solved.

the overwriting is a problem indeed. especially for new users that name their svg like their document...
I'll see if i can fix it. (such that it works like it would for an already existing eps/ps/pdf document)

Johan Engelen (johanengelen) wrote :

should i save the file foo.tex as foo.tex_t instead or something?
It seems to be the easiest fix, but then I will have to change the ctan document accordingly, and all my files that already use the feature too..... :(

Johan Engelen (johanengelen) wrote :

(note to self: search for "sp_ui_overwrite_file")

It does sound like a pain. maybe you want to wait until 1. you get another bug that requires changing those documents and 2. a couple more people complain about this.

xfig's thing is to export pairs: (foo.pstex, foo.pstex_t). I always thought this was weird because a ps file should end with .ps. This seems less important with a tex file.

I might be wrong here but someone might want to export to pdf+LaTeX and eps+LaTeX for a choice of compiling with the pdflatex or latex commands, so writing to foo.tex_t for both of them would require manual intervention. .pstex and .pdftex would have been my favourite choices but they are taken by xfig.

I'll suggest foo.ps_t, foo.eps_t, foo.pdf_t. The underscore is a good indication that foo.eps is related to foo.eps_t and I think that foo.eps_tex is overdoing it. I hope there will be some input from others on this first though. Great feature though - I have already deleted xfig because of this :-D.

Johan Engelen (johanengelen) wrote :

:) thanks for your helpful input.
adding 'pdf' or 'eps' to the extension makes sense indeed.
I think I will change it, I have to be fast, otherwise it is too late for 0.48 release...
I think I will go for the long "pdf_tex", seems most descriptive.

Johan Engelen (johanengelen) wrote :

or imagename.pdf.tex (dubble '.') ?

Johan Engelen (johanengelen) wrote :

'.pdf.tex' does not work in latex. (error on "\input{image.pdf.tex}", while no error on "\input{image.pdf_tex}")

Johan Engelen (johanengelen) wrote :

here a patch (pdflatex.patch) that makes inkscape write to ".pdf_tex" and ".eps_tex" instead.

Changed in inkscape:
assignee: nobody → Johan Engelen (johanengelen)
su_v (suv-lp) on 2010-06-27
Changed in inkscape:
importance: Undecided → Medium
milestone: none → 0.48
status: New → In Progress
Johan Engelen (johanengelen) wrote :

patch committed in r9547

Changed in inkscape:
status: In Progress → Fix Released
Peter Kobel (kobilot) wrote :

For the *.tex -Files your solution is OK. But the includegraphics-command in these files, e.g. \includegraphics{figure.pdf} doesn't need the fileextension: \includegraphics{figure} will work for both: pdf-Latex and plain Latex. So i am able to use plain Latex or pdfLatex and the overwriting-Problem of the tex-files doesn't exist too. One Problem with filenames will persist: if you got a figure.pdf and a figure. png and a figure.jpg pdfLatex will choose the figure.png. Latex processes pictures with the same name but different extensions in the order png-pdf-jpg (the first existing will be used) .

Btw: was it too difficult to use some box like "Do you want to overwrite xyz.tex?"?

Johan Engelen (johanengelen) wrote :

> Btw: was it too difficult to use some box like "Do you want to overwrite xyz.tex?"?

In many cases, I *do* want Inkscape to overwrite the (previous version of the) tex and pdf file.

Although \includegraphics{figure.pdf} may work just as well without the file extension, it also may not work correctly. So why not just include the extension. I think regenerating the tex file when switching from PDF to EPS (or the other way) is much easier than having something that does not work correctly and requires manual fixing.

If you want to use this feature with both EPS and PDF, I suggest making an \includesvg macro like the one in my CTAN article on this feature. Then you can define it for EPS and PDF separately, using \ifpdf or something similar.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers