-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtools.tex
166 lines (148 loc) · 7.53 KB
/
tools.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
%\chapter{Tools and Editors}
\chapter{工具和编辑器}\label{ch:tools}
Most people who use \LaTeX\ use a specialised editor (or a special
mode or plugin for an editor) when working with \LaTeX. There are also
special tools for maintaining bibliographies. These tools are not
identical. That's sometimes a strength (people can have very strong
views about their preferred editor!), but for newcomers it can be a
definite weakness. In addition, many of the tools assume that you will
be using \bibtex\ -- which was a fair assumption in the past, and some
need `coaxing' to encourage them to work easily with \biblatex.
\section{In the shell}
\index{compiling}
I think it is important, whatever editor you use, to know how to
compile a file from the command line. Even the best tools sometimes
fail, and it's surprising how often (especially with a complex
project) a basic compilation from a shell will help diagnose
problems. So every user should know how to open a shell, navigate to
the directory in which the source file is found, and run
\begin{pseudoverb}
pdflatex\footnote{or \texttt{xelatex} or \texttt{lualatex}} \angled{name}\\
biber \angled{name}\\
pdflatex \angled{name}\\
pdflatex \angled{name}
\end{pseudoverb}
The only trick is with \angled{name} component: |pdflatex| wants to
get to work on a file with a |.tex| extension; |Biber| wants to get to
work on a file with the extension |.bcf|\footnote{\texttt{bcf} stands
for bibliography control file.} (`Old-timers' may erroneously try to
run |biber| on the |.aux| file, which is what \bibtex\ would use.)
But, so long as you use standard extensions, problems can be
avoided by running the program in question on the `basename': the
filename \emph{without any extension}. So the following are
equivalent, if our source code is in a file called |myfile.tex|:
\begin{pseudoverb}
\begin{tabbing}
pdflatex myfile.tex\qquad \= pdflatex myfile\\
biber myfile.bcf \> biber myfile\\
pdflatex myfile.tex \> pdflatex myfile\\
pdflatex myfile.tex \> pdflatex myfile
\end{tabbing}
\end{pseudoverb}
You won't \emph{always} need all these runs. You generally only need
to run \package{Biber} if you have either cited a new source or
significantly changed your bibliography options (for instance the
sorting). And you won't always need to run \LaTeX\ twice after using
\package{biber}. In any case, you get useful messages at the end of
compilation, telling you what to do.
Nevertheless, for a project of any complexity, this sort of need to
carry out multiple runs becomes tiresome, and you may want to look at
automating it. There are a few ways you can do this. You could use a
standard compiler program like |make|. There's nothing wrong with
this, and if you are happy writing |makefiles| it's a perfectly
reasonable way to go. But there are two \LaTeX\ specific tools which
are more likely to help you.
\subsection{Latexmk}
\index{latexmk@\package{latexmk}}
First is \package{latexmk}, which is a Perl script. It therefore
requries Perl to be installed. Perl always will be on Linux or Mac OS X
machines, but Windows users will need to download it (e.g. from
\url{strawberryperl.com}). In principle, and for reasonably simple
projects at least, you can substitute all the commands given above
with the simple:
\begin{pseudoverb}
latexmk myfile
\end{pseudoverb}
The script will then run \LaTeX, and auxiliary programs such as
\package{biber} and \package{makeindex}, as many times as necessary to
produce a stable result (if that's possible). The \package{latexmk}
script is `\package{Biber} aware': it will detect if it needs to run
\package{Biber} (or \bibtex) and proceed accordingly. There are many
options (described in the documentation).
\subsection{Arara}
\index{Arara@\package{Arara}}
The alternative modern approach is a program called
\package{Arara}. This is a Java program (and therefore requires a Java
command line to be installed). Instead of attempting to `detect' what
needs to be done to produce the final printable version,
\package{Arara} enables you to place commented instructions in your
source file, which essentially tell the program how to go about
processing it. So, for instance, you might put the following at the
start of your file:
\begin{pseudoverb}
\% arara: pdflatex\\
\% arara: biber\\
\% arara: pdflatex\\
\% arara: pdflatex
\end{pseudoverb}
You then run (from a command line)
\begin{pseudoverb}
arara \angled{filename}
\end{pseudoverb}
The package then reads the comment lines in the file to work out what
it should do. Effectively, you are writing makefile-like instructions,
but in a conveniently simple form and in the file you will
compile. You have to be explicit about them, but you may find this an
advantage over the sort of `black box' that \package{latexmk}
offers. Again, there are all sorts of bells and whistles -- but
\package{Arara} is, as the example above shows, `\package{biber}
aware'.
\subsection{Texify}
\index{Texify@\package{Texify}}
The \package{mikTeX} distribution comes with a command called
|texify|, which is intended to do something along the lines of
|latexmk|, but without the need to install Perl. This is \emph{not}
\package{Biber}-friendly: it assumes you will run \bibtex. Although it
is reputed to be possible to convert it to run \package{Biber} by
setting the environment variable |BIBTEX| to |biber|, I have not had
any success doing so. In my view, it's better to install and use
either \package{latexmk} or \package{Arara}.
\section{Editors}
\index{editors}
There are many different editors available and commonly used for
\LaTeX, most of which offer at least some support for the use of
\package{Biber} and \biblatex. For some, such as
\package{Emacs} with \package{AUC\TeX}, support is already built
in. In other cases it is necessary to add or adjust the editor's
setting in order to configure it to use \package{Biber} rather than
\bibtex. Given the vast number of editors, each slightly different,
and the speed at which they change, it's not practical to give
detailed instructions here. Information, periodically updated, may be
found at
\url{http://tex.stackexchange.com/questions/154751/biblatex-with-biber-configuring-my-editor-to-avoid-undefined-citations}.
A practical alternative to configuring your editor to use
\package{Biber} is to configure it to use \package{latexmk} or
\package{Arara}, as described above.
\section{Maintaining Databases}
\index{BibDesk@\package{BibDesk}}\index{JabRef@\package{JabRef}}
You can always maintain a database yourself, through a decent text
editor. Some editors (such as \package{Emacs}) have a special mode for editing
\bibtex\ datatabase files, which makes the process much smoother. But
there is also software designed to do this for you. Two commonly used
tools are \package{JabRef} and (for Mac OSX) \package{BibDesk}. Each
provides a graphical interface for entering bibliographic data, and
useful reminders of the fields that you will need to complete.
Such packages are designed for maintaining a database file (or files)
on a particular computer. Increasingly there are web- and cloud-based
bibliography tools such as \package{Mendeley} and \package{Zotero}.
Other web-based services (such as Google Scholar) will often also
offer pre-formed \bibtex\ records. These need to be scrutinized with
care, because they are not always accurate or complete.
Support for \biblatex\ in these tools varies, and changes over
time. You may be able to find useful up-to-date information at
\url{http://tex.stackexchange.com/questions/23942/bibliography-tools-that-are-compatible-with-biblatex-and-biber}.
%%% Local Variables:
%%% coding: utf-8
%%% mode: LaTeX
%%% TeX-master: "biblatex-tutorial"
%%% End: