I will provide you with 6 batch files. Each takes a (La)TeX input file name without extension. It will compile a single (La)TeX input file to produce an output in both PDF and EPS. In development phase, you may compile the same (La)TeX input file with each of the 6 batch files, and investigate which one suits you best. Each of the 6 batch files processes a single (La)TeX input file using different steps internally. The description will be clearer later in the next explanation.
In the production phase, you should have decided which one among them will be applied on a bunch of (La)TeX input files you have. Since applying the batch file on a bunch of (La)TeX input files is very tedious job, I provide you with an additional batch file to automate the process. Thus there are 7 batch files in total.
BatchA.bat
rem batchA.bat
rem echo off
latex -interaction=nonstopmode %1
dvips -R -t unknown %1
ps2pdf -dAutoRotatePages#/None -dCompatibilityLevel#1.5 -dPDFSETTINGS#/prepress %1.ps %1-temp.pdf
pdfcrop --restricted --hires %1-temp %1.pdf
pdftops -level3 -eps %1.pdf
rem acrord32 %1.pdf
del %1.log
del %1.aux
del %1.dvi
del %1.ps
del %1-temp.pdf
- It can be used for an input file with any paper size.
- Steps:
TEX -> DVI -> PDF -> cropping -> EPS
.
pdfcrop
takes a significant amount of time to do cropping. If you don't need cropping, don't use this batch file.
BatchB.bat
rem batchB.bat
echo off
latex -interaction=nonstopmode %1
dvips -R -t unknown %1
ps2pdf -dAutoRotatePages#/None -dCompatibilityLevel#1.5 -dPDFSETTINGS#/prepress %1.ps
pdftops -level3 -eps %1.pdf
rem acrord32 %1.pdf
del %1.log
del %1.aux
del %1.dvi
del %1.ps
- It can be used only for an input file with tight paper size.
- Steps:
TEX -> DVI -> PDF -> EPS
.
- It runs faster than
batchA.bat
because no cropping with pdfcrop
. The drawback is you must specify the paper size tightly.
BatchC.bat
rem batchC.bat
echo off
latex %1
dvips -t unknown %1
gswin32c -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=%1.pdf %1.ps
pdftops -eps %1.pdf
rem acrord32 %1.pdf
del %1.log
del %1.aux
del %1.dvi
del %1.ps
- It is almost the same as the
batchB.bat
but with fewer switches to speed up the compilation.
- It can be used only for an input file with tight paper size.
- Steps:
TEX -> DVI -> PDF -> EPS
.
- It runs faster than
batchA.bat
because no cropping with pdfcrop
. The drawback is you must specify the paper size tightly.
BatchD.bat
rem batchD.bat
echo off
tex %1
dvips -t unknown %1
gswin32c -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=%1.pdf %1.ps
pdftops -eps %1.pdf
rem acrord32 %1.pdf
del %1.log
del %1.aux
del %1.dvi
del %1.ps
- It is almost the same as the
batchC.bat
but using tex.exe
instead of latex.exe
. The input file must be in plain TeX format. I hope it becomes faster than methodC.bat
, but it has not been tested yet as I have many troubles to convert the input file from LaTeX to plain TeX. Benchmarking will be done soon.
- It can be used only for an input file with tight paper size.
- Steps:
TEX -> DVI -> PDF -> EPS
.
- It runs faster than
batchA.bat
because no cropping with pdfcrop
. The drawback is you must specify the paper size tightly.
BatchE.bat
rem batchE.bat
rem echo off
latex -interaction=nonstopmode %1
dvips -R -t unknown -E %1 -o %1-temp.eps
epstool --copy --bbox %1-temp.eps %1.eps
epstopdf --hires %1.eps
rem acrord32 %1.pdf
del %1.log
del %1.aux
del %1.dvi
del %1-temp.eps
- It can be used for an input file with any paper size.
- Steps:
TEX -> DVI -> EPS -> bounding box correction -> PDF
.
- The file size of the resulting EPS is larger than that of one produced by each of the first 4 batch files (a,b,c,d).
BatchF.bat
rem batchF.bat
echo off
latex -interaction=nonstopmode %1
dvips -R -t unknown %1 -o %1-temp.ps
ps2eps %1-temp.ps
epstool --copy --bbox %1-temp.eps %1.eps
epstopdf --hires %1.eps
rem acrord32 %1.pdf
del %1.log
del %1.aux
del %1.dvi
del %1-temp.ps
del %1-temp.eps
- It can be used for an input file with any paper size.
- Steps:
TEX -> DVI -> PS -> EPS -> bounding box correction -> PDF
.
- The file size of the resulting EPS is larger than that of one produced by each of the first four batch files (a,b,c,d).
- I forgot the benchmark result when comparing
batchE.bat
and batchF.bat
.
Automate.bat
rem automate.bat
rem it takes a single character from {a,b,c,d,e,f}.
rem the options are case-insensitive.
rem for example: automate a
rem another example: automate F
echo off
for %%x in (*.tex) do batch%1.bat %%~nx
pause
If you have any problem, drop a comment.
Update in response to your misuse.
Each of {batchA.bat
,batchB.bat
,batchC.bat
,batchD.bat
,batchE.bat
,batchF.bat
} takes one input file name without extension. For example, if you want to use batchE.bat
for helloworld.tex
, then you must type batchE helloworld
and hit enter.
If you want to use batchE.bat
for a bunch of input files that exists in the same directory in which all batch files exist, then you type automate E
and hit enter.
psfrag
allows for this by default since it inserts the <replacement>
of <tag>
at compile-time:
\psfrag{<tag>}{<replacement>}
So you have to create the document with appropriate tags that can be replaced within your document. Here is a minimal example, taken from the auto-pst-pdf
package on CTAN. The example image is example.eps
:

\documentclass{article}
\usepackage{graphicx}% http://ctan.org/pkg/graphicx
\usepackage{psfrag}% http://ctan.org/pkg/psfrag
\begin{document}
% psfrag setup
\psfrag{[Mp]}{$M_p$}%
\psfrag{[hb]}{$\mathbf h$}%
\psfrag{[epb]}{$\mathbf{e}_p(n)$}%
\psfrag{[evh]}{$\hat{e}_v(n)$}%
\psfrag{[epsv]}{$\varepsilon_v(n)$}%
\psfrag{[ev]}{$e_v(n)$}%
Original image: \par
\includegraphics{example} \par\bigskip\bigskip%
Scaled 50\%: \par
\includegraphics[scale=.5]{example} \par\bigskip\bigskip
Scaled 150\%: \par
\includegraphics[scale=1.5]{example}
\end{document}
It is obvious that the <replacement>
text maintains a consistent font size, based on the document default. You may have to adjust the placement of the <replacement>
based on the image size.
Best Answer
No matter which way you scale, the fonts etc. used in the image will also be affected by that scaling. Here is an example, substitute your own image
I used this metapost code, and ran it through
mptopdf