[OS X TeX] Trying to write an epspdfconversion.sty ......
Daniel Becker
daniel.becker at uni-rostock.de
Wed Sep 19 10:05:25 CEST 2007
Dear listers,
I would like to write a sty-file that does for Siep Kroonenberg's
tool Epspdf (http://tex.aanhet.net/epspdf/) more or less the same as
the epstopdf. I think this might be interesting also for others, as
epstopdf is really a great help when dealing with eps-pdf-conversion
of all sorts (For example, if you need to prepare grayscale and
prepress graphics.) But I think I need help.
This is what I want the style file to do, when pdflatex is running:
1. when there is an \includegraphics{file.eps}: convert it with the
command "epspdf" to pdf and use this one
2. in case it finds only \includegraphics{file}: check whether there
is already an file.pdf and convert only if missing
3. PASSING OPTIONS to the epspdf command
1 and 2 are working (not very difficult). But with 3, I don't get it.
Partly because I don't understand the syntax of a style-file and have
no idea where to look. Maybe this is also not for the OS X list....
A few of the possible Options if you use epstopdf are:
-T, --target=TARGET Target use of pdf; one of
default, printer, prepress,
screen, ebook
-V, --version=VERSION Pdf version to be generated;
one of 1.2, 1.3, 1.4, default
-g, --gray, --grey Convert to grayscale;
success not guaranteed
-G, --GRAY, --GREY Try harder to convert to
grayscale;
success still not guaranteed
-i, --info Info: display detected filetype
-h, --help Show this message
I would like to load "my" package like this
\usepackage[-T -G]{epspdfconversion} or
\usepackage[options={-T -G}]{epspdfconversion}
and that should result in a command
epspdf -T -G file.eps
Has anyone the time to help me here? Below you can find what is in
the -sty-file so far. Or an idea where to look for a manual on sty-
writing?
Daniel
%%
%% This is file `epspdfconversion.sty',
%%
%%
%% based on epstopdf.sty and an attempt to use Siep
%% Kroonenberg tools Epspdf (http://tex.aanhet.net/epspdf/)
%% "on the fly" in LaTeX
%%
%%
%%
\begingroup
\expandafter\let\expandafter\x\csname ver at epspdfconversion.sty
\endcsname
\ifcase 0%
\ifx\x\relax % plain
\else
\ifx\x\empty % LaTeX
\else
1%
\fi
\fi
\else
\expandafter\ifx\csname PackageInfo\endcsname\relax
\def\x#1#2{%
\immediate\write-1{Package #1 Info: #2.}%
}%
\else
\def\x#1#2{\PackageInfo{#1}{#2, stopped}}%
\fi
\x{epspdfconversion}{The package is already loaded}%
\endgroup
\expandafter\endinput
\fi
\endgroup
\begingroup
\expandafter\ifx\csname ProvidesPackage\endcsname\relax
\def\x#1#2#3[#4]{\endgroup
\immediate\write-1{Package: #3 #4}%
\xdef#1{#4}%
}%
\else
\def\x#1#2[#3]{\endgroup
#2[{#3}]%
\ifx#1\relax
\xdef#1{#3}%
\fi
}%
\fi
\expandafter\x\csname ver at epspdfconversion.sty\endcsname
\ProvidesPackage{epspdfconversion}%
[2007/09/20 v0.1 Conversion with epspdf on the fly (HO)]
\@ifundefined{PackageWarning}{%
\def\PackageWarning#1#2{%
\begingroup
\newlinechar=10 %
\def\MessageBreak{%
^^J(#1)\@spaces\@spaces\@spaces\@spaces
}%
\immediate\write16{^^JPackage #1 Warning: #2\on at line.^^J}%
\endgroup
}%
}{}
\@ifundefined{PackageWarningNoLine}{%
\def\PackageWarningNoLine#1#2{%
\PackageWarning{#1}{#2\@gobble}%
}%
}{}
\@ifundefined{on at line}{%
\def\on at line{ on input line \the\inputlineno}%
}{}
\@ifundefined{@spaces}{%
\def\@spaces{\space\space\space\space}%
}{}
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname Gin at setfile\endcsname\relax
\PackageWarningNoLine{epstopdf}{%
No graphics package \string`graphic{s,x}\string' found%
}%
\expandafter\endinput
\fi
\begingroup
\def\x{pdftex.def}%
\ifx\Gin at driver\x
\else
\PackageWarningNoLine{epstopdf}{%
Graphics driver file \string`pdftex.def\string' not found%
}
\expandafter\endgroup\expandafter\endinput
\fi
\endgroup
\begingroup
\expandafter\ifx\csname pdfshellescape\endcsname\relax
\else
\ifnum\pdfshellescape>0 %
\else
\PackageWarningNoLine{epstopdf}{%
Shell escape feature is not enabled%
}%
\fi
\fi
\endgroup
\let\ETEorg at Gin@setfile\Gin at setfile
\def\Gin at setfile#1#2#3{%
\if`\@car #3\relax\@nil
\immediate\write18{\@cdr #3\@empty\@nil}%
\ETEorg at Gin@setfile{#1}{#2}{\Gin at base #2}%
\else
\ETEorg at Gin@setfile{#1}{#2}{#3}%
\fi
}
\@ifundefined{Gin at extensions}{%
\def\Gin at extensions{.eps}%
}{%
\expandafter\ifx\expandafter\indent\Gin at extensions\indent
\def\Gin at extensions{.eps}%
\else
\expandafter\def\expandafter\Gin at extensions\expandafter{%
\Gin at extensions,.eps%
}%
\fi
}
\@namedef{Gin at rule@.eps}#1{{pdf}{.pdf}{`epspdf #1}}
%% if you write directly the option, as in
%% \@namedef{Gin at rule@.eps}#1{{pdf}{.pdf}{`epspdf --GRAY #1}}
%% that works. The question is how to let an option for the package
write sommething
%% here...
\endinput
------------------------- Helpful Info -------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/
List Reminders & Etiquette: http://www.esm.psu.edu/mac-tex/list/
More information about the macostex-archives
mailing list