Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detecting output device in LaTeX

Is there a way, in a LaTeX style/class file, to detect which output device is being used (or at least which capabilities it has)? The reason is, I'm writing a class file in which I want to use some Postscript-specific packages (e.g. pstricks) if Postscript is available, but if I just write

\RequirePackage{pstricks}

then of course bad things happen if I'm compiling the document with pdflatex. So ideally I'm looking for something I can use like

\if@postscriptokay\RequirePackage{pstricks}\fi

It seems like this must be possible because I know packages like pgf can change their behavior to use appropriate graphics commands based on the output device, but I've done some Google searches and checked in my LaTeX book and haven't found a way.

like image 432
David Z Avatar asked May 03 '09 06:05

David Z


Video Answer


1 Answers

\usepackage{ifpdf}

\ifpdf
  % nothing
\else
  \RequirePackage{pstricks}
\fi
like image 144
Sophie Alpert Avatar answered Sep 18 '22 14:09

Sophie Alpert