You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This section is a guide aimed at [GNU Emacs](https://www.gnu.org/software/emacs/) users for setting up [AucTeX](https://www.gnu.org/software/auctex/) with Tectonic as the TeX/LaTeX distribution.
3
+
This section is a guide aimed at [GNU
4
+
Emacs](https://www.gnu.org/software/emacs/) users for setting up
5
+
[AucTeX](https://www.gnu.org/software/auctex/) with Tectonic as the TeX/LaTeX
6
+
distribution.
4
7
5
8
## Basic Prerequisites
6
9
7
-
To follow this section you will need Tectonic and GNU Emacs installed on your system. Additionally, you will require the AucTeX emacs package to be installed before
8
-
following along.
10
+
To follow this section you will need Tectonic and GNU Emacs installed on your
11
+
system. Additionally, you will require the AucTeX emacs package to be installed
12
+
before following along.
9
13
10
-
> Note: This section makes use of the V2 tectonic CLI, invoked using the `nextonic` command.
14
+
> Note: This section makes use of the V2 tectonic CLI, invoked using the
15
+
> `nextonic` command.
11
16
12
17
## Setup
13
18
14
-
All the code displayed in this section should go into your `init.el` file (or `config.el` if you are using [Doomemacs](https://github.com/doomemacs/)).
19
+
All the code displayed in this section should go into your `init.el` file (or
20
+
`config.el` if you are using [Doomemacs](https://github.com/doomemacs/)).
15
21
16
22
First, load the AucTeX package.
17
23
18
24
```lisp
19
25
(require 'latex)
20
26
```
21
27
22
-
You will need to set the default TeX engine AucTeX uses to figure out the build commands to use Tectonic instead of traditional TeX distributions. Therefore we have to modify the `TeX-engine-alist` varible.
28
+
You will need to set the default TeX engine AucTeX uses to figure out the build
29
+
commands to use Tectonic instead of traditional TeX distributions. Therefore we
30
+
have to modify the `TeX-engine-alist` varible.
23
31
* The first element of the list is the symbol that AucTeX recognizes.
24
32
* The second element is a string with the name of the TeX distribution.
25
33
* The third element is the shell command for compiling plain TeX documents.
26
-
* The fourth element is the shell command for compiling LaTeX documents. Here we are assuming the user is using a Tectonic project (generated using `nextonic new <proj-name>`).
27
-
* The last element is the shell command for compiling ConTeXt documents, left unconfigured for now.
34
+
* The fourth element is the shell command for compiling LaTeX documents. Here we
35
+
are assuming the user is using a Tectonic project (generated using `nextonic
36
+
new <proj-name>`).
37
+
* The last element is the shell command for compiling ConTeXt documents, left
38
+
unconfigured for now.
28
39
29
40
```lisp
30
41
(setq TeX-engine-alist '((default
@@ -34,15 +45,20 @@ You will need to set the default TeX engine AucTeX uses to figure out the build
34
45
nil)))
35
46
```
36
47
37
-
Next, modify the `LaTeX-command-style` so that AucTex doesn't add extra options to it that Tectonic does not recognize. We simply set it to the `%(latex)` expansion (from `TeX-expand-list-builtin`), removing any other extra options.
48
+
Next, modify the `LaTeX-command-style` so that AucTex doesn't add extra options
49
+
to it that Tectonic does not recognize. We simply set it to the `%(latex)`
50
+
expansion (from `TeX-expand-list-builtin`), removing any other extra options.
38
51
39
52
```lisp
40
53
(setq LaTeX-command-style '(("" "%(latex)")))
41
54
```
42
55
43
-
We need to set the `TeX-check-TeX` variable to `nil` since AucTeX will try to find a traditional distibution like `TeXLive` or others, and will fail since Tectonic doesn't meet it's criteria.
56
+
We need to set the `TeX-check-TeX` variable to `nil` since AucTeX will try to
57
+
find a traditional distibution like `TeXLive` or others, and will fail since
58
+
Tectonic doesn't meet it's criteria.
44
59
45
-
Additionally, we should also set `TeX-process-asynchronous` to `t`, so that running Tectonic in watch mode doesn't hang up Emacs.
60
+
Additionally, we should also set `TeX-process-asynchronous` to `t`, so that
61
+
running Tectonic in watch mode doesn't hang up Emacs.
46
62
47
63
We'll also just ensure that the `TeX-engine` is set to `default`.
48
64
@@ -52,7 +68,9 @@ We'll also just ensure that the `TeX-engine` is set to `default`.
52
68
TeX-engine 'default)
53
69
```
54
70
55
-
Finally, modify the `TeX-command-list` to use the appropriate commands, and not pass in extra metadata and options to Tectonic which cause it to error out. This needs to be done in place.
71
+
Finally, modify the `TeX-command-list` to use the appropriate commands, and not
72
+
pass in extra metadata and options to Tectonic which cause it to error out. This
73
+
needs to be done in place.
56
74
57
75
```lisp
58
76
(let ((tex-list (assoc "TeX" TeX-command-list))
@@ -61,24 +79,33 @@ Finally, modify the `TeX-command-list` to use the appropriate commands, and not
61
79
(cadr latex-list) "%l"))
62
80
```
63
81
64
-
And that is all! You should now be able to
82
+
And that is all! You should now be able to
65
83
1. Compile plain TeX files.
66
84
2. Build Tectonic LaTeX projects in watch mode.
67
85
68
86
## Additional Configuration and Usage Suggestions
69
87
70
88
### Compile LaTeX outside a Tectonic project
71
89
72
-
To do this, you can simply invoke `M-x TeX-command-master`, and the select the `Other` option, passing in the compile command `nextonic compile -f latex <name of file>`.
73
-
> **Caution**: Compiling a document with multiple LaTeX files in this manner isn't extensively tested, as using a Tectonic project is the better way in that case. Any bug reports are welcome.
90
+
To do this, you can simply invoke `M-x TeX-command-master`, and the select the
91
+
`Other` option, passing in the compile command `nextonic compile -f latex <name
92
+
of file>`.
93
+
94
+
> **Caution**: Compiling a document with multiple LaTeX files in this manner
95
+
> isn't extensively tested, as using a Tectonic project is the better way in
96
+
> that case. Any bug reports are welcome.
74
97
75
98
### Live PDF Preview in Tectonic projects
76
99
77
-
AucTeX expects the output PDF after compiling to be in the same directory as the input file. So it will error out when that is not the case, since Tectonic places the output in a build directory.
100
+
AucTeX expects the output PDF after compiling to be in the same directory as the
101
+
input file. So it will error out when that is not the case, since Tectonic
102
+
places the output in a build directory.
78
103
79
-
This behavior can be controlled by using the `TeX-output-dir` variable on a per porject basis.
104
+
This behavior can be controlled by using the `TeX-output-dir` variable on a per
105
+
porject basis.
80
106
81
-
This configuration assumes you are using `project.el`, although porting this code to `projectile.el` should be trivial.
107
+
This configuration assumes you are using `project.el`, although porting this
108
+
code to `projectile.el` should be trivial.
82
109
83
110
```lisp
84
111
(add-hook 'after-change-major-mode-hook
@@ -89,4 +116,7 @@ This configuration assumes you are using `project.el`, although porting this cod
We are basically looking for `Tectonic.toml` file in the project root, and if it exists, setting the `TeX-output-dir` to the appropriate path to the build directory. You may replace the `"build/index"` path to wherever your PDF file is placed after it is generated by Tectonic.
119
+
We are basically looking for `Tectonic.toml` file in the project root, and if it
120
+
exists, setting the `TeX-output-dir` to the appropriate path to the build
121
+
directory. You may replace the `"build/index"` path to wherever your PDF file is
0 commit comments