pdfrack = a hack for using psfrag and pdflatex By Marc Boyer-Gandon (Marc.Boyer@enseeiht.fr) pdfrack is a hack designed to help the psfrag users to be able to compile their documents with pdflatex. It should not be considered as a "solution" for using psfrag and pdftex, but as a "hack" developed for my personal use that can save your time also. Please, register yourself by sending me an email with [pdfrack] in the subject if you use it. Do not hesitate to send me an email to ask for improvements or to report bugs. I will fix it if I can (but I am not at all a (La)TeX wizard). --------------------- WARNING MAKE A BACKUP OF YOUR FILES BEFORE USING THIS SCRIPTS ! --------------------- Version: 0.4: User Changes: - Add of the -M option, to handle \input, \include... - Better documentation Version: 0.3.2.2: User Changes: - Better documentation Version: 0.3.2.1: Implementation changes: - respect of the recommandations from "LaTeX2e for class and package writers" Version: 0.3.2: User Changes: - add of the 'header option' Version: 0.3.1.1: Bug fixed: - a minor bug in test "testDoubleImage.tex" fixed Version: 0.3.1: User Changes: - Minor messages changes - automatic use of ps2eps if installed Version: 0.2 User Changes: - This version should allow you to put several pictures (with includegraphics) in a single figure environment. - Added the -p -e and -k options Implementation changes: - Added a function "compileOneFigure()" - Use of mktemp (if possible) Table of Contents I. What does it do ? II. How to use it ? III. What is required ? IV. Why this name ? V. How to improve it ? VI. Temporary files VII. Bugs I. What does it do ? -------------------- The main idea of the script is to scan your source file to find the figures included and, for each figure, to make a single latex file with only the figure and to generate a pdf figure that takes into account the psfrag replacements. Then, using pdflatex, you just include the pdf figure. It is not optimal at all, but is sufficient to me. II. How to use it ? ------------------- Put the script pdfrack.sh in a directory included in your path, and pdfrack.sty somewhere where TeX will find it. a) Your latex source files In your (la)tex source file, you should include pdfrack.sty (it will include the graphicx package). You also should include psfrag.sty. The pictures that you want to translate must be between two lines \begin{figure} \end{figure} and must be included using \pdfrackincludegraphics (that has exactly the same syntax as \includegraphics) but *without* the .eps. b) Running the script pdfrack.sh Then, you should run the script pdfrack.sh on your latex source file. It will generates the figures in pdf format. It sometimes fails :-( There could be two reasons: - the translation from dvi to pdf fails, you should try to put options -p and/or -e, and options -m n, with n in 0..3 ; but that is not my job :-) - the generated latex code is wrong, and this is my fault, you can fix the script or email me Note that the '%' is is general seen as a comment, even if prefixed with \. So, avoid to use it. If your LaTeX code is too complex (if your figures environments are in included files for example), then, pdfrack will ne be able to handle it. Then, you should write a simpler LaTeX file, with your figure(s) and use this file to generate the pdf figures. c) Running pdflatex Then, you could run pdflatex on your file. III. What is required ? ----------------------- The pdfrack.sh script uses a lot of other scripts and software. cut, dvips, epstopdf, grep, head, latex, ps2ps, ps2epsi, sort, tail, and, first of all, a bourne shell... Sorry for Win* users. They should install solutions like Cygwin, or try a Linux distribution. IV. Why this name ? ------------------- I think a good solution for using pdflatex and psfrag should be named "pdfrag" or "pdffrag". I do not think that my solution is good. It is just a hack. Then pdfrack comes from: pdf + psfrag + hack --------- pdfrack V. How to improve it ? ---------------------- pdfrack can not be considered as a package, but as the first step of what will perhaps one day become a solution. You can change the code for your own purpose, and email me your improvement if you think it could help someone else. You can ask me some improvements, and I will try to do it. VI. Temporary files ----------------- This script creates a lot of temporary files in the current directory. It could then overwrite an existing file. If your input is called "paper.tex", the script will create (and remove if -k is not set) the files: paper.tex.header paper.tex.figlines paper.tex.figure And for each figure fig.eps used (with "\pdfrackincludegraphics[..]{fig}"), it will creates (and remove, if -k is not set) fig.tex fig.log fig.aux fig.dvi VII. Bugs --------- It seems that there are troubles when using draftcopy and pdfdraftcopy...