From 19a42d9cc5c26f46914f065ba66498541203c092 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 8 Oct 2007 16:46:40 +0000 Subject: new latex package epspdfconversion git-svn-id: svn://tug.org/texlive/trunk@5140 c570f23f-e606-0410-a88d-b1316a301751 --- .../latex/epspdfconversion/epspdfconversion.sty | 207 +++++++++++++++++++++ 1 file changed, 207 insertions(+) create mode 100644 Master/texmf-dist/tex/latex/epspdfconversion/epspdfconversion.sty (limited to 'Master/texmf-dist/tex') diff --git a/Master/texmf-dist/tex/latex/epspdfconversion/epspdfconversion.sty b/Master/texmf-dist/tex/latex/epspdfconversion/epspdfconversion.sty new file mode 100644 index 00000000000..2f0f8878172 --- /dev/null +++ b/Master/texmf-dist/tex/latex/epspdfconversion/epspdfconversion.sty @@ -0,0 +1,207 @@ +%% +%% This is file `epspdfconversion.sty', +%% +%% +%% It is based on epstopdf.sty by Heiko Oberdiek and an attempt to use Siep +%% Kroonenberg tools Epspdf (http://tex.aanhet.net/epspdf/) +%% "on the fly" in LaTeX +%% +%% Please send suggestions to daniel.becker@uni-rostock.de +%% version history: +%% +%% ToDo: +%% +%% 0.3: Heiko Oberdiek substantially improved the code. +%% The kvoptions-package is now used for the implemention of options. +%% See the documentation %% for effects and additional features. +%% 0.2: the package is now simply based on epstopdf. This package essentially +%% defines \@namedef{Gin@rule@.eps}#1{{pdf}{.pdf}{`\conversioncommand #1}} +%% differently than epstopdf. The code has been cleaned up. Improvements of +%% documentation and additional warning about pdfminorversion.... +%% 0.1: first try +%% + + + +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{epspdfconversion}% + [2007/10/02 v0.3 Conversion eps->pdf with epspdf-tools on the fly] + + +%% this loads the epstopdf and the kvoptions packages. +\RequirePackage{epstopdf} +\RequirePackage{kvoptions}[2006/08/22] + + +\SetupKeyvalOptions{ + family=EPC, + prefix=EPC@ +} + +%% this is the basic command necessary for the conversion with epspdf +\DeclareStringOption[epspdf]{cmd} + +% Gray +% \EPC@gray stores the whole option +\DeclareVoidOption{gray}{%this is for the \usepackage[gray]{... + \def\EPC@optgray{--gray }%this is the effect in the command line +} +\DeclareVoidOption{GRAY}{% + \def\EPC@optgray{--GRAY }% +} +\DeclareVoidOption{grey}{% + \def\EPC@optgray{--grey }% +} +\DeclareVoidOption{GREY}{% + \def\EPC@optgray{--GREY }% +} + +% Target +% \EPC@target stores the target only +% target ==> --target=default +% target=printer ==> --target=printer +% screen ==> --target=screen +\DeclareStringOption{target}[default] +\DeclareVoidOption{default}{% + \def\EPC@target{default}% +} +\DeclareVoidOption{printer}{% + \def\EPC@target{printer}% +} +\DeclareVoidOption{prepress}{% + \def\EPC@target{prepress}% +} +\DeclareVoidOption{screen}{% + \def\EPC@target{screen}% +} +\DeclareVoidOption{ebook}{% + \def\EPC@target{ebook}% +} + +% Version +% \EPC@pdfversion stores the version only +% pdfversion=1.2 ==> --version=1.2 +% the warning with pdfminorversion does not work? + +\define@key{EPC}{pdfversion}[default]{% + \@ifundefined{EPC@pdfversion@#1}{% + \PackageError{epspdfconversion}{% + Ignoring unknown value for `pdfversion'. Known values are: 1.2,1.3, 1.4, default% + }\@ehc + }{% + \def\EPC@pdfversion{#1}% + \begingroup + \let\MinorVersion\relax + \@ifundefined{pdfminorversion}{% + \@ifundefined{pdfoptionpdfminorversion}{}{% + \def\MinorVersion{\pdfoptionpdfminorversion}% + }% + }{% + \def\MinorVersion{\pdfminorversion}% + }% + \ifx\MinorVersion\relax + \else + \ifnum\@nameuse{EPC@pdfversion@#1}>\MinorVersion + \PackageWarning{epspdfconversion}{% + You have chosen pdfversion=#1,\MessageBreak + but you generate PDF-1.\number\MinorVersion.% + \MessageBreak + This can be changed by\MessageBreak + \expandafter\string\MinorVersion=% + \@nameuse{EPC@pdfversion@#1}% + \MessageBreak + (at the very beginning of your .tex file).\MessageBreak Or try `pdfversion=1.\number\MinorVersion'% + }% + \fi + \fi + \endgroup + }% +} + +\@namedef{EPC@pdfversion@1.2}{2} +\@namedef{EPC@pdfversion@1.3}{3} +\@namedef{EPC@pdfversion@1.4}{4} +\@namedef{EPC@pdfversion@default}{0}% disable version check + +% bbox ==> --bbox +% bbox=true ==> --bbox +% bbox=false ==> option disabled +\DeclareBoolOption{bbox} + +\DeclareVoidOption{pdftops}{% + \def\EPC@optpdftops{-U }% +} +\DeclareVoidOption{nopdftops}{% + \def\EPC@optpdftops{-I }% +} + +\DeclareStringOption{custom} +\DeclareStringOption{psoptions} +\DeclareStringOption{pagenumber} + +\DeclareVoidOption{simple}{% + % disable other options + \let\EPC@optgray\@empty + \let\EPC@optpdftops\@empty + \let\EPC@target\@empty + \let\EPC@pdfversion\@empty + \let\EPC@custom\@empty + \let\EPC@psoptions\@empty + \let\EPC@pagenumber\@empty + \EPC@bboxfalse +} + +% default setting: all options cleared +\EPC@simple + +% Options help works immediately, if shell escape feature is enabled. +\DeclareVoidOption{help}{% + \immediate\write18{\EPC@cmd\space--help}% +} + +\def\EPC@addopt#1{% + \expandafter\ifx\csname EPC@#1\endcsname\@empty + \else + --#1=\@nameuse{EPC@#1} % + \fi +} + +%% this is the setup of the command line.... +\newcommand*{\epspdfconversioncmdline}[1]{% + \EPC@cmd\space + \EPC@optpdftops + \EPC@addopt{target}% + \ifx\EPC@pdfversion\@empty + \else + --version=\EPC@pdfversion\space + \fi + \EPC@addopt{custom}% + \EPC@addopt{psoptions}% + \EPC@addopt{pagenumber}% + \ifEPC@bbox + --bbox % + \fi + \EPC@optgray + #1% +} + +%% this shows what is going on in the log +\def\EPC@printlog{% + \PackageInfo{epspdfconversion}{% + \epspdfconversioncmdline{}\MessageBreak + }% +} + +%% this allows to change the options on the fly +% Use example: \epspdfconversionsetup{target=prepress,bbox} +\newcommand*{\epspdfconversionsetup}[1]{% + \setkeys{EPC}{#1}% + \EPC@printlog +} + +\ProcessKeyvalOptions* +\EPC@printlog + +%%% this changes the definition provided by epstopdf: +\@namedef{Gin@rule@.eps}#1{{pdf}{.pdf}{`\epspdfconversioncmdline{#1}}} +\endinput -- cgit v1.2.3