tex

TeX/LaTeX/PDFLaTeX/XeLaTeX support

Example:

def configure(conf):
        conf.load('tex')
        if not conf.env.LATEX:
                conf.fatal('The program LaTex is required')

def build(bld):
        bld(
                features = 'tex',
                type     = 'latex', # pdflatex or xelatex
                source   = 'document.ltx', # mandatory, the source
                outs     = 'ps', # 'pdf' or 'ps pdf'
                deps     = 'crossreferencing.lst', # to give dependencies directly
                prompt   = 1, # 0 for the batch mode
        )

Notes:

  • To configure with a special program, use:

    $ PDFLATEX=luatex waf configure
  • This tool does not use the target attribute of the task generator (bld(target=...)); the target file name is built from the source base name and the output type(s)

waflib.Tools.tex.bibunitscan(self)[source]

Parses TeX inputs and try to find the bibunit file dependencies

Returns:list of bibunit files
Return type:list of waflib.Node.Node
waflib.Tools.tex.exts_deps_tex

List of typical file extensions included in latex files

waflib.Tools.tex.exts_tex

List of typical file extensions that contain latex

waflib.Tools.tex.re_tex

Regexp for expressions that may include latex files

waflib.Tools.tex.g_bibtex_re

Regexp for bibtex files

waflib.Tools.tex.g_glossaries_re

Regexp for expressions that create glossaries

class waflib.Tools.tex.tex(*k, **kw)[source]

Bases: waflib.Task.Task

Compiles a tex/latex file.

exec_command(cmd, **kw)[source]

Executes TeX commands without buffering (latex may prompt for inputs)

Returns:the return code
Return type:int
scan_aux(node)[source]

Recursive regex-based scanner that finds included auxiliary files.

scan()[source]

Recursive regex-based scanner that finds latex dependencies. It uses waflib.Tools.tex.re_tex

Depending on your needs you might want:

  • to change re_tex:

    from waflib.Tools import tex
    tex.re_tex = myregex
    
  • or to change the method scan from the latex tasks:

    from waflib.Task import classes
    classes['latex'].scan = myscanfunction
    
check_status(msg, retcode)[source]

Checks an exit status and raise an error with a particular message

Parameters:
  • msg (string) – message to display if the code is non-zero
  • retcode (boolean) – condition
bibfile()[source]

Parses .aux files to find bibfiles to process. If present, execute waflib.Tools.tex.tex.bibtex_fun()

bibunits()[source]

Parses .aux file to find bibunit files. If there are bibunit files, runs waflib.Tools.tex.tex.bibtex_fun().

makeindex()[source]

Searches the filesystem for .idx files to process. If present, runs waflib.Tools.tex.tex.makeindex_fun()

bibtopic()[source]

Lists additional .aux files from the bibtopic package

makeglossaries()[source]

Lists additional glossaries from .aux files. If present, runs the makeglossaries program.

texinputs()[source]

Returns the list of texinput nodes as a string suitable for the TEXINPUTS environment variables

Return type:string
run()[source]

Runs the whole TeX build process

Multiple passes are required depending on the usage of cross-references, bibliographies, glossaries, indexes and additional contents The appropriate TeX compiler is called until the .aux files stop changing.

hash_aux_nodes()[source]

Returns a hash of the .aux file contents

Return type:string or bytes
call_latex()[source]

Runs the TeX compiler once

bibtex_fun(tsk)

Execute the program bibtex

makeglossaries_fun(tsk)

Execute the program makeglossaries

makeindex_fun(tsk)

Execute the program makeindex

class waflib.Tools.tex.latex(*k, **kw)[source]

Bases: waflib.Tools.tex.tex

Compiles LaTeX files

class waflib.Tools.tex.pdflatex(*k, **kw)[source]

Bases: waflib.Tools.tex.tex

Compiles PdfLaTeX files

class waflib.Tools.tex.xelatex(*k, **kw)[source]

Bases: waflib.Tools.tex.tex

XeLaTeX files

class waflib.Tools.tex.dvips(*k, **kw)[source]

Bases: waflib.Task.Task

Converts dvi files to postscript

class waflib.Tools.tex.dvipdf(*k, **kw)[source]

Bases: waflib.Task.Task

Converts dvi files to pdf

class waflib.Tools.tex.pdf2ps(*k, **kw)[source]

Bases: waflib.Task.Task

Converts pdf files to postscript

waflib.Tools.tex.feature(*k)

Decorator that registers a task generator method that will be executed when the object attribute feature contains the corresponding key(s):

from waflib.Task import feature
@feature('myfeature')
def myfunction(self):
        print('that is my feature!')
def build(bld):
        bld(features='myfeature')
Parameters:k (list of string) – feature names
waflib.Tools.tex.before_method(*k)

Decorator that registera task generator method which will be executed before the functions of given name(s):

from waflib.TaskGen import feature, before
@feature('myfeature')
@before_method('fun2')
def fun1(self):
        print('feature 1!')
@feature('myfeature')
def fun2(self):
        print('feature 2!')
def build(bld):
        bld(features='myfeature')
Parameters:k (list of string) – method names
waflib.Tools.tex.apply_tex(self)[source]

Task generator method

Creates waflib.Tools.tex.tex objects, and dvips/dvipdf/pdf2ps tasks if necessary (outs=’ps’, etc).

Feature :tex
waflib.Tools.tex.configure(self)[source]

Find the programs tex, latex and others without raising errors.

Features defined in this module:

Previous topic

waf_unit_test

Next topic

javaw

This Page