stefano franchi
2014-05-29 14:20:05 UTC
Dear all:
Prannoy just hit upon a problem in text4ht conversion of images to odt
format.
This is what text4ht should do:
1. Read the correct reference from the tex file
2. If necessary, covert the image to a suitable (bitmap) format for
inclusion in the odt file
3. copy the converted image to a proper subfolder in the odt file (which
really is a zipped archive, as you know).
The system works fine if the images are in the same directory/folder as the
.tex source file, but tex4ht gets its references screwed up otherwise. It
copies the images to the right "internal" folder (inside the odt file), but
the xml code is incorrect and libreoffice cannot find the images when you
open the file.
Rather than messing up with with tex4ht code, it seems to me the easier
workaround is to copy all the images and the tex source file to a temporary
folder and do the conversion there. This is a similar approach to what LyX
itself does before compiling LaTeX, in fact, and it is also what the native
HTML converter does, I believe.
Issues on which feedback is welcome:
0. General thoughts about the approach (copying images vs. fixing tex4ht
processing)
1. My thinking is that it may be relatively easy to do the copying by
operating on the LyX source code, i.e. via a python script scanning the
Graphics inset. That would tie the tool to the file format, though.
2. For the roundtrip conversion, we also need to keep the original filename
references and store them somewhere in the odt file (in an annotation
field). Are there any platform-related issues on filenames we should be
aware of (encoding, folder delimiters, etc)?
Cheers,
Stefano
--
__________________________________________________
Stefano Franchi
Associate Research Professor
Department of Hispanic Studies Ph: +1 (979) 845-2125
Texas A&M University Fax: +1 (979) 845-6421
College Station, Texas, USA
***@tamu.edu
http://stefano.cleinias.org
Prannoy just hit upon a problem in text4ht conversion of images to odt
format.
This is what text4ht should do:
1. Read the correct reference from the tex file
2. If necessary, covert the image to a suitable (bitmap) format for
inclusion in the odt file
3. copy the converted image to a proper subfolder in the odt file (which
really is a zipped archive, as you know).
The system works fine if the images are in the same directory/folder as the
.tex source file, but tex4ht gets its references screwed up otherwise. It
copies the images to the right "internal" folder (inside the odt file), but
the xml code is incorrect and libreoffice cannot find the images when you
open the file.
Rather than messing up with with tex4ht code, it seems to me the easier
workaround is to copy all the images and the tex source file to a temporary
folder and do the conversion there. This is a similar approach to what LyX
itself does before compiling LaTeX, in fact, and it is also what the native
HTML converter does, I believe.
Issues on which feedback is welcome:
0. General thoughts about the approach (copying images vs. fixing tex4ht
processing)
1. My thinking is that it may be relatively easy to do the copying by
operating on the LyX source code, i.e. via a python script scanning the
Graphics inset. That would tie the tool to the file format, though.
2. For the roundtrip conversion, we also need to keep the original filename
references and store them somewhere in the odt file (in an annotation
field). Are there any platform-related issues on filenames we should be
aware of (encoding, folder delimiters, etc)?
Cheers,
Stefano
--
__________________________________________________
Stefano Franchi
Associate Research Professor
Department of Hispanic Studies Ph: +1 (979) 845-2125
Texas A&M University Fax: +1 (979) 845-6421
College Station, Texas, USA
***@tamu.edu
http://stefano.cleinias.org