CTAN Comprehensive TeX Archive Network

Directory macros/generic/iftex



Engine Detection

This iftex package provides a suite of commands for detecting different variants.

For each supported engine, tests are provided of the form

ifpdftex which is true if PDF is in use and RequirePDF which stops the run with an error message if PDF is not being used.

The package (which works with plain as well as ) has tests for:

e, PDF, , Lua, LuaHB, p, up, p-ng, V, Aleph, Texpad, Hi.

In addition, an iftutex test is true for and Lua, and an ifpdf test is provided to test the PDF or DVI output mode.

Compatibility Packages

In addition to the main iftex.sty package, small wrapper packages are provided

ifetex.sty ifluatex.sty ifvtex.sty ifxetex.sty ifpdf.sty

These include iftex and in some cases emulate some additional commands to allow these packages to replace the original packages in distributions. It is recommended that new documents do not use these packages, but instead load iftex.sty directly.

This package may be used on any format (it may be loaded into initex) it does not assume .

This is a merger and simplification of several packages Based on a suggestion of Norbert Preining


  • ifetex: Martin Scharrer
  • ifxetex: Will Robertson
  • iftex: Persian Group / Vafa Khalighi
  • ifluatex, ifvtex: Heiko Oberdiek
  • ifptex: Takayuki Yato
  • ifpdf: Heiko Oberdiek and 3 Project

The existing if(u)ptex packages do far more extensive testing to distinguish different variants which are not copied here.

A document specifically for Japanese texts may need the finer grained tests of the ifptex package which has tests for particular versions of the p (Japanese ) variant in use, and for the mode that is active.

This generic package only has coarser tests for the tex variant in use, so is sufficient for example to distinguish up from p, and to distinguish both of those from Lua.

Download the contents of this package in one zip archive (227.0k).

iftex – Am I running under pdf, or Lua?

The package, which works both for Plain and for , defines the \ifPDF, \if, and \ifLua conditionals for testing which engine is being used for typesetting.

The package also provides the \RequirePDF, \Require, and \RequireLua commands which throw an error if pdf, or Lua (respectively) is not the engine in use.

Bug trackerhttps://github.com/latex3/iftex/issues
Version1.0f 2022-02-03
LicensesThe Project Public License 1.3c
MaintainerThe Project Team
Vafa Khalighi (inactive)
TDS archiveiftex.tds.zip
Contained inTeX Live as iftex
MiKTeX as iftex
TopicsGeneric Macros
Environment query
See alsoifetex
Guest Book Sitemap Contact Contact Author