Skip to content

A GNU Makefile for typesetting LaTeX documents.

License

Notifications You must be signed in to change notification settings

JensHeinrich/makefile4latex

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Makefile for LaTeX

Travis CI Build Status AppVeyor Build Status

This is a GNU Makefile for typesetting LaTeX documents. Expected to work with TeXLive on Linux and similar systems, e.g., on macOS or Cygwin. Just download a single Makefile and put it in your directory containing LaTeX source files. Running make will generate PDF files for your documents.

Features

  • Only a single file (Makefile).
  • Automatic detection of LaTeX source files. Just type make and then the Makefile knows what to do.
  • Dependency tracking.
  • Handling BibTeX, MakeIndex, glossaries, axodraw2 etc.
  • Colorized output.
  • Can create tar-gzipped source files for arXiv submission (make dist).
  • Can watch sources and automatically typeset documents (make watch).

Getting started

Download Makefile by using wget:

wget https://raw.githubusercontent.com/tueda/makefile4latex/master/Makefile

or curl:

curl -O https://raw.githubusercontent.com/tueda/makefile4latex/master/Makefile

or via this link in your browser. Put it into a directory that contains LaTeX files. Then just type:

make

Targets

  • all (default): Build all documents in the current directory.
  • all-recursive: Build all documents in the source tree.
  • dvi, ps, pdf, eps, svg, jpg, png: Build all documents with the specified file format in the current directory.
  • help: Show help message.
  • clean: Delete all files created by running make.
  • mostlyclean: Delete only intermediate files created by running make.
  • dist: Create tar-gzipped archives for arXiv submission.
  • watch: Watch the changes and automatically rebuild documents in the current directory.
  • upgrade: Upgrade the setup. For a Git repository, if there is no .gitignore file, it installs the default .gitignore. (Be careful not to overwrite any local changes!)

It is also possible to make each target file. For example, make foo.pdf tries to generate the pdf file from foo.tex.

Variables

  • TOOLCHAIN: Control how PDF files are generated from LaTeX files.

    • latex: Alias to latex_dvips.
    • latex_dvips: Use latex --> dvips --> ps2pdf.
    • latex_dvipdf: Use latex --> dvipdf.
    • platex: Alias to platex_dvips.
    • platex_dvips: Use platex --> dvips --> ps2pdf.
    • platex_dvipdfmx: Use platex --> dvipdfmx.
    • uplatex: Alias to uplatex_dvips.
    • uplatex_dvips: Use uplatex --> dvips --> ps2pdf.
    • uplatex_dvipdfmx: Use uplatex --> dvipdfmx.
    • pdflatex (default): Use pdflatex.
    • xelatex: Use xelatex.
    • lualatex: Use lualatex.
    • luajitlatex: Use luajitlatex.
  • DIFF: Enable the Git-latexdiff mode. Requires latexdiff and latexpand. The DIFF variable specifies a Git revision for which a latexdiff with the working tree is performed, e.g., make DIFF=HEAD^. The resultant document has a postfix -diff like foo-diff.pdf. It is also possible to make a latexdiff between two revisions, e.g., make DIFF=HEAD~3..HEAD provided both revisions contain the source file.

Customization

The Makefile includes latex.mk (as well as .latex.mk) at the very end if exists. This file can be put in the user's home directory and/or the current working directory. It can be used for customizing the behaviour of the Makefile, for example, by setting TOOLCHAIN. For example, if you want to use the latex -> dvips -> ps2pdf toolchain instead of the default one pdflatex, then run the following command:

echo 'TOOLCHAIN = latex_dvips' >>latex.mk

See also the Wiki page for more customizations.

About

A GNU Makefile for typesetting LaTeX documents.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Makefile 89.4%
  • TeX 6.3%
  • Shell 4.3%