This post is a continuation to my earlier post here:
Creating standalone eps files and using batch files to automate the process
Xport gave good answers that work!
One goal of this whole process of automation also helps when using pdfLaTeX is used instead of the traditional tex > dvi > ps > pdf route. With TeXLive 2010, one can just issue the pdfLaTeX command and all eps files get converted on the fly to pdf and get inserted in the document.
I do not like the pdfLaTeX workflow but it compiles much faster than the traditional tex > dvi > ps > pdf route. So I have decided to use pdfLaTeX while a document is still work-in-progress and then I can use the workflow tex > dvi > ps > pdf to get the final compilation with all proper eps files inserted.
Now with pdfLaTeX, an eps file gets converted to pdf as follows:
e.g. jeffcott.eps gets converted to jeffcott-eps-converted-to.pdf and model.eps gets converted to model-eps-converted-to.pdf.
Making use of Xport batch files, I have tried to automate the above:
First we have the file automate.bat as follows:
for %%x in (*.tex) do dobatch.bat %%~nx
where the dobatch.bat is
rem echo off
latex -interaction=nonstopmode %1
dvips -R -t unknown %1
ps2pdf -dAutoRotatePages#/None -dCompatibilityLevel#1.5 -dPDFSETTINGS#/prepress -dMaxSubsetPct=100 -dSubsetFonts=true -dEmbedAllFonts=true -dEPSCrop %1.ps %1-temp.pdf
pdfcrop --restricted --hires %1-temp %1.pdf
rename %1.pdf %1-eps-converted-to.pdf
pdftops -level3 -eps %1-eps-converted-to.pdf
del %1.log
del %1.aux
del %1.dvi
del %1.ps
del %1-temp.pdf
ps2eps -f --fixps %1-eps-converted-to.eps
del %1.eps
Let's take an example to see what's happening:
Say I have the file jeffcott.eps and model.eps with unreplaced psfrag labels.
These files are here:
http://petitlien.fr/epspicture
I create the file jeffcott.tex working on jeffcott.epsas follows:
\documentclass[12pt]{standalone}
\usepackage[hiresbb,dvips]{graphicx}
\usepackage[dvips]{color}
\usepackage{psfrag}
\usepackage{fourier}
\newcommand{\figtext}{\small}
\begin{document}
{\figtext
\psfrag{A}{$m$}
\psfrag{B}{$k,c$}
\psfrag{Y}{inner stator bore}
\includegraphics{jeffcott.eps}}
\end{document}
and a similar one model.tex working on model.eps as given below:
\documentclass[12pt]{standalone}
\usepackage[hiresbb,dvips]{graphicx}
\usepackage[dvips]{color}
\usepackage{psfrag}
\usepackage{fourier}
\newcommand{\figtext}{\small}
\begin{document}
{\figtext
\psfrag{D}{$x$}
\psfrag{E}{$y$}
\psfrag{F}{$\omega_\mathrm{ro}$}
\psfrag{G}{$\omega_\mathit{fo} \thinspace t$}
\psfrag{H}{$\beta$}
\psfrag{I}{$a$}
\psfrag{J}{$r$}
\psfrag{K}{$\theta$}
\psfrag{L}{$r$}
\psfrag{M}{$\mathrm{C}_\mathrm{st}$}
\psfrag{N}{$\mathrm{C}_\mathrm{ro}$}
\includegraphics{model.eps}}
\end{document}
I place jeffcott.tex, model.tex, automate.bat and dobatch.bat in the same folder as jeffcott.eps and model.eps, and then I run automate.bat. The following files are now in that folder:
A. The original files
jeffcott.tex
model.tex
jeffcott.eps
model.eps
automate.bat
dobatch.bat
B. And the created files from running the automate.bat
jeffcott-eps-converted-to.eps
jeffcott-eps-converted-to.eps.eps
jeffcott-eps-converted-to.pdf
model-eps-converted-to.eps
model-eps-converted-to.eps.eps
model-eps-converted-to.pdf
I am close to what I need as jeffcott-eps-converted-to.pdf and model-eps-converted-to.pdf have been created. These are pdf files with all labels by psfrag inserted unlike those pdf files generated by running pdflatex with TeXLive 2010 which would not contain the replaced labels. What I did in the file dobatch.bat was to make sure that I get the same filenames as those which would be created by pdfLaTeX. Now I can just replace the pdfLaTeX pdf versions of my original eps files with these pdf files created with the batch file.
I have four questions:
I. In the file dobatch.bat, there is the line: ps2eps -f --fixps %1-eps-converted-to.eps
whatever code comes after this line in the batch file get ignored. Why is that and how to fix that?
II. Ghostscript cannot read the bbox for jeffcott-eps-converted-to.eps and model-eps-converted-to.eps. This is why I use ps2eps to fix the bbox and it works. And I get the files: jeffcott-eps-converted-to.eps.eps and model-eps-converted-to.eps.eps. Since I have the original eps files: jeffott.eps and model.eps (without the psfrag labels) in the same directory, I would like to have the new correct eps files with all labels included named as jefcottalone.eps and modelalone.eps to emphasize that they stand alone. How to achieve this in th batch file dobatch.bat?
III. In my file jeffcott.tex, I have used the line:
\documentclass[12pt]{standalone}
Does the standalone package accept the option 12pt? I did not see this in the manual.
IV. In my file jeffcott.tex, I use the command:
\newcommand{\figtext}{\small}
to specify whatever text in the figure should be of size \figtext. It seems to work. Is this the correct way of doing things?
jeffcott.texandmodel.texin my post for whichpsfraglabels that are involved. – yCalleecharan Jul 21 '11 at 5:42pdfLateXdoes run faster. Perhaps becauseepsfiles are usually larger than the correspondingpdffiles. Anyway if this is not true, the post here is helping a lot for me to understandepsfiles better and create standaloneepsandpdffiles. – yCalleecharan Jul 21 '11 at 5:45stanadaloneclass and use a normalarticleclass here? Please explain. Thanks. – yCalleecharan Jul 21 '11 at 5:46