Skip to content

Features

duong755 edited this page Jun 24, 2020 · 4 revisions

TeX Make let you do the following with ease:

Build whole or part of the document

To build the whole document:

# Linux/Mac

make
# or
make all
# or
# this will open the PDF in PDF previewer
# default to acrobat reader)
make main.pdf
# or
make main.pdf.o

# ---

# Windows
.\make
# or
.\make all
# or
.\make main.pdf
# or
.\make main.pdf.o

TeX Make has also prepared mulitple-file document for you.

TeX allows you to split your document into smaller files. \input{}, subfiles package, standalone package... are some of the splitting methods. TeX Make has chosen standalone because of its flexibility.

With standalone package, each subfile is a completed document, which means it contains \documentclass, preambles (declaration of packages that it uses) and the document environment. You can nested subfiles as much as you want.

You can compile these sub-file only. For example, this template splits the document into 3 files:

  • main.tex
  • chapter0/chapter0.tex
  • chapter1/chapter1.tex

To compile chapter0/chapter0.tex only:

# Linux/Mac
make chapter0/chapter0.pdf
# or
make chapter0/chapter0.pdf.o

# ---

# Windows
.\make chapter0\chapter0.pdf
# or
.\make chapter0\chapter0.pdf.o

In case you want to output .ps or .dvi files, just replace the .pdf with .ps or .dvi.

Remove auxiliary and output files

After compiling a TeX, you might notice that many files have been generated (.synctex.gz, .log, .fls, .aux,...)

To clear all of these files:

# Linux/Mac

# this will also clean output file (pdf)
make clean
# this will spare output file
make cleanaux

# ---

# Windows
.\make clean
.\make cleanaux

To clear auxiliary files that come with a specific file:

# Linux/Mac

make chapter0/chapter0.clean
make chapter0/chapter0.cleanaux

# Windows

.\make chapter0\chapter0.clean
.\make chapter1\chapter1.cleanaux

Format document

In TeX, formatting means using indent properly in you TeX files to achieve readablity.

Of course you can indent your files manually. But this can be tedious and takes so much times, especially when your TeX file is too large.

TeX Make uses latexindent.pl to format the TeX files.

To format all TeX files in the project:

# Linux/Mac
make format

# Windows
.\make format

To format specific file:

# Linux/Mac
make chapter0/chapter0.format

# Windows
.\make chapter0\chapter0.format

While formatting, latexindent.pl generates .bak files. To remove these files:

# Linux/Mac
make cleanbak

# Windows
.\make cleanbak

Linting

"Linting" is the proccess of running a program (linter) that will analyse code to find potential, stylistic errors.

To be more specific, let say, you want your code to follow a consistent style (for examples, tab size must always be 4, use \ldots instead of "..."). A linter can let you declare those rules (your desired coding style) and warn you if any rule is violated.

Using a linter is a good choice when you collaborate with others - since people have different coding style, linter will force them to obey those rules to ensure consistent style.

TeX Live comes with ChkTeX, a linter that support 40 rules.

To lint (check) all files in the project:

# Linux/Mac
make chktex

# Windows
.\make chktex

To lint a specific file:

# Linux/Mac
make chapter0/chapter0.lint

# Windows
.\make chapter0/chapter0.lint