Michael Schmitt wrote: > - Please add the following two converters to complete Tgif support > Tgif -> EPS: tgif -print -eps $$i > Tgif -> PDF: tgif -print -pdf $$i
done > When starting with a tgif file, pdflatex produces bad output; starting with an what is "bad output"? > eps file (generated by tgif), pdflatex output looks OK; why? which converters > are actually invoked? Are bitmap formats involved? the attached patch gives full support to a lot of graphic formats. from lyxrc.defaults: \converter agr eps "xmgrace -hardcopy -hdevice EPS $$i" "" \converter bmp eps "convert BMP:$$i EPS:$$o" "" \converter fits eps "convert FITS:$$i EPS:$$o" "" \converter gif eps "convert GIF:$$i EPS:$$o" "" \converter jpg eps "convert JPG:$$i EPS:$$o" "" \converter pbm eps "convert PBM:$$i EPS:$$o" "" \converter pgm eps "convert PGM:$$i EPS:$$o" "" \converter png eps "convert PNG:$$i EPS:$$o" "" \converter ppm eps "convert PPM:$$i EPS:$$o" "" \converter sgi eps "convert SGI:$$i EPS:$$o" "" \converter tgif eps "tgif -print -eps $$i" "" \converter tiff eps "tiff2ps $$i > $$o" "" \converter xwd eps "convert XWD:$$i EPS:$$o" "" \converter tgif gif "tgif -print -gif $$i" "" \converter tgif pdf "tgif -print -pdf $$i" "" Herbert -- http://www.lyx.org/help/
Index: lib/ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/ChangeLog,v retrieving revision 1.162 diff -u -r1.162 ChangeLog --- lib/ChangeLog 2002/02/13 14:34:22 1.162 +++ lib/ChangeLog 2002/02/24 09:43:14 @@ -1,3 +1,7 @@ +2002-02-23 Herbert Voss <[EMAIL PROTECTED]> + + * configure.m4: added converter stuff for different formats + 2002-02-13 José Matos <[EMAIL PROTECTED]> * examples/linuxdoc_manpage.lyx: added Index: lib/configure.m4 =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/configure.m4,v retrieving revision 1.29 diff -u -r1.29 configure.m4 --- lib/configure.m4 2002/01/31 14:20:08 1.29 +++ lib/configure.m4 2002/02/24 09:43:14 @@ -355,7 +355,7 @@ #### Search for image conversion #### SEARCH_PROG([for an Image -> EPS converter], TOEPS, convert pnmtops) case $TOEPS in - convert) gif_to_eps="convert GIF:\$\$i EPS:\$\$o" png_to_eps="convert PNG:\$\$i EPS:\$\$o" jpg_to_eps="convert JPG:\$\$i EPS:\$\$o";; + convert) bmp_to_eps="convert BMP:\$\$i EPS:\$\$o" fits_to_eps="convert +FITS:\$\$i EPS:\$\$o" gif_to_eps="convert GIF:\$\$i EPS:\$\$o" jpg_to_eps="convert +JPG:\$\$i EPS:\$\$o" pbm_to_eps="convert PBM:\$\$i EPS:\$\$o" pgm_to_eps="convert +PGM:\$\$i EPS:\$\$o" png_to_eps="convert PNG:\$\$i EPS:\$\$o" ppm_to_eps="convert +PPM:\$\$i EPS:\$\$o" sgi_to_eps="convert SGI:\$\$i EPS:\$\$o" xwd_to_eps="convert +XWD:\$\$i EPS:\$\$o" ;; pnmtops) gif_to_eps="giftopnm \$\$i | pnmtops > \$\$o" png_to_eps="pngtopnm \$\$i | pnmtops >\$\$o" jpg_to_eps="jpegtopnm \$\$i | pnmtops >\$\$o";; esac @@ -452,11 +452,14 @@ \\Format text txt ASCII A \\Format textparagraph txt ASCII(paragraphs) "" \\Format docbook sgml DocBook B +\\Format bmp bmp BMP "" \\Format dvi dvi DVI D \\Format eps eps EPS "" -\\Format epsi epsi EPSI "" +\\Format epsi epsi EPSI "" \\Format fax "" Fax "" +\\Format fits fits FITS "" \\Format gif gif GIF "" +\\Format grace agr GRACE "" \\Format html html HTML H \\Format jpg jpg JPEG "" \\Format latex tex LaTeX L @@ -466,10 +469,17 @@ \\Format pdf pdf PDF P \\Format pdf2 pdf "PDF (pdflatex)" F \\Format pdf3 pdf "PDF (dvipdfm)" m +\\Format pbm pbm PBM "" +\\Format pgm pgm PGM "" \\Format png png PNG "" +\\Format ppm ppm PPM "" \\Format ps ps Postscript t \\Format program "" Program "" +\\Format sgi sgi SGI "" +\\Format tgif tgif TGIF "" +\\Format tiff tif TIFF "" \\Format xpm xpm XPM "" +\\Format xwd xwd XWD "" \\Format word doc Word W \\converter latex dvi "$latex_to_dvi" "latex" @@ -492,9 +502,22 @@ \\converter html latex "$html_to_latex_command" "" \\converter word latex "$word_to_latex_command" "" +\\converter agr eps "xmgrace -hardcopy -hdevice EPS \$\$i" "" +\\converter bmp eps "$bmp_to_eps" "" +\\converter fits eps "$fits_to_eps" "" \\converter gif eps "$gif_to_eps" "" -\\converter png eps "$png_to_eps" "" \\converter jpg eps "$jpg_to_eps" "" +\\converter pbm eps "$pbm_to_eps" "" +\\converter pgm eps "$pgm_to_eps" "" +\\converter png eps "$png_to_eps" "" +\\converter ppm eps "$ppm_to_eps" "" +\\converter sgi eps "$sgi_to_eps" "" +\\converter tgif eps "tgif -print -eps \$\$i" "" +\\converter tiff eps "tiff2ps \$\$i > \$\$o" "" +\\converter xwd eps "$xwd_to_eps" "" + +\\converter tgif gif "tgif -print -gif \$\$i" "" +\\converter tgif pdf "tgif -print -pdf \$\$i" "" \\converter gif png "$gif_to_png" "" \\converter eps png "$eps_to_png" "" Index: src/support/ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/ChangeLog,v retrieving revision 1.74 diff -u -r1.74 ChangeLog --- src/support/ChangeLog 2002/02/20 16:34:53 1.74 +++ src/support/ChangeLog 2002/02/24 09:43:17 @@ -1,3 +1,7 @@ +2002-02-23 Herbert Voss <[EMAIL PROTECTED]> + + * filetools.C: added more graphic formats + 2002-02-18 Herbert Voss <[EMAIL PROTECTED]> * filetools.C: (getExtFromContents) return the fileextension Index: src/support/filetools.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/filetools.C,v retrieving revision 1.105 diff -u -r1.105 filetools.C --- src/support/filetools.C 2002/02/20 16:34:53 1.105 +++ src/support/filetools.C 2002/02/24 09:43:17 @@ -966,16 +966,24 @@ // the different filetypes and what they contain in one of the first lines // (dots are any characters). (Herbert 20020131) +// AGR Grace... +// BMP BM... // EPS %!PS-Adobe-3.0 EPSF... -// TGIF %TGIF... +// FITS ...BITPIX... // GIF GIF... -// GRACE Grace ... // JPG JFIF // PDF %PDF-... // PNG .PNG... +// PBM P1... or P4 (B/W) +// PGM P2... or P5 (Grayscale) +// PPM P3... or P6 (color) // PS %!PS-Adobe-2.0 or 1.0, no "EPSF"! +// SGI \001\332... (decimal 474) +// TGIF %TGIF... +// TIFF II... or MM... // XBM ... static char ... // XPM /* XPM */ +// XWD \000\000\000\151 (0x00006900) // // GZIP \037\213\010\010... http://www.ietf.org/rfc/rfc1952.txt // ZIP PK... http://www.halyava.ru/document/ind_arch.htm @@ -996,33 +1004,63 @@ int const max_count = 50; // Maximum strings to read int count = 0; // Counter of attempts. string str; - bool zipChecked = false; + bool firstLine = true; for (; count < max_count; ++count) { if (ifs.eof()) { - lyxerr[Debug::GRAPHICS] << "filetools(getExtFromContents)" - " End of file reached and it wasn't found to be a known Type!" << endl; + lyxerr[Debug::GRAPHICS] << "filetools(getExtFromContents)\n" + "\tEnd of file reached and it wasn't found a known +Type!" << endl; break; } ifs >> str; - if (!zipChecked) { + if (firstLine) { // at first we check for a zipped file, because this information // is saved in the first bytes of the file! + // also some graphic formats which save the information + // in the first line, too. if (str.substr(0,4) == gzipStamp) return "gzip"; - else if (str.substr(0,2) == zipStamp) + string const stamp = str.substr(0,2); + if (stamp == zipStamp) return "zip"; - else if (str.substr(0,2) == compressStamp) + else if (stamp == compressStamp) return "compress"; - zipChecked = true; + // the graphics part + else if (stamp == "BM") + return "bmp"; + else if (str.at(0) == 'P') { // PBM family + switch (str.at(1)) { + case '1': + case '4': + return "pbm"; + break; + case '2': + case '5': + return "pgm"; + break; + case '3': + case '6': + return "ppm"; + break; + default: ; // do nothing + } + } + if (stamp == "\001\332") + return "sgi"; + else if ((stamp == "II") || (stamp == "MM")) + return "tiff"; + else if (str.substr(0,3) == "GIF") + return "gif"; + else if ((str.at(3) == 'i') && (str.at(0) == '\000') && + (str.at(1) == '\000') && (str.at(2) == '\000')) + return "xwd"; + firstLine = false; } if (contains(str,"EPSF")) // dummy, if we have wrong file return "eps"; // description like "%!PS-Adobe-2.0EPSF" else if (contains(str,"TGIF")) return "tgif"; - else if (contains(str,"GIF")) - return "gif"; else if (contains(str,"Grace")) - return "grace"; + return "agr"; else if (contains(str,"JFIF")) return "jpg"; else if (contains(str,"%PDF")) @@ -1039,6 +1077,8 @@ return "xbm"; else if (contains(str,"XPM")) return "xpm"; + else if (contains(str,"BITPIX")) + return "fits"; } lyxerr[Debug::GRAPHICS] << "filetools(getExtFromContents)\n" "\tCouldn't find a known Type!"