Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Possible Duplicate:
Detect which TeX engine is used
Conditional typesetting / build

I'm currently writing a document in LaTeX (using the article documentclass for now, thinking about switching to memoir later on).

I'm using the navigator package to generate additional meta-fields in the resulting pdf and I use pdflatex to generate my PDF.

However, when I use latex to generate a .dvi I do get errors because the meta-fields for pdf don't make sense now.

How can I put some conditional statements in the file so that certain sections would be included or excluded depending on what command is used to generate (or what target format is being generated)?

Here are the statements that now I have to manually comment out to compile my document with latex.

\usepackage{navigator}
\setparameter navigator:
author = Andy
title = Agile
\par

If this is a FAQ/stupid question please point me in the right direction.

share|improve this question
    
Welcome to TeX.SE. –  Peter Grill Mar 17 '12 at 19:14
    
Just out of curiosity, why do you need what appears to be a duplicate workflow (Ie pdf and dvi)? –  Brent.Longborough Mar 17 '12 at 19:16
1  
Because if I leave those uncommented and run 'latex' I get errors. And I want duplicate workflow, because I want to process this document also into plain text with dvi2txt or something like this. –  Andy Mar 17 '12 at 19:38
add comment

marked as duplicate by lockstep, Peter Grill, Mico, Stefan Kottwitz Mar 18 '12 at 18:49

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

up vote 5 down vote accepted

Package ifpdf detects whether the current mode is PDF or DVI:

\usepackage{ifpdf}

\ifpdf
  \usepackage{navigator}
  \setparameter navigator:
  author = Andy
  title = Agile
  \par
\fi
share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.