4.1.3 Options for TeX Processors
There are some options you can customize affecting which processors are invoked or the way this is done and which output they produce as a result. These options control if DVI or PDF output should be produced, if TeX should be started in interactive or nonstop mode, if source specials or a SyncTeX file should be produced for making inverse and forward search possible or which TeX engine should be used instead of regular TeX, like PDFTeX, Omega or XeTeX, and the style error messages are printed with.
command
TeX-PDF-modeβ
(C-c C-t C-p
) This command toggles the PDF mode of AUCTeX, a buffer-local minor mode which is enabled by default. You can customize TeX-PDF-mode
to give it a different default or set it as a file local variable on a per-document basis. This option usually results in calling either PDFTeX or ordinary TeX.
user option
TeX-DVI-via-PDFTeXβ
If this is set, DVI will also be produced by calling PDFTeX, setting \pdfoutput=0
. This makes it possible to use PDFTeX features like character protrusion even when producing DVI files. Contemporary TeX distributions do this anyway, so that you need not enable the option within AUCTeX.
command
TeX-interactive-modeβ
(C-c C-t C-i
) This command toggles the interactive mode of AUCTeX, a global minor mode. You can customize TeX-interactive-mode
to give it a different default. In interactive mode, TeX will pause with an error prompt when errors are encountered and wait for the user to type something.
command
TeX-source-correlate-modeβ
(C-c C-t C-s
) Toggles support for forward and inverse search. Forward search refers to jumping to the place in the previewed document corresponding to where point is located in the document source and inverse search to the other way round. See I/O Correlation.
You can permanently activate TeX-source-correlate-mode
by customizing the variable TeX-source-correlate-mode
. There is a bunch of customization options for the mode, use M-x customize-group <RET> TeX-view <RET>
to find out more.
AUCTeX is aware of three different means to do I/O correlation: source specials (only DVI output), the pdfsync LaTeX package (only PDF output) and SyncTeX. The choice between source specials and SyncTeX can be controlled with the variable TeX-source-correlate-method
.
Should you use source specials it has to be stressed very strongly however, that source specials can cause differences in page breaks and spacing, can seriously interfere with various packages and should thus never be used for the final version of a document. In particular, fine-tuning the page breaks should be done with source specials switched off.
Sometimes you are requested, by journal rules or packages, to compile the document into DVI output. Thus, if you want a PDF document in the end you can either use XeTeX engine, see below for information about how to set engines, or compile the document with tex
and then convert to PDF with dvips
βps2pdf
before viewing it. In addition, current Japanese TeX engines cannot generate PDF directly so they rely on DVI-to-PDF converters. Usually dvipdfmx
command is used for this purpose. You can use the TeX-PDF-from-DVI
variable to let AUCTeX know you want to generate the final PDF by converting a DVI file.
user option
TeX-PDF-from-DVIβ
This option controls if and how to produce a PDF file by converting a DVI file.
When TeX-PDF-mode
is non-nil, if TeX-PDF-from-DVI
is non-nil too the document is compiled to DVI instead of PDF. When the document is ready, C-c C-c
will suggest to run the converter to PDF or an intermediate format.
If non-nil, TeX-PDF-from-DVI
should be the name of the command, as a string, used to convert the DVI file to PDF or to an intermediate format. Values currently supported are:
"Dvips"
: the DVI file is converted to PS withdvips
. After successfully running it,ps2pdf
will be the default command to convert the PS file to PDF."Dvipdfmx"
: the DVI file is converted to PDF withdvipdfmx
.
(case is significant; note the uppercase βD" in both strings) When the PDF file is finally ready, the next suggested command will be to open the viewer.
This option can also be set as a file local variable, in order to use this conversion on a per-document basis.
Recall the whole sequence of C-c C-c
commands can be replace by the single C-c C-a
.
AUCTeX also allows you to easily select different TeX engines for processing, either by using the entries in the βTeXing Options
β submenu below the βCommand
β menu or by calling the function TeX-engine-set
. These eventually set the variable TeX-engine
which you can also modify directly.
user option
TeX-engineβ
This variable allows you to choose which TeX engine should be used for typesetting the document, i.e. the executables which will be used when you invoke the βTeX
β or βLaTeX
β commands. The value should be one of the symbols defined in TeX-engine-alist-builtin
or TeX-engine-alist
. The symbols βdefault
β, βxetex
β, βluatex
β and βomega
β are available from the built-in list.
Note that TeX-engine
is buffer-local, so setting the variable directly or via the above mentioned menu or function will not take effect in other buffers. If you want to activate an engine for all AUCTeX modes, set TeX-engine
in your init file, e.g. by using M-x customize-variable <RET>
. If you want to activate it for a certain AUCTeX mode only, set the variable in the respective mode hook. If you want to activate it for certain files, set it through file variables (see (emacs)File Variables section βFile Variablesβ in The Emacs Editor).
Should you need to change the executable names related to the different engine settings, there are some variables you can tweak. Those are TeX-command
, LaTeX-command
, TeX-Omega-command
, LaTeX-Omega-command
, ConTeXt-engine
and ConTeXt-Omega-engine
. The rest of the executables is defined directly in TeX-engine-alist-builtin
. If you want to override an entry from that, add an entry to TeX-engine-alist
that starts with the same symbol as that the entry in the built-in list and specify the executables you want to use instead. You can also add entries to TeX-engine-alist
in order to add support for engines not covered per default.
user option
TeX-engine-alistβ
Alist of TeX engines and associated commands. Each entry is a list with a maximum of five elements. The first element is a symbol used to identify the engine. The second is a string describing the engine. The third is the command to be used for plain TeX. The fourth is the command to be used for LaTeX. The fifth is the command to be used for the β--engine
β parameter of ConTeXtβs βtexexec
β program. Each command can either be a variable or a string. An empty string or nil means there is no command available.
In some systems, Emacs cannot inherit the PATH environment variable from the shell and thus AUCTeX may not be able to run TeX commands. Before running them, AUCTeX checks if it able to find those commands and will warn you in case it fails. You can skip this test by changing the option TeX-check-TeX
.
user option
TeX-check-TeXβ
If non-nil, AUCTeX will check if it is able to find a working TeX distribution before running TeX, LaTeX, ConTeXt, etc. It actually checks if can run TeX-command
command or the shell returns a command not found error. The error code returned by the shell in this case can be set in TeX-check-TeX-command-not-found
option.
Some LaTeX packages requires the document to be compiled with a specific engine. Notable examples are fontspec and polyglossia packages, which require LuaTeX and XeTeX engines. If you try to compile a document which loads one of such packages and the set engine is not one of those allowed you will be asked to select a different engine before running the LaTeX command. If you do not want to be warned by AUCTeX in these cases, customize the option TeX-check-engine
.
user option
TeX-check-engineβ
This boolean option controls whether AUCTeX should check the correct engine has been set before running LaTeX commands.
As shown above, AUCTeX handles in a special way most of the main options that can be given to the TeX processors. When you need to pass to the TeX processor arbitrary options not handled by AUCTeX, you can use the file local variable TeX-command-extra-options
.
user option
TeX-command-extra-optionsβ
String with the extra options to be given to the TeX processor. For example, if you need to enable the shell escape feature to compile a document, add the following line to the list of local variables of the source file:
%%% TeX-command-extra-options: "-shell-escape"
By default this option is not safe as a file-local variable because a specially crafted document compiled with shell escape enabled can be used for malicious purposes.
You can customize AUCTeX to show the processor output as it is produced.
user option
TeX-show-compilationβ
If non-nil, the output of TeX compilation is shown in another window.
You can instruct TeX to print error messages in the form file:line:error which is similar to the way many compilers format them.
user option
TeX-file-line-errorβ
If non-nil, TeX will produce file:line:error style error messages.
ConTeXt users can choose between Mark II and Mark IV versions. This is controlled by ConTeXt-Mark-version
option.
user option
ConTeXt-Mark-versionβ
This variables specifies which version of Mark should be used. Values currently supported are "II"
, the default, and "IV"
. It can be set globally using customization interface or on a per-file basis, by specifying it as a file variable.