TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

\setparameter navigator:
author = Andy
title = Agile

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

share|improve this question

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.

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
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
up vote 7 down vote accepted

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


  \setparameter navigator:
  author = Andy
  title = Agile
share|improve this answer

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