| 1 |
\input texinfo |
| 2 |
@setfilename kpathsea.info |
| 3 |
@settitle Kpathsea: A library for path searching |
| 4 |
|
| 5 |
@set version 6.4.2/dev |
| 6 |
@set month-year January 2026 |
| 7 |
|
| 8 |
@copying |
| 9 |
This file documents the Kpathsea library for path searching. |
| 10 |
|
| 11 |
Copyright @copyright{} 1996--2026 Karl Berry & Olaf Weber. |
| 12 |
|
| 13 |
Permission is granted to make and distribute verbatim copies of this |
| 14 |
manual provided the copyright notice and this permission notice are |
| 15 |
preserved on all copies. |
| 16 |
|
| 17 |
@ignore |
| 18 |
Permission is granted to process this file through TeX and print the |
| 19 |
results, provided the printed document carries a copying permission |
| 20 |
notice identical to this one except for the removal of this paragraph |
| 21 |
(this paragraph not being relevant to the printed manual). |
| 22 |
@end ignore |
| 23 |
|
| 24 |
Permission is granted to copy and distribute modified versions of this |
| 25 |
manual under the conditions for verbatim copying, provided that the |
| 26 |
entire resulting derived work is distributed under the terms of a |
| 27 |
permission notice identical to this one. |
| 28 |
|
| 29 |
Permission is granted to copy and distribute translations of this manual |
| 30 |
into another language, under the above conditions for modified versions, |
| 31 |
except that this permission notice may be stated in a translation |
| 32 |
approved by the @TeX{} Users Group. |
| 33 |
@end copying |
| 34 |
|
| 35 |
@c Define new indices for commands, filenames, and options. |
| 36 |
@defcodeindex cm |
| 37 |
@defcodeindex fl |
| 38 |
@defcodeindex op |
| 39 |
|
| 40 |
@c Put everything in one index (arbitrarily chosen to be the concept index). |
| 41 |
@syncodeindex cm cp |
| 42 |
@syncodeindex fl cp |
| 43 |
@syncodeindex fn cp |
| 44 |
@syncodeindex ky cp |
| 45 |
@syncodeindex op cp |
| 46 |
@syncodeindex pg cp |
| 47 |
@syncodeindex tp cp |
| 48 |
@syncodeindex vr cp |
| 49 |
|
| 50 |
@dircategory TeX |
| 51 |
@direntry |
| 52 |
* Kpathsea: (kpathsea). File lookup along search paths. |
| 53 |
* kpsewhich: (kpathsea)Invoking kpsewhich. TeX file searching. |
| 54 |
* mktexfmt: (kpathsea)mktex scripts. Format (fmt/base/mem) generation. |
| 55 |
* mktexlsr: (kpathsea)Filename database. Update ls-R. |
| 56 |
* mktexmf: (kpathsea)mktex scripts. MF source generation. |
| 57 |
* mktexpk: (kpathsea)mktex scripts. PK bitmap generation. |
| 58 |
* mktextex: (kpathsea)mktex scripts. TeX source generation. |
| 59 |
* mktextfm: (kpathsea)mktex scripts. TeX font metric generation. |
| 60 |
@end direntry |
| 61 |
|
| 62 |
|
| 63 |
@titlepage |
| 64 |
@title Kpathsea library |
| 65 |
@subtitle for version @value{version} |
| 66 |
@subtitle @value{month-year} |
| 67 |
@author Karl Berry |
| 68 |
@author Olaf Weber |
| 69 |
@author Taco Hoekwater |
| 70 |
@author @url{https://tug.org/kpathsea} |
| 71 |
|
| 72 |
@page |
| 73 |
@vskip 0pt plus 1filll |
| 74 |
@insertcopying |
| 75 |
@end titlepage |
| 76 |
|
| 77 |
|
| 78 |
@contents |
| 79 |
|
| 80 |
|
| 81 |
@ifnottex |
| 82 |
@node Top |
| 83 |
@top Kpathsea library |
| 84 |
|
| 85 |
This manual documents the Kpathsea library for path searching. It |
| 86 |
corresponds to version @value{version}, released in |
| 87 |
@value{month-year}. |
| 88 |
|
| 89 |
@menu |
| 90 |
* Introduction:: Overview and history. |
| 91 |
|
| 92 |
* unixtex.ftp:: Obtaining @TeX{} software. |
| 93 |
* Security:: Who can write what files, etc. |
| 94 |
* TeX directory structure:: Managing the horde of @TeX{} input files. |
| 95 |
|
| 96 |
* Path searching:: How filename lookups work. |
| 97 |
* TeX support:: Special support for TeX-related file lookups. |
| 98 |
|
| 99 |
* Programming:: How to use Kpathsea features in your program. |
| 100 |
|
| 101 |
* Reporting bugs:: Where and how to report bugs. |
| 102 |
* Index:: General index. |
| 103 |
@end menu |
| 104 |
@end ifnottex |
| 105 |
|
| 106 |
|
| 107 |
@node Introduction |
| 108 |
@chapter Introduction |
| 109 |
|
| 110 |
@cindex introduction |
| 111 |
@cindex fundamental purpose of Kpathsea |
| 112 |
|
| 113 |
This manual corresponds to version @value{version} of the Kpathsea |
| 114 |
library, released in @value{month-year}. |
| 115 |
|
| 116 |
The library's fundamental purpose is to return a filename from a list of |
| 117 |
directories specified by the user, similar to what shells do when |
| 118 |
looking up program names to execute. |
| 119 |
|
| 120 |
@cindex programs using the library |
| 121 |
The following software, all of which is maintained in parallel, uses |
| 122 |
this library: |
| 123 |
|
| 124 |
@itemize @bullet |
| 125 |
@item Dviljk (see the @samp{dvilj} man page) |
| 126 |
@item Dvipsk (@pxref{,,,dvips, Dvips: A DVI driver}) |
| 127 |
@item GNU font utilities (@pxref{,,,fontu, GNU font utilities}) |
| 128 |
@item Web2c (@pxref{,,,web2c, Web2c: A @TeX{} implementation}) |
| 129 |
@item Xdvik (see the @samp{xdvi} man page) |
| 130 |
@end itemize |
| 131 |
|
| 132 |
@noindent Other software that we do not maintain also uses it. |
| 133 |
|
| 134 |
Kpathsea is now maintained as part of the @TeX{} Live distribution |
| 135 |
(@url{https://tug.org/texlive}), which includes several more |
| 136 |
Kpathsea-using programs. For information on configuration, building, |
| 137 |
installing, and more, @pxref{,,,tlbuild, Building @TeX{} Live}. |
| 138 |
|
| 139 |
@cindex interface, not frozen |
| 140 |
@cindex comments, making |
| 141 |
@cindex suggestions, making |
| 142 |
The library is still actively maintained. If you have comments or |
| 143 |
suggestions, please send along (@pxref{Reporting bugs}). |
| 144 |
|
| 145 |
@cindex conditions for use |
| 146 |
@cindex license for using the library |
| 147 |
@cindex GNU General Public License |
| 148 |
The Kpathsea library is distributed under the GNU Library General |
| 149 |
Public License (LGPL), version@tie{}2.1 or (at your option) any later |
| 150 |
version. In short, this means if you write a program using the |
| 151 |
library, you must (offer to) distribute the source to the library, |
| 152 |
along with any changes you have made, and allow anyone to modify the |
| 153 |
library source and distribute their modifications. It does not mean |
| 154 |
you have to distribute the source to your program using the library, |
| 155 |
although we hope you will. See accompanying files for the text of the |
| 156 |
GNU licenses, or @url{https://gnu.org/licenses}. |
| 157 |
|
| 158 |
@cindex @TeX{} Users Group |
| 159 |
If you know enough about @TeX{} to be reading this manual, then you (or |
| 160 |
your institution) should consider joining the @TeX{} Users Group (if |
| 161 |
you're already a member, thanks!). TUG produces the periodical |
| 162 |
@cite{TUGboat}, sponsors an annual meeting and publishes the |
| 163 |
proceedings, and arranges courses on @TeX{} for all levels of users |
| 164 |
throughout the world. See @url{https://tug.org} for information. |
| 165 |
|
| 166 |
@menu |
| 167 |
* History:: |
| 168 |
@end menu |
| 169 |
|
| 170 |
|
| 171 |
@node History |
| 172 |
@section History |
| 173 |
|
| 174 |
@cindex history of Kpathsea |
| 175 |
|
| 176 |
@cindex Knuth, Donald E. |
| 177 |
This section is for those people who are curious about how the library |
| 178 |
came about. If you like to read historical accounts of software, we |
| 179 |
urge you to seek out the GNU Autoconf manual and the ``Errors of |
| 180 |
@TeX{}'' paper by Don Knuth, published in his book @cite{Digital |
| 181 |
Typography}, among other places. |
| 182 |
|
| 183 |
@cindex Morgan, Tim |
| 184 |
@cindex Rokicki, Tom |
| 185 |
@cindex Berry, Karl |
| 186 |
@cindex VAX 11/750 |
| 187 |
@cindex Sun 2 |
| 188 |
@pindex pxp @r{Pascal preprocessor} |
| 189 |
@pindex pc @r{Pascal compiler} |
| 190 |
[Karl writes.] My first ChangeLog entry for Web2c seems to be |
| 191 |
February 1990, but I may have done some work before then. In any |
| 192 |
case, Tim Morgan and I were jointly maintaining it for a time. (I |
| 193 |
should mention here that Tim had made Web2c into a real distribution |
| 194 |
long before I had ever used it or even heard of it, and Tom Rokicki |
| 195 |
did the original implementation. When I started, I was using |
| 196 |
@code{pxp} and @code{pc} on VAX 11/750's and the hot new Sun 2 |
| 197 |
machines.) |
| 198 |
|
| 199 |
It must have been later in 1990 and 1991 that I started working on |
| 200 |
@cite{@TeX{} for the Impatient}. Dvips, Xdvi, Web2c, and the GNU |
| 201 |
fontutils (which I was also writing at the time) all used different |
| 202 |
environment variables, and, more importantly, had different bugs in |
| 203 |
their path searching. This became extremely painful, as I was stressing |
| 204 |
everything to the limit working on the book. I also desperately wanted |
| 205 |
to implement subdirectory searching, since I couldn't stand putting |
| 206 |
everything in one big directory, and also couldn't stand having to |
| 207 |
explicitly specify @file{cm}, @file{pandora}, @dots{} in a path. |
| 208 |
|
| 209 |
@cindex Vojta, Paul |
| 210 |
In the first incarnation, I just hacked separately on each |
| 211 |
program---that was the original subdirectory searching code in both |
| 212 |
Xdvi and Dvips. That is, I tried to go with the flow in each program, |
| 213 |
rather than changing the program's calling sequences to conform to new |
| 214 |
routines. |
| 215 |
|
| 216 |
Then, as bugs inevitably appeared, I found I was fixing the same thing |
| 217 |
three times (Web2c and fontutils were already sharing code, since I |
| 218 |
maintained both of those---there was no Dvipsk or Xdvik or Dviljk at |
| 219 |
this point). After a while, I finally started sharing source files. |
| 220 |
They weren't yet a library, though. I just kept things up to date |
| 221 |
with shell scripts. (I was developing on a 386 running ISC 2.2 at the |
| 222 |
time, and so didn't have symbolic links. An awful experience.) |
| 223 |
|
| 224 |
@cindex MacKenzie, David |
| 225 |
The ChangeLogs for Xdvik and Dvipsk record initial releases of those |
| 226 |
distributions in May and June 1992. I think it was because I was tired |
| 227 |
of the different configuration strategies of each program, not so much |
| 228 |
because of the path searching. Autoconf was being developed by David |
| 229 |
MacKenzie and others, and I was adapting it to @TeX{} and friends. |
| 230 |
|
| 231 |
@cindex zuhn, david |
| 232 |
I started to make a separate library that other programs could link with |
| 233 |
on my birthday in April 1993, according to the ChangeLog. I don't |
| 234 |
remember exactly why I finally took the time to make it a separate |
| 235 |
library; a conversation with david zuhn initiated it. Just seemed |
| 236 |
like it was time. |
| 237 |
|
| 238 |
@cindex Walsh, Norman |
| 239 |
@cindex Neumann, Gustaf |
| 240 |
Dviljk got started in March 1994 after I bought a Laserjet 4. (Kpathsea |
| 241 |
work got suspended while Norm Walsh and I, with Gustaf Neumann's help, |
| 242 |
implemented a way for @TeX{} to get at all those neat builtin LJ4 fonts |
| 243 |
@dots{} such a treat to have something to typeset in besides Palatino!) |
| 244 |
|
| 245 |
By spring of 1995, I had implemented just about all the path-searching |
| 246 |
features in Kpathsea that I plan to, driven beyond my initial goals by |
| 247 |
Thomas Esser and others. I then started to integrate Web2c with |
| 248 |
Kpathsea. After the release of a stable Web2c, I hope to be able to stop |
| 249 |
development, and turn most of my attention back to making fonts for GNU. |
| 250 |
(Always assuming Micros**t hasn't completely obliterated Unix by then, |
| 251 |
or that software patents haven't stopped software development by anybody |
| 252 |
smaller than a company with a million-dollar-a-year legal budget. Which |
| 253 |
is actually what I think is likely to happen, but that's another |
| 254 |
story@dots{}) |
| 255 |
|
| 256 |
@cindex Weber, Olaf |
| 257 |
[Olaf writes.] At the end of 1997, Unix is still alive and kicking, |
| 258 |
individuals still develop software, and Web2c development still |
| 259 |
continues. Karl had been looking for some time for someone to take up |
| 260 |
part of the burden, and I volunteered. |
| 261 |
|
| 262 |
@cindex Hoekwater, Taco |
| 263 |
@cindex Breitenlohner, Peter |
| 264 |
[Karl writes again.] Indeed, time goes on. As of 2006 or so, Olaf's |
| 265 |
available time for Kpathsea was reduced, and I started taking overall |
| 266 |
care of it again, although I did not do any significant new |
| 267 |
development. In 2009, Taco Hoekwater implemented a major |
| 268 |
rearrangement to make the library suitable for use within the MetaPost |
| 269 |
library (@pxref{Programming overview}). Also, for some years now, |
| 270 |
Peter Breitenlohner has made many improvements to the infrastructure |
| 271 |
and kept it up-to-date with respect to the overall @TeX{} Live build, |
| 272 |
where Kpathsea is now maintained. |
| 273 |
|
| 274 |
|
| 275 |
@c emacs-page separate file so we can easily generate unixtex.ftp. |
| 276 |
@include unixtex.texi |
| 277 |
|
| 278 |
|
| 279 |
@node Security |
| 280 |
@chapter Security |
| 281 |
|
| 282 |
@cindex security considerations |
| 283 |
|
| 284 |
None of the programs in the @TeX{} system require any special system |
| 285 |
privileges, so there's no first-level security concern of people gaining |
| 286 |
illegitimate root access. |
| 287 |
|
| 288 |
Thus, the general goal of our security measures is to make an |
| 289 |
untrusted @TeX{} document safe to execute, in the sense of no document |
| 290 |
being able to change the system or user configuration, or transmit |
| 291 |
information to an attacker. Here are some of the steps that have been |
| 292 |
taken to make the @TeX{} system safe in this regard: |
| 293 |
|
| 294 |
@itemize |
| 295 |
@item |
| 296 |
@cindex trojan horse attack |
| 297 |
@flindex .profile@r{, (un)writable by @TeX{}} |
| 298 |
@findex \openout |
| 299 |
A @TeX{} document can write to arbitrary files via @code{\openout}, |
| 300 |
e.g., @file{~/.profile}, and thus an unwitting user who runs @TeX{} on |
| 301 |
an untrusted document is vulnerable to a trojan horse attack. This |
| 302 |
loophole is closed by default, but you can be permissive if you so |
| 303 |
desire in @file{texmf.cnf}; see the variable @code{openout_any}. |
| 304 |
@xref{tex invocation,,, web2c, Web2c}. MetaPost has the same issue |
| 305 |
(Metafont cannot write arbitrary files). |
| 306 |
|
| 307 |
@item |
| 308 |
@cindex shell commands, security |
| 309 |
Dvips, Xdvi, @TeX{}, and others can execute shell commands. By |
| 310 |
default, only a handful of commands that are believed to be safe, to |
| 311 |
the best of our ability to check, are allowed. For the list, see the |
| 312 |
@code{shell_escape_commands} variable in @file{texmf.cnf} |
| 313 |
(@pxref{Shell escapes,,, web2c, Web2c}). For more information, e.g., |
| 314 |
to disable this completely, see the @samp{-R} option in @ref{Option |
| 315 |
details,,, dvips, Dvips}, the xdvi man page, and @ref{tex |
| 316 |
invocation,,, web2c, Web2c}, respectively. |
| 317 |
|
| 318 |
@item |
| 319 |
@cindex Lua@TeX{} and security |
| 320 |
@cindex kpse mode of Lua@TeX{} |
| 321 |
@cindex Con@TeX{}t and (no) security |
| 322 |
Lua@TeX{} is a special case. Since Lua is a general-purpose |
| 323 |
programming language, it has all the usual functionality for writing |
| 324 |
files, executing shell commands, opening network connections, and |
| 325 |
plenty more. When Lua@TeX{} is used in its so-called ``kpse'' mode, |
| 326 |
as with Lua@LaTeX{}, we have nevertheless done our best to also make |
| 327 |
it safe to execute by default, by disabling or restricting the various |
| 328 |
problematic Lua features. @xref{Safe filenames}, for a bit more about |
| 329 |
this. (When Lua@TeX{} is run in non-kpse mode, as with Con@TeX{}t |
| 330 |
MkIV, everything is allowed; thus, untrusted documents should not be |
| 331 |
processed.) |
| 332 |
|
| 333 |
@item |
| 334 |
@cindex crashes of @TeX{} and security |
| 335 |
There are some well-known ways to crash @TeX{}, using arithmetic |
| 336 |
overflow, which Knuth deliberately left unchecked, and other nefarious |
| 337 |
constructs; some are listed at |
| 338 |
@url{https://tug.org/texmfbug/nobug.html}. While disturbing, @TeX{} |
| 339 |
has no special system access and so these crashes don't present a |
| 340 |
security risk. |
| 341 |
|
| 342 |
@item |
| 343 |
One more issue is the desire for a globally writable font cache |
| 344 |
directory; see the section below for this (@ref{Global font cache and |
| 345 |
security}). |
| 346 |
|
| 347 |
@end itemize |
| 348 |
|
| 349 |
@menu |
| 350 |
* Global font cache and security:: |
| 351 |
@end menu |
| 352 |
|
| 353 |
@node Global font cache and security |
| 354 |
@section Global font cache and security |
| 355 |
|
| 356 |
@cindex local cache of fonts |
| 357 |
@cindex cache of fonts, local |
| 358 |
It's useful to make arbitrary fonts on user demand with @code{mktexpk} |
| 359 |
and friends. Where do these files get installed? By default, the |
| 360 |
@code{mktexpk} distributed with Kpathsea assumes a world-writable |
| 361 |
@file{/var/tmp} directory; this is a simple and convenient approach, |
| 362 |
but it does not suit all situations, because it means that a local |
| 363 |
cache of fonts is created on every user's system. |
| 364 |
|
| 365 |
@cindex globally writable directories |
| 366 |
To avoid this duplication, many people consider a shared, globally |
| 367 |
writable font tree desirable, in spite of the potential security |
| 368 |
problems. To do this you should change the value of @code{VARTEXFONTS} |
| 369 |
in @file{texmf.cnf} to refer to some globally known directory. |
| 370 |
@xref{mktex configuration}. |
| 371 |
|
| 372 |
@cindex append-only directories and @code{mktexpk} |
| 373 |
The first restriction you can apply is to make newly-created directories |
| 374 |
under @file{texmf} be append-only with an option in @file{mktex.cnf}. |
| 375 |
@xref{mktex configuration}. |
| 376 |
|
| 377 |
@cindex group-writable directories |
| 378 |
@cindex setgid scripts |
| 379 |
Another approach is to establish a group (or user) for @TeX{} files, |
| 380 |
make the @file{texmf} tree writable only to that group (or user), and |
| 381 |
make @code{mktexpk} et al.@: setgid to that group (or setuid to that |
| 382 |
user). Then users must invoke the scripts to install things. (If |
| 383 |
you're worried about the likelihood of security holes in scripts, you |
| 384 |
could write a C wrapper to exec the script.) |
| 385 |
|
| 386 |
@cindex file permissions |
| 387 |
@cindex permissions, file |
| 388 |
The @file{mktex@dots{}} scripts install files with the same read and |
| 389 |
write permissions as the directory they are installed in. The |
| 390 |
executable, sgid, suid, and sticky bits are always cleared. |
| 391 |
|
| 392 |
@cindex directory permissions |
| 393 |
@cindex permissions, directory |
| 394 |
Any directories created by the @file{mktex@dots{}} scripts have the |
| 395 |
same permissions as their parent directory, unless the |
| 396 |
@code{appendonlydir} feature is used, in which case the sticky bit is |
| 397 |
always set. |
| 398 |
|
| 399 |
Nowadays, with bitmap files rarely used, and with individual systems |
| 400 |
being so much more powerful, this is less of an issue than in the |
| 401 |
past. But the question still comes up occasionally. |
| 402 |
|
| 403 |
|
| 404 |
@node TeX directory structure |
| 405 |
@chapter @TeX{} directory structure |
| 406 |
|
| 407 |
@vindex TEXMF |
| 408 |
@cindex @TeX{} directory structure |
| 409 |
@cindex directory structure, for @TeX{} files |
| 410 |
@cindex skeleton @TeX{} directory |
| 411 |
@cindex TDS |
| 412 |
|
| 413 |
This section describes the default installation hierarchy of the |
| 414 |
distribution. It conforms to both the GNU coding standards and the |
| 415 |
@TeX{} directory structure (TDS) standard. For rationale and further |
| 416 |
explanation, please see those documents. The GNU document is |
| 417 |
available from @url{https://gnu.org/prep/standards}. The TDS |
| 418 |
document is available from @url{https://ctan.org/pkg/tds} |
| 419 |
(@pxref{unixtex.ftp}). |
| 420 |
|
| 421 |
In short, here is a skeleton of the default directory structure, |
| 422 |
extracted from the TDS document: |
| 423 |
|
| 424 |
@example |
| 425 |
@var{prefix}/ @r{installation root (@file{/usr/local} by default)} |
| 426 |
bin/ @r{executables} |
| 427 |
man/ @r{man pages} |
| 428 |
include/ @r{C header files} |
| 429 |
info/ @r{GNU info files} |
| 430 |
lib/ @r{libraries (@file{libkpathsea.*})} |
| 431 |
share/ @r{architecture-independent files} |
| 432 |
texmf/ @r{TDS root} |
| 433 |
bibtex/ @r{Bib@TeX{} input files} |
| 434 |
bib/ @r{Bib@TeX{} databases} |
| 435 |
base/ @r{base distribution (e.g., @samp{xampl.bib})} |
| 436 |
misc/ @r{single-file databases} |
| 437 |
@var{pkg}/ @r{name of a package} |
| 438 |
bst/ @r{Bib@TeX{} style files} |
| 439 |
base/ @r{base distribution (e.g., @samp{plain.bst}, @samp{acm.bst})} |
| 440 |
misc/ @r{single-file styles} |
| 441 |
@var{pkg}/ @r{name of a package} |
| 442 |
doc/ @r{additional documentation} |
| 443 |
dvips/ @r{@samp{.pro}, @samp{.ps}, @samp{psfonts.map}} |
| 444 |
fonts/ @r{font-related files} |
| 445 |
@var{type}/ @r{file type (e.g., @samp{tfm}, @samp{pk})} |
| 446 |
@var{mode}/ @r{type of output device (types @samp{pk} and @samp{gf} only)} |
| 447 |
@var{supplier}/ @r{name of a font supplier (e.g., @samp{public})} |
| 448 |
@var{typeface}/ @r{name of a typeface (e.g., @samp{cm})} |
| 449 |
dpi@var{nnn}/ @r{font resolution (types @samp{pk} and @samp{gf} only)} |
| 450 |
metafont/ @r{Metafont (non-font) input files} |
| 451 |
base/ @r{base distribution (e.g., @samp{plain.mf})} |
| 452 |
misc/ @r{single-file packages (e.g., @samp{modes.mf})} |
| 453 |
@var{pkg}/ @r{name of a package (e.g., @samp{mfpic})} |
| 454 |
metapost/ @r{MetaPost input files} |
| 455 |
base/ @r{base distribution (e.g., @samp{plain.mp})} |
| 456 |
misc/ @r{single-file packages} |
| 457 |
@var{pkg}/ @r{name of a package} |
| 458 |
support/ @r{support files for MetaPost-related utilities (e.g., @samp{trfonts.map})} |
| 459 |
mft/ @r{@samp{MFT} inputs (e.g., @samp{plain.mft})} |
| 460 |
tex/ @r{@TeX{} input files} |
| 461 |
@var{format}/ @r{name of a format (e.g., @samp{plain})} |
| 462 |
base/ @r{base distribution for @var{format} (e.g., @samp{plain.tex})} |
| 463 |
misc/ @r{single-file packages (e.g., @samp{webmac.tex})} |
| 464 |
local/ @r{local additions to or local configuration files for @var{format}} |
| 465 |
@var{pkg}/ @r{name of a package (e.g., @samp{graphics}, @samp{mfnfss})} |
| 466 |
generic/ @r{format-independent packages} |
| 467 |
hyphen/ @r{hyphenation patterns (e.g., @samp{hyphen.tex})} |
| 468 |
images/ @r{image input files (e.g., Encapsulated PostScript)} |
| 469 |
misc/ @r{single-file format-independent packages (e.g., @samp{null.tex}).} |
| 470 |
@var{pkg}/ @r{name of a package (e.g., @samp{babel})} |
| 471 |
web2c/ @r{implementation-dependent files (@file{.pool}, @file{.fmt}, @file{texmf.cnf}, etc.)} |
| 472 |
@end example |
| 473 |
|
| 474 |
Some concrete examples for most file types: |
| 475 |
|
| 476 |
@example |
| 477 |
/usr/local/bin/tex |
| 478 |
/usr/local/man/man1/xdvi.1 |
| 479 |
/usr/local/info/kpathsea.info |
| 480 |
/usr/local/lib/libkpathsea.a |
| 481 |
/usr/local/share/texmf/bibtex/bst/base/plain.bst |
| 482 |
/usr/local/share/texmf/fonts/pk/ljfour/public/cm/cmr10.600pk |
| 483 |
/usr/local/share/texmf/fonts/source/public/pandora/pnr10.mf |
| 484 |
/usr/local/share/texmf/fonts/tfm/public/cm/cmr10.tfm |
| 485 |
/usr/local/share/texmf/fonts/type1/adobe/utopia/putr.pfa |
| 486 |
/usr/local/share/texmf/metafont/base/plain.mf |
| 487 |
/usr/local/share/texmf/metapost/base/plain.mp |
| 488 |
/usr/local/share/texmf/tex/plain/base/plain.tex |
| 489 |
/usr/local/share/texmf/tex/generic/hyphen/hyphen.tex |
| 490 |
/usr/local/share/texmf/web2c/tex.pool |
| 491 |
/usr/local/share/texmf/web2c/tex.fmt |
| 492 |
/usr/local/share/texmf/web2c/texmf.cnf |
| 493 |
@end example |
| 494 |
|
| 495 |
|
| 496 |
@node Path searching |
| 497 |
@chapter Path searching |
| 498 |
|
| 499 |
@cindex path searching |
| 500 |
|
| 501 |
This chapter describes the generic path searching mechanism Kpathsea |
| 502 |
provides. For information about searching for particular file types |
| 503 |
(e.g., @TeX{} fonts), see the next chapter. |
| 504 |
|
| 505 |
@cindex translations, of path searching description |
| 506 |
This section, with minor differences, has been translated into several |
| 507 |
other languages (Chinese, Spanish, Russian, Japanese, French, German, |
| 508 |
@dots{}) as part of the @TeX{} Live guide; see |
| 509 |
@url{https://tug.org/texlive/doc.html} for links. |
| 510 |
|
| 511 |
@menu |
| 512 |
* Searching overview:: Basic scheme for searching. |
| 513 |
* Path sources:: Where search paths can be defined. |
| 514 |
* Path expansion:: Special constructs in search paths. |
| 515 |
* Casefolding search:: Fallback to case-insensitive search. |
| 516 |
* Filename database:: Using an externally-built list to search. |
| 517 |
* Invoking kpsewhich:: Standalone path lookup. |
| 518 |
@end menu |
| 519 |
|
| 520 |
|
| 521 |
@node Searching overview |
| 522 |
@section Searching overview |
| 523 |
|
| 524 |
@cindex searching overview |
| 525 |
@cindex path searching, overview |
| 526 |
@cindex overview of path searching |
| 527 |
|
| 528 |
@cindex search path, defined |
| 529 |
A @dfn{search path} is a colon-separated list of @dfn{path elements}, |
| 530 |
which are directory names with a few extra frills. A search path can |
| 531 |
come from (a combination of) many sources; see below. To look up a file |
| 532 |
@samp{foo} along a path @samp{.:/dir}, Kpathsea checks each element of |
| 533 |
the path in turn: first @file{./foo}, then @file{/dir/foo}, returning |
| 534 |
the first match (or possibly all matches). |
| 535 |
|
| 536 |
@cindex magic characters |
| 537 |
@kindex : @r{may not be :} |
| 538 |
@kindex / @r{may not be /} |
| 539 |
The ``colon'' and ``slash'' mentioned here aren't necessarily @samp{:} |
| 540 |
and @samp{/} on non-Unix systems. Kpathsea tries to adapt to other |
| 541 |
operating systems' conventions. |
| 542 |
|
| 543 |
@cindex database search |
| 544 |
@cindex searching the database |
| 545 |
To check a particular path element @var{e}, Kpathsea first sees if a |
| 546 |
prebuilt database (@pxref{Filename database}) applies to @var{e}, i.e., |
| 547 |
if the database is in a directory that is a prefix of @var{e}. If so, |
| 548 |
the path specification is matched against the contents of the database. |
| 549 |
|
| 550 |
@cindex floating directories |
| 551 |
@cindex filesystem search |
| 552 |
@cindex disk search |
| 553 |
@cindex searching the disk |
| 554 |
If the database does not exist, or does not apply to this path element, |
| 555 |
or contains no matches, the filesystem is searched (if this was not |
| 556 |
forbidden by the specification with @samp{!!} and if the file being |
| 557 |
searched for must exist). Kpathsea constructs the list of directories |
| 558 |
that correspond to this path element, and then checks in each for the |
| 559 |
file being searched for. (To help speed future lookups of files in the |
| 560 |
same directory, the directory in which a file is found is floated to the |
| 561 |
top of the directory list.) |
| 562 |
|
| 563 |
@cindex must exist |
| 564 |
@cindex VF files, not found |
| 565 |
@flindex cmr10.vf |
| 566 |
@findex \openin |
| 567 |
The ``file must exist'' condition comes into play with VF files and |
| 568 |
input files read by the @TeX{} @samp{\openin} command. These files |
| 569 |
might very well not exist (consider @file{cmr10.vf}), and so it would |
| 570 |
be wrong to search the disk for them. Therefore, if you fail to |
| 571 |
update @file{ls-R} when you install a new VF file, it will not be |
| 572 |
found. |
| 573 |
|
| 574 |
Each path element is checked in turn: first the database, then the |
| 575 |
disk. If a match is found, the search stops and the result is |
| 576 |
returned (unless the search explicitly requested all matches). This |
| 577 |
avoids possibly-expensive processing of path specifications that are |
| 578 |
never needed on a particular run. |
| 579 |
|
| 580 |
On Unix-like systems, if no match is found by any of the above, and |
| 581 |
the path element allows checking the filesystem (per the above), a |
| 582 |
final check is made for a case-insensitive match. Thus, looking for a |
| 583 |
name like @samp{./FooBar.TeX} will match a file @samp{./foobar.tex}, |
| 584 |
and vice versa. This is not done on Windows. @xref{Casefolding |
| 585 |
search}. |
| 586 |
|
| 587 |
@cindex expansion, path element |
| 588 |
Although the simplest and most common path element is a directory name, |
| 589 |
Kpathsea supports additional features in search paths: layered default |
| 590 |
values, environment variable names, config file values, users' home |
| 591 |
directories, and recursive subdirectory searching. Thus, we say that |
| 592 |
Kpathsea @dfn{expands} a path element, meaning transforming all the |
| 593 |
magic specifications into the basic directory name or names. This |
| 594 |
process is described in the sections below. It happens in the same |
| 595 |
order as the sections. |
| 596 |
|
| 597 |
@cindex absolute filenames |
| 598 |
@cindex relative filenames |
| 599 |
@cindex explicitly relative filenames |
| 600 |
@cindex filenames, absolute or explicitly relative |
| 601 |
Exception to all of the above: If the filename being searched for is |
| 602 |
absolute or explicitly relative, i.e., starts with @samp{/} or @samp{./} |
| 603 |
or @samp{../}, Kpathsea simply checks if that file exists, with a |
| 604 |
fallback to a casefolding match if needed and enabled, as described above. |
| 605 |
|
| 606 |
@cindex permission denied |
| 607 |
@cindex unreadable files |
| 608 |
@cindex access warnings |
| 609 |
@cindex warnings, file access |
| 610 |
@flindex lost+found @r{directory} |
| 611 |
@vindex TEX_HUSH |
| 612 |
Ordinarily, if Kpathsea tries to access a file or directory that |
| 613 |
cannot be read, it gives a warning. This is so you will be alerted to |
| 614 |
directories or files that accidentally lack any read permission (for |
| 615 |
example, a @file{lost+found} directory). If you prefer not to see |
| 616 |
these warnings, include the value @samp{readable} in the |
| 617 |
@code{TEX_HUSH} environment variable or config file value. |
| 618 |
|
| 619 |
This generic path searching algorithm is implemented in |
| 620 |
@file{kpathsea/pathsearch.c}. It is employed by a higher-level |
| 621 |
algorithm when searching for a file of a particular type (@pxref{File |
| 622 |
lookup}, and @ref{Glyph lookup}). |
| 623 |
|
| 624 |
|
| 625 |
@node Path sources |
| 626 |
@section Path sources |
| 627 |
|
| 628 |
@cindex path sources |
| 629 |
@cindex sources for search paths |
| 630 |
|
| 631 |
A search path or other configuration value can come from many sources. |
| 632 |
In the order in which Kpathsea looks for them: |
| 633 |
|
| 634 |
@enumerate |
| 635 |
@item |
| 636 |
@opindex @samp{--cnf-line}, source for path |
| 637 |
A command-line option such as @code{--cnf-line}, available in |
| 638 |
@file{kpsewhich} and most @TeX{} engines. @xref{Path searching |
| 639 |
options}. |
| 640 |
|
| 641 |
@cindex environment variable, source for path |
| 642 |
A user-set environment variable, e.g., @code{TEXINPUTS}. |
| 643 |
Environment variables with an underscore and the program name appended |
| 644 |
override; for example, @code{TEXINPUTS_latex} overrides @code{TEXINPUTS} |
| 645 |
if the program being run is named @samp{latex}. |
| 646 |
|
| 647 |
@item |
| 648 |
A program-specific configuration file, e.g., an @samp{S /a:/b} line in |
| 649 |
Dvips' @file{config.ps} (@pxref{Config files,,, dvips, Dvips}). |
| 650 |
|
| 651 |
@item |
| 652 |
@cindex configuration file, source for path |
| 653 |
@cindex Kpathsea config file, source for path |
| 654 |
@flindex texmf.cnf@r{, source for path} |
| 655 |
A line in a Kpathsea configuration file @file{texmf.cnf}, e.g., |
| 656 |
@samp{TEXINPUTS=/c:/d} (see below). |
| 657 |
|
| 658 |
@item |
| 659 |
@cindex compilation value, source for path |
| 660 |
The compile-time default (specified in @file{kpathsea/paths.h}). |
| 661 |
@end enumerate |
| 662 |
|
| 663 |
You can see each of these values for a given search path by using the |
| 664 |
debugging options (@pxref{Debugging}). |
| 665 |
|
| 666 |
These sources may be combined via default expansion (@pxref{Default |
| 667 |
expansion}). |
| 668 |
|
| 669 |
@menu |
| 670 |
* Config files:: Kpathsea's runtime config files (texmf.cnf). |
| 671 |
@end menu |
| 672 |
|
| 673 |
|
| 674 |
@node Config files |
| 675 |
@subsection Config files |
| 676 |
|
| 677 |
@cindex config files |
| 678 |
@flindex texmf.cnf@r{, definition for} |
| 679 |
|
| 680 |
@cindex runtime configuration files |
| 681 |
@vindex TEXMFCNF |
| 682 |
As mentioned above, Kpathsea reads @dfn{runtime configuration files} |
| 683 |
named @file{texmf.cnf} for search path and other definitions. The |
| 684 |
search path used to look for these configuration files is named |
| 685 |
@code{TEXMFCNF}, and is constructed in the usual way, as described |
| 686 |
above, except that configuration files cannot be used to define the |
| 687 |
path, naturally; also, an @file{ls-R} database is not used to search for |
| 688 |
them. |
| 689 |
|
| 690 |
Kpathsea reads @emph{all} @file{texmf.cnf} files in the search path, not |
| 691 |
just the first one found; definitions in earlier files override those in |
| 692 |
later files. Thus, if the search path is @samp{.:$TEXMF}, values from |
| 693 |
@file{./texmf.cnf} override those from @file{$TEXMF/texmf.cnf}. |
| 694 |
|
| 695 |
@vindex KPATHSEA_WARNING |
| 696 |
@cindex warning, about missing @file{texmf.cnf} |
| 697 |
@cindex @file{texmf.cnf} missing, warning about |
| 698 |
If Kpathsea cannot find any @file{texmf.cnf} file, it reports a |
| 699 |
warning including all the directories it checked. If you don't want |
| 700 |
to see this warning, set the environment variable |
| 701 |
@env{KPATHSEA_WARNING} to the single character @samp{0} (zero, not |
| 702 |
oh). |
| 703 |
|
| 704 |
While (or instead of) reading this description, you may find it helpful |
| 705 |
to look at the distributed @file{texmf.cnf}, which uses or at least |
| 706 |
mentions most features. The format of @file{texmf.cnf} files follows: |
| 707 |
|
| 708 |
@itemize @bullet |
| 709 |
@item |
| 710 |
@cindex comments, in @file{texmf.cnf} |
| 711 |
Comments start with @samp{%} or @samp{#}, either at the beginning of a |
| 712 |
line or preceded by whitespace, and continue to the end of the line. |
| 713 |
That is, similar to most shells, a comment character in the ``middle'' |
| 714 |
of a value does not start a comment. Examples: |
| 715 |
|
| 716 |
@example |
| 717 |
% this is a comment |
| 718 |
var = a%b % but the value of var will be "a%b" |
| 719 |
@end example |
| 720 |
|
| 721 |
@item |
| 722 |
@cindex blank lines, in @file{texmf.cnf} |
| 723 |
Blank lines are ignored. |
| 724 |
|
| 725 |
@item |
| 726 |
@cindex backslash-newline |
| 727 |
@cindex continuation character |
| 728 |
@cindex whitespace, not ignored on continuation lines |
| 729 |
@kindex \@r{, line continuation in @file{texmf.cnf}} |
| 730 |
A @samp{\} at the end of a line acts as a continuation character, i.e., |
| 731 |
the next line is appended. Whitespace at the beginning of continuation |
| 732 |
lines is not ignored. |
| 733 |
|
| 734 |
@item Each remaining line will look like: |
| 735 |
|
| 736 |
@example |
| 737 |
@var{variable} @r{[}. @var{progname}@r{]} @r{[}=@r{]} @var{value} |
| 738 |
@end example |
| 739 |
|
| 740 |
@noindent where the @samp{=} and surrounding whitespace is optional. |
| 741 |
|
| 742 |
@item |
| 743 |
@cindex identifiers, characters valid in |
| 744 |
The @var{variable} name may contain any character other than whitespace, |
| 745 |
@samp{=}, or @samp{.}, but sticking to @samp{A-Za-z_} is safest. |
| 746 |
|
| 747 |
@kindex .@var{progname} @r{qualifier in @file{texmf.cnf}} |
| 748 |
@item If @samp{.@var{progname}} is present (preceding spaces are |
| 749 |
ignored), the definition only applies if the program that is running |
| 750 |
is named (i.e., the last component of @code{argv[0]} is) |
| 751 |
@var{progname} or @file{@var{progname}.@{exe,bat,cmd,...@}}. Most |
| 752 |
notably, this allows different flavors of @TeX{} to have different |
| 753 |
search paths. The @var{progname} value is used literally, without |
| 754 |
variable or other expansions. |
| 755 |
|
| 756 |
@item |
| 757 |
@cindex right-hand side of variable assignments |
| 758 |
Considered as strings, @var{value} may contain any character. |
| 759 |
However, in practice most @file{texmf.cnf} values are related to path |
| 760 |
expansion, and since various special characters are used in expansion, |
| 761 |
such as braces and commas, they cannot be used in directory names. |
| 762 |
|
| 763 |
The @samp{$@var{var}.@var{prog}} feature is not available on the |
| 764 |
right-hand side; instead, you must use an additional variable (see |
| 765 |
below for example). |
| 766 |
|
| 767 |
@kindex ; @r{translated to @samp{:} in @file{texmf.cnf}} |
| 768 |
A @samp{;} in @var{value} is translated to @samp{:} if running under |
| 769 |
Unix, in order to have a single @file{texmf.cnf} that can support both |
| 770 |
Unix and Windows systems. This translation happens with any value, not |
| 771 |
just search paths, but fortunately in practice @samp{;} is not needed |
| 772 |
in other values. |
| 773 |
|
| 774 |
@item All definitions are read before anything is expanded, so you can |
| 775 |
use variables before they are defined (like Make, unlike most other |
| 776 |
programs). |
| 777 |
@end itemize |
| 778 |
|
| 779 |
@noindent Here is a configuration file fragment illustrating most of |
| 780 |
these points: |
| 781 |
|
| 782 |
@example |
| 783 |
% TeX input files -- i.e., anything to be found by \input or \openin ... |
| 784 |
latex209_inputs = .:$TEXMF/tex/latex209//:$TEXMF/tex// |
| 785 |
latex2e_inputs = .:$TEXMF/tex/latex//:$TEXMF/tex// |
| 786 |
TEXINPUTS = .:$TEXMF/tex// |
| 787 |
TEXINPUTS.latex209 = $latex209_inputs |
| 788 |
TEXINPUTS.latex2e = $latex2e_inputs |
| 789 |
TEXINPUTS.latex = $latex2e_inputs |
| 790 |
@end example |
| 791 |
|
| 792 |
@kindex = @r{omitted in @file{texmf.cnf} and misparsing} |
| 793 |
The combination of spaces being ignored before the @code{.} of a |
| 794 |
program name qualifer and the optional @samp{=} for the assignment has |
| 795 |
an unexpected consequence: if the value begins with a literal @samp{.} |
| 796 |
and the @samp{=} is omitted, the intended value is interpreted as a |
| 797 |
program name. For example, a line @code{var .;/some/path} is taken as |
| 798 |
an empty value for @code{var} running under the program named |
| 799 |
@samp{;/some/path}. To diagnose this, Kpathsea warns if the program |
| 800 |
name contains a path separator or other special character. The |
| 801 |
simplest way to avoid the problem is to use the @code{=}. |
| 802 |
|
| 803 |
Exactly when a character will be considered special or act as itself |
| 804 |
depends on the context in which it is used. The rules are inherent in |
| 805 |
the multiple levels of interpretation of the configuration (parsing, |
| 806 |
expansion, search, @dots{}) and so cannot be concisely stated, |
| 807 |
unfortunately. There is no general escape mechanism; in particular, |
| 808 |
@samp{\} is not an ``escape character'' in @file{texmf.cnf} files. |
| 809 |
When it comes choosing directory names for installation, it is safest to |
| 810 |
avoid them all. |
| 811 |
|
| 812 |
@flindex cnf.c |
| 813 |
The implementation of all this is in @file{kpathsea/cnf.c}. |
| 814 |
|
| 815 |
|
| 816 |
@node Path expansion |
| 817 |
@section Path expansion |
| 818 |
|
| 819 |
@cindex path expansion |
| 820 |
@cindex expansion, search path |
| 821 |
|
| 822 |
Kpathsea recognizes certain special characters and constructions in |
| 823 |
search paths, similar to that in shells. As a general example: |
| 824 |
@samp{~$USER/@{foo,bar@}//baz} expands to all subdirectories under |
| 825 |
directories @file{foo} and @file{bar} in @t{$USER}'s home directory that |
| 826 |
contain a directory or file @file{baz}. |
| 827 |
|
| 828 |
These expansions are explained in the sections below. |
| 829 |
|
| 830 |
@menu |
| 831 |
* Default expansion:: a: or :a or a::b expands to a default. |
| 832 |
* Variable expansion:: $foo and $@{foo@} expand to environment values. |
| 833 |
* Tilde expansion:: ~ and ~user expand to home directories. |
| 834 |
* Brace expansion:: a@{foo,bar@}b expands to afoob abarb. |
| 835 |
* KPSE_DOT expansion:: . is replaced with $KPSE_DOT if it is defined. |
| 836 |
* Subdirectory expansion:: a// and a//b recursively expand to subdirs. |
| 837 |
@end menu |
| 838 |
|
| 839 |
|
| 840 |
@node Default expansion |
| 841 |
@subsection Default expansion |
| 842 |
|
| 843 |
@kindex :: @r{expansion} |
| 844 |
@cindex doubled colons |
| 845 |
@cindex leading colons |
| 846 |
@cindex trailing colons |
| 847 |
@cindex extra colons |
| 848 |
@cindex default expansion |
| 849 |
@cindex expansion, default |
| 850 |
|
| 851 |
If the highest-priority search path (@pxref{Path sources}) contains an |
| 852 |
@dfn{extra colon} (i.e., leading, trailing, or doubled), Kpathsea |
| 853 |
inserts at that point the next-highest-priority search path that is |
| 854 |
defined. If that inserted path has an extra colon, the same happens |
| 855 |
with the next-highest. (An extra colon in the compile-time default |
| 856 |
value has unpredictable results, so installers beware.) |
| 857 |
|
| 858 |
For example, given an environment variable setting |
| 859 |
|
| 860 |
@example |
| 861 |
setenv TEXINPUTS /home/karl: |
| 862 |
@end example |
| 863 |
|
| 864 |
@noindent and a @code{TEXINPUTS} value from @file{texmf.cnf} of |
| 865 |
|
| 866 |
@example |
| 867 |
.:$TEXMF//tex |
| 868 |
@end example |
| 869 |
|
| 870 |
@noindent then the final value used for searching will be: |
| 871 |
|
| 872 |
@example |
| 873 |
/home/karl:.:$TEXMF//tex |
| 874 |
@end example |
| 875 |
|
| 876 |
Put another way, default expansion works on ``formats'' (search |
| 877 |
paths), and not directly on environment variables. Example, showing |
| 878 |
the trailing @samp{:} ignored in the first case and expanded in the second: |
| 879 |
|
| 880 |
@example |
| 881 |
$ env TTFONTS=/tmp: kpsewhich --expand-path '$TTFONTS' |
| 882 |
/tmp |
| 883 |
$ env TTFONTS=/tmp: kpsewhich --show-path=.ttf |
| 884 |
/tmp:.:/home/olaf/texmf/fonts/truetype//:... |
| 885 |
@end example |
| 886 |
|
| 887 |
Since Kpathsea looks for multiple configuration files, it would be |
| 888 |
natural to expect that (for example) an extra colon in |
| 889 |
@file{./texmf.cnf} would expand to the path in @file{$TEXMF/texmf.cnf}. |
| 890 |
Or, with Dvips' configuration files, that an extra colon in |
| 891 |
@file{config.$PRINTER} would expand to the path in @file{config.ps}. |
| 892 |
This doesn't happen. It's not clear this would be desirable in all |
| 893 |
cases, and trying to devise a way to specify the path to which the extra |
| 894 |
colon should expand seemed truly baroque. |
| 895 |
@cindex Bach, Johann Sebastian |
| 896 |
|
| 897 |
Technicality: Since it would be useless to insert the default value in |
| 898 |
more than one place, Kpathsea changes only one extra @samp{:} and leaves |
| 899 |
any others in place (they will eventually be ignored). Kpathsea checks |
| 900 |
first for a leading @samp{:}, then a trailing @samp{:}, then a doubled |
| 901 |
@samp{:}. |
| 902 |
|
| 903 |
@flindex kdefault.c |
| 904 |
You can trace this by debugging ``paths'' (@pxref{Debugging}). |
| 905 |
Default expansion is implemented in the source file |
| 906 |
@file{kpathsea/kdefault.c}. |
| 907 |
|
| 908 |
|
| 909 |
@node Variable expansion |
| 910 |
@subsection Variable expansion |
| 911 |
|
| 912 |
@kindex $ @r{expansion} |
| 913 |
@cindex environment variables in paths |
| 914 |
@cindex variable expansion |
| 915 |
@cindex expansion, variable |
| 916 |
@flindex texmf.cnf@r{, and variable expansion} |
| 917 |
|
| 918 |
@samp{$foo} or @samp{$@{foo@}} in a path element is replaced by (1) the |
| 919 |
value of an environment variable @samp{foo} (if defined); (2) the value |
| 920 |
of @samp{foo} from @file{texmf.cnf} (if defined); (3) the empty string. |
| 921 |
|
| 922 |
If the character after the @samp{$} is alphanumeric or @samp{_}, the |
| 923 |
variable name consists of all consecutive such characters. If the |
| 924 |
character after the @samp{$} is a @samp{@{}, the variable name consists |
| 925 |
of everything up to the next @samp{@}} (braces may not be nested around |
| 926 |
variable names). Otherwise, Kpathsea gives a warning and ignores the |
| 927 |
@samp{$} and its following character. |
| 928 |
|
| 929 |
@cindex quoting variable values |
| 930 |
@cindex shell variables |
| 931 |
You must quote the @t{$}'s and braces as necessary for your shell. |
| 932 |
@emph{Shell} variable values cannot be seen by Kpathsea, i.e., ones |
| 933 |
defined by @code{set} in C shells and without @code{export} in Bourne |
| 934 |
shells. |
| 935 |
|
| 936 |
For example, given |
| 937 |
@example |
| 938 |
setenv tex /home/texmf |
| 939 |
setenv TEXINPUTS .:$tex:$@{tex@}prev |
| 940 |
@end example |
| 941 |
@noindent the final @code{TEXINPUTS} path is the three directories: |
| 942 |
@example |
| 943 |
.:/home/texmf:/home/texmfprev |
| 944 |
@end example |
| 945 |
|
| 946 |
The @samp{.@var{progname}} suffix on variables and |
| 947 |
@samp{_@var{progname}} on environment variable names are not implemented |
| 948 |
for general variable expansions. These are only recognized when search |
| 949 |
paths are initialized (@pxref{Path sources}). |
| 950 |
|
| 951 |
@flindex variable.c |
| 952 |
Variable expansion is implemented in the source file |
| 953 |
@file{kpathsea/variable.c}. |
| 954 |
|
| 955 |
|
| 956 |
@node Tilde expansion |
| 957 |
@subsection Tilde expansion |
| 958 |
|
| 959 |
@kindex ~ @r{expansion} |
| 960 |
@cindex home directories in paths |
| 961 |
@cindex tilde expansion |
| 962 |
@cindex expansion, tilde |
| 963 |
|
| 964 |
@vindex HOME@r{, as ~ expansion} |
| 965 |
@vindex USERPROFILE@r{, as ~ expansion} |
| 966 |
A leading @samp{~} in a path element is replaced by the value of the |
| 967 |
environment variable @code{HOME}, or @file{.} if @code{HOME} is not |
| 968 |
set. On Windows, the environment variable @code{USERPROFILE} is |
| 969 |
checked instead of @code{HOME}. |
| 970 |
|
| 971 |
A leading @samp{~@var{user}} in a path element is replaced by |
| 972 |
@var{user}'s home directory from the system @file{passwd} database. |
| 973 |
|
| 974 |
For example, |
| 975 |
@example |
| 976 |
setenv TEXINPUTS ~/mymacros: |
| 977 |
@end example |
| 978 |
|
| 979 |
@noindent will prepend a directory @file{mymacros} in your home |
| 980 |
directory to the default path. |
| 981 |
|
| 982 |
@cindex @t{root} user |
| 983 |
@cindex trailing @samp{/} in home directory |
| 984 |
@kindex /@r{, trailing in home directory} |
| 985 |
As a special case, if a home directory ends in @samp{/}, the trailing |
| 986 |
slash is dropped, to avoid inadvertently creating a @samp{//} construct |
| 987 |
in the path. For example, if the home directory of the user @samp{root} |
| 988 |
is @samp{/}, the path element @samp{~root/mymacros} expands to just |
| 989 |
@samp{/mymacros}, not @samp{//mymacros}. |
| 990 |
|
| 991 |
@flindex tilde.c |
| 992 |
Tilde expansion is implemented in the source file @file{kpathsea/tilde.c}. |
| 993 |
|
| 994 |
|
| 995 |
@node Brace expansion |
| 996 |
@subsection Brace expansion |
| 997 |
|
| 998 |
@kindex @{ @r{expansion} |
| 999 |
@cindex brace expansion |
| 1000 |
|
| 1001 |
@samp{x@{@var{a},@var{b}@}y} expands to @samp{x@var{a}y:x@var{b}y}. |
| 1002 |
For example: |
| 1003 |
|
| 1004 |
@example |
| 1005 |
foo/@{1,2@}/baz |
| 1006 |
@end example |
| 1007 |
|
| 1008 |
@noindent expands to @samp{foo/1/baz:foo/2/baz}. @samp{:} is the path |
| 1009 |
separator on the current system; e.g., on a Windows system, it's @samp{;}. |
| 1010 |
|
| 1011 |
Braces can be nested; for example, @samp{x@{A,B@{1,2@}@}y} expands to |
| 1012 |
@samp{xAy:xB1y:xB2y}. |
| 1013 |
|
| 1014 |
Multiple non-nested braces are expanded from right to left; for example, |
| 1015 |
@samp{x@{A,B@}@{1,2@}y} expands to @samp{x@{A,B@}1y:x@{A,B@}2y}, which |
| 1016 |
expands to @samp{xA1y:xB1y:xA2y:xB2y}. |
| 1017 |
|
| 1018 |
@cindex multiple @TeX{} hierarchies |
| 1019 |
This feature can be used to implement multiple @TeX{} hierarchies, by |
| 1020 |
assigning a brace list to @code{$TEXMF}, as mentioned in |
| 1021 |
@file{texmf.in}. |
| 1022 |
|
| 1023 |
You can also use the path separator instead of the comma. The last |
| 1024 |
example could have been written @samp{x@{A:B@}@{1:2@}y} (on Unix). |
| 1025 |
|
| 1026 |
|
| 1027 |
@flindex expand.c |
| 1028 |
Brace expansion is implemented in the source file |
| 1029 |
@file{kpathsea/expand.c}. |
| 1030 |
|
| 1031 |
|
| 1032 |
@node KPSE_DOT expansion |
| 1033 |
@subsection @code{KPSE_DOT} expansion |
| 1034 |
|
| 1035 |
@kindex KPSE_DOT @r{expansion} |
| 1036 |
|
| 1037 |
When @code{KPSE_DOT} is defined in the environment, it names a directory |
| 1038 |
that should be considered the current directory for the purpose of |
| 1039 |
looking up files in the search paths. This feature is needed by the |
| 1040 |
@samp{mktex@dots{}} scripts @ref{mktex scripts}, because these |
| 1041 |
change the working directory. You should not ever define it yourself. |
| 1042 |
|
| 1043 |
|
| 1044 |
@node Subdirectory expansion |
| 1045 |
@subsection Subdirectory expansion |
| 1046 |
|
| 1047 |
@kindex // |
| 1048 |
@cindex subdirectory searching |
| 1049 |
@cindex expansion, subdirectory |
| 1050 |
|
| 1051 |
@cindex alphabetical order, not |
| 1052 |
Two or more consecutive slashes in a path element following a directory |
| 1053 |
@var{d} is replaced by all subdirectories of @var{d}: first those |
| 1054 |
subdirectories directly under @var{d}, then the subsubdirectories under |
| 1055 |
those, and so on. At each level, the order in which the directories are |
| 1056 |
searched is unspecified. (It's ``directory order'', and definitely not |
| 1057 |
alphabetical.) |
| 1058 |
|
| 1059 |
If you specify any filename components after the @samp{//}, only |
| 1060 |
subdirectories which match those components are included. For example, |
| 1061 |
@samp{/a//b} would expand into directories @file{/a/1/b}, @file{/a/2/b}, |
| 1062 |
@file{/a/1/1/b}, and so on, but not @file{/a/b/c} or @file{/a/1}. |
| 1063 |
|
| 1064 |
You can include multiple @samp{//} constructs in the path. |
| 1065 |
|
| 1066 |
@samp{//} at the beginning of a path is ignored. Searching every |
| 1067 |
directory on the system is not relevant for @TeX{}. |
| 1068 |
|
| 1069 |
@cindex trick for detecting leaf directories |
| 1070 |
@cindex leaf directory trick |
| 1071 |
@cindex Farwell, Matthew |
| 1072 |
@cindex MacKenzie, David |
| 1073 |
We need to discuss one related implementation trick, originally taken |
| 1074 |
from GNU find. Matthew Farwell suggested it, and David MacKenzie |
| 1075 |
implemented it. |
| 1076 |
|
| 1077 |
@vindex st_nlink |
| 1078 |
The trick is that in normal Unix implementations (though not in the |
| 1079 |
POSIX specification), a directory which contains no subdirectories |
| 1080 |
will have exactly two links (namely, one for @file{.} and one for |
| 1081 |
@file{..}). That is to say, the @code{st_nlink} field in the |
| 1082 |
@samp{stat} structure will be two. Thus, we don't have to stat |
| 1083 |
everything in the bottom-level (leaf) directories---we can just check |
| 1084 |
@code{st_nlink}, notice it's two, and do no more work. |
| 1085 |
|
| 1086 |
Kpathsea never does this @code{st_nlink=2} check (or any disk |
| 1087 |
checking) for @code{!!} trees (@pxref{ls-R}). And the non-@code{!!} |
| 1088 |
trees in a @TeX{} Live installation are typically extremely small. |
| 1089 |
Therefore the @code{st_nlink} check is not performed by default at |
| 1090 |
all, as of 2025 (Kpathsea 6.3.4). That way, two not-uncommon |
| 1091 |
situations work out: 1)@tie{}all @code{gvisor}-handled filesystems return |
| 1092 |
@code{st_nlink=1} before some post-2025 release |
| 1093 |
(@url{https://tug.org/pipermail/texhax/2025-July/026772.html}); |
| 1094 |
2)@tie{}a symbolic link to another directory in such an apparent leaf |
| 1095 |
directory will get followed even though @code{st_nlink=2} |
| 1096 |
(@url{https://tex.stackexchange.com/questions/132908}). |
| 1097 |
|
| 1098 |
If you have an extremely large non-@code{!!} tree, most likely |
| 1099 |
@code{TEXMFHOME}, you may find it useful to enable the check: you can |
| 1100 |
do this by setting the configuration variable |
| 1101 |
@code{texmf_nlink_for_leaf} to 1. Alternatively, with such a large |
| 1102 |
tree, you may find it even more useful to add the tree to |
| 1103 |
@code{TEXMFDBS} so that only @code{ls-R} lookups are done (again, |
| 1104 |
@pxref{ls-R}). |
| 1105 |
|
| 1106 |
@flindex elt-dirs.c |
| 1107 |
Unfortunately, in some cases files in leaf directories are |
| 1108 |
@code{stat}'d anyway: if the path specification is, say, |
| 1109 |
@samp{$TEXMF/fonts//pk//}, then files in a subdirectory |
| 1110 |
@samp{@dots{}/pk}, even if it is a leaf, are checked. The reason |
| 1111 |
cannot be explained without reference to the implementation, so read |
| 1112 |
@file{kpathsea/elt-dirs.c} (search for @samp{may descend}) if you are |
| 1113 |
curious. And if you find a way to solve the problem, please let me |
| 1114 |
know. |
| 1115 |
|
| 1116 |
@flindex elt-dirs.c |
| 1117 |
Subdirectory expansion is implemented in the source file |
| 1118 |
@file{kpathsea/elt-dirs.c}. |
| 1119 |
|
| 1120 |
|
| 1121 |
@node Casefolding search |
| 1122 |
@section Casefolding search |
| 1123 |
|
| 1124 |
@cindex casefolding search |
| 1125 |
@cindex search, case-insensitive |
| 1126 |
|
| 1127 |
In Kpathsea version 6.3.0 (released with @TeX{} Live 2018), a new |
| 1128 |
fallback search was implemented on Unix-like systems, including Macs: |
| 1129 |
for each path element in turn, if no match is found by the normal |
| 1130 |
search, and the path element allows for checking the filesystem, a |
| 1131 |
second check is made for a case-insensitive match. |
| 1132 |
|
| 1133 |
@vindex texmf_casefold_search |
| 1134 |
This is enabled at compile-time on Unix systems, and enabled at |
| 1135 |
runtime by setting the configuration variable |
| 1136 |
@code{texmf_casefold_search}, to a true value, e.g., @samp{1}; this is |
| 1137 |
done by default in @TeX{} Live. |
| 1138 |
|
| 1139 |
@menu |
| 1140 |
* Rationale: Casefolding rationale. |
| 1141 |
* Examples: Casefolding examples. |
| 1142 |
@end menu |
| 1143 |
|
| 1144 |
@node Casefolding rationale |
| 1145 |
@subsection Casefolding rationale |
| 1146 |
|
| 1147 |
@cindex casefolding fallback rationale |
| 1148 |
@cindex rationale for casefolding fallback |
| 1149 |
@cindex system-dependent casefolding behavior |
| 1150 |
|
| 1151 |
@cindex filesystem, case-(in)sensitive |
| 1152 |
@cindex Apple filesystem, case-insensitive |
| 1153 |
@cindex Mac filesystem, case-insensitive |
| 1154 |
The purpose of the fallback casefolding search is to ease moving |
| 1155 |
complex documents between case-insensitive (file)systems and |
| 1156 |
case-sensitive ones. In particular, Apple decided to make the default |
| 1157 |
filesystem on Macs be case-insensitive some years ago, and this has |
| 1158 |
exacerbated a problem of people creating documents that use, say, an |
| 1159 |
image under the name @file{foo.jpg}, while the actual file is named |
| 1160 |
@file{foo.JPG} or @file{Foo.jpg}. It works on the Mac but if the |
| 1161 |
document is transferred and run on a standard case-sensitive Unix |
| 1162 |
(file)system, the file can't be found, due only to differences in |
| 1163 |
case. |
| 1164 |
|
| 1165 |
This same problematic scenario has always existed on Windows, but for |
| 1166 |
whatever reason, it has become much more common since Apple also went |
| 1167 |
to a case-insensitive filesystem. Hence the relatively late change |
| 1168 |
to the Kpathsea behavior. |
| 1169 |
|
| 1170 |
@cindex Windows and casefolding |
| 1171 |
The fallback case-insensitive search is omitted at compile-time on |
| 1172 |
Windows, where (for practical purposes) all file names are |
| 1173 |
case-insensitive at the kernel level, and so the normal search will |
| 1174 |
already have definitively matched or not. Therefore, search results |
| 1175 |
in unusual cases can be different on Windows and Unix---but this has |
| 1176 |
always been true. |
| 1177 |
|
| 1178 |
|
| 1179 |
@node Casefolding examples |
| 1180 |
@subsection Casefolding examples |
| 1181 |
|
| 1182 |
@cindex casefolding examples |
| 1183 |
@cindex examples, of casefolding searches |
| 1184 |
|
| 1185 |
The casefolding implementation prefers exact matches to casefolded |
| 1186 |
matches within a given path element, so as to retain most |
| 1187 |
compatibility. Backward compatibility is not perfect, however, as a |
| 1188 |
casefolded match may be found in an earlier path element than an exact |
| 1189 |
match was previously found (see example #4 below). Still, preferring |
| 1190 |
the match in the earlier element seemed potentially less confusing |
| 1191 |
than otherwise, and is in fact consistent with past behavior on |
| 1192 |
Windows. Since case mismatches are rare to begin with, and name |
| 1193 |
collisions with respect only to case thus even more rare, the hope is |
| 1194 |
that it will not cause difficulties in practice. |
| 1195 |
|
| 1196 |
If it's desirable in a given situation to have the exact same search |
| 1197 |
behavior as previously, that can be accomplished by setting the |
| 1198 |
configuration variable @code{texmf_casefold_search} to @samp{0} |
| 1199 |
(@pxref{Path sources}). |
| 1200 |
|
| 1201 |
Some examples to illustrate the new behavior follow. |
| 1202 |
|
| 1203 |
Example #1: suppose the file @file{./foobar.tex} exists. Now, |
| 1204 |
searching for @file{./FooBar.TeX} (or any other case variation) will |
| 1205 |
succeed, returning @file{./foobar.tex}---the name as stored on disk. |
| 1206 |
In previous releases, or if @code{texmf_casefold_search} is false, the |
| 1207 |
search would fail. |
| 1208 |
|
| 1209 |
Example #2: suppose we are using a case-sensitive (file)system, and |
| 1210 |
the search path is @samp{.:/somedir}, and the files |
| 1211 |
@file{./foobar.tex} and @file{/somedir/FooBar.TeX} both exist. Both |
| 1212 |
now and previously, searching for @file{foobar.tex} returns |
| 1213 |
@file{./foobar.tex}. However, searching for @file{FooBar.TeX} now |
| 1214 |
returns @file{./foobar.tex} instead of @file{/somedir/FooBar.TeX}; |
| 1215 |
this is the incompatibility mentioned above. Also (as expected), |
| 1216 |
searching for @file{FOOBAR.TEX} (or whatever variation) will now |
| 1217 |
return @file{./foobar.tex}, whereas before it would fail. Searching |
| 1218 |
for all (@samp{kpsewhich --all}) @file{foobar.tex} will return both |
| 1219 |
matches. |
| 1220 |
|
| 1221 |
Example #3: same as example #2, but on a case-insensitive |
| 1222 |
(file)system: both now and previously, searching for @file{FooBar.TeX} |
| 1223 |
returns @file{./foobar.tex}, since the system considers that a match. |
| 1224 |
The Kpathsea casefolding never comes into play. |
| 1225 |
|
| 1226 |
Example #4: if we have (on a case-sensitive system) both |
| 1227 |
@file{./foobar.tex} and @file{./FOOBAR.TEX}, searching with the exact |
| 1228 |
case returns that exact match, now and previously. Searching for |
| 1229 |
@file{FooBar.tex} will now return one or the other (chosen |
| 1230 |
arbitrarily), rather than failing. Perhaps unexpectedly, searching |
| 1231 |
for all @file{foobar.tex} or @file{FooBar.tex} will also return only |
| 1232 |
one or the other, not both (see more below). |
| 1233 |
|
| 1234 |
Example #5: the font file @file{STIX-Regular.otf} is included in |
| 1235 |
@TeX{} Live in the system directory |
| 1236 |
@file{texmf-dist/fonts/opentype/public/stix}. Because Kpathsea never |
| 1237 |
searches the disk in the big system directory, the casefolding is not |
| 1238 |
done, and a search for @samp{stix-regular.otf} will fail (on |
| 1239 |
case-sensitive systems), as it always has. |
| 1240 |
|
| 1241 |
@kindex !! @r{and casefolding} |
| 1242 |
The caveat about not searching the disk amounts to saying that |
| 1243 |
casefolding does not happen in the trees specified with @samp{!!} |
| 1244 |
(@pxref{ls-R}), that is, where only database (@file{ls-R}) searching |
| 1245 |
is done. In @TeX{} Live, that is the @samp{texmf-local} and |
| 1246 |
@samp{texmf-dist} trees (also @code{$TEXMFSYSCONFIG} and |
| 1247 |
@code{$TEXMFSYSVAR}, but those are rarely noticed). The rationale for |
| 1248 |
this is that in practice, case mangling happens with user-created |
| 1249 |
files, not with packages distributed as part of the @TeX{} system. |
| 1250 |
|
| 1251 |
One more caveat: the purpose of @code{kpsewhich} is to exercise the |
| 1252 |
path searching in Kpathsea as it is actually done. Therefore, as |
| 1253 |
shown above, @samp{kpsewhich --all} will not return all matches |
| 1254 |
regardless of case within a given path element. If you want to find |
| 1255 |
all matches in all directories, @code{find} is the best tool, although |
| 1256 |
the setup takes a couple steps: |
| 1257 |
|
| 1258 |
@example |
| 1259 |
kpsewhich -show-path=tex >/tmp/texpath # search path specification |
| 1260 |
kpsewhich -expand-path="`cat /tmp/texpath`" >/tmp/texdirs # all dirs |
| 1261 |
tr ':' '\n' </tmp/texdirs >/tmp/texdirlist # colons to newlines |
| 1262 |
find `cat /tmp/texdirlist` -iname somefile.tex -print </tmp/texdirlist |
| 1263 |
@end example |
| 1264 |
|
| 1265 |
@cindex Findutils, GNU package |
| 1266 |
@opindex -iname@r{, find predicate} |
| 1267 |
Sorry that it's annoyingly lengthy, but implementing this inside |
| 1268 |
Kpathsea would be a lot of error-prone trouble for something that is |
| 1269 |
only useful for debugging. If your @code{find} does not support |
| 1270 |
@code{-iname}, you can get GNU Find from |
| 1271 |
@url{https://gnu.org/software/findutils}. |
| 1272 |
|
| 1273 |
The casefolding search is implemented in the source file |
| 1274 |
@file{kpathsea/pathsearch.c}. Two implementation points: |
| 1275 |
|
| 1276 |
@itemize |
| 1277 |
@findex access @r{system call} |
| 1278 |
@item |
| 1279 |
Kpathsea never tries to check if a given directory resides on a |
| 1280 |
case-insensitive filesystem, because there is no efficient and |
| 1281 |
portable way to do so. All it does is try to see if a potential file |
| 1282 |
name is a readable normal file (with, usually, the @code{access} |
| 1283 |
system call). |
| 1284 |
|
| 1285 |
@item |
| 1286 |
Kpathsea does not do any case-insensitive matching of the directories |
| 1287 |
along the path. It's not going to find @file{/Some/Random/file.tex} |
| 1288 |
when looking for @file{/some/random/file.tex}. The casefolding only |
| 1289 |
happens with the elements of the leaf directory. |
| 1290 |
|
| 1291 |
@end itemize |
| 1292 |
|
| 1293 |
|
| 1294 |
@node Filename database |
| 1295 |
@section Filename database (@code{ls-R}) |
| 1296 |
|
| 1297 |
@cindex filename database |
| 1298 |
@cindex database, for filenames |
| 1299 |
@cindex externally-built filename database |
| 1300 |
|
| 1301 |
Kpathsea goes to some lengths to minimize disk accesses for searches |
| 1302 |
(@pxref{Subdirectory expansion}). Nevertheless, in practice searching |
| 1303 |
every possible directory in typical @TeX{} installations takes an |
| 1304 |
excessively long time. |
| 1305 |
|
| 1306 |
Therefore, Kpathsea can use an externally-built @dfn{filename |
| 1307 |
database} file named @file{ls-R} that maps files to directories, thus |
| 1308 |
avoiding the need to exhaustively search the disk. |
| 1309 |
|
| 1310 |
A second database file @file{aliases} allows you to give additional |
| 1311 |
names to the files listed in @file{ls-R}. |
| 1312 |
|
| 1313 |
The @file{ls-R} and @file{aliases} features are implemented in the |
| 1314 |
source file @file{kpathsea/db.c}. |
| 1315 |
|
| 1316 |
@menu |
| 1317 |
* ls-R:: The main filename database. |
| 1318 |
* Filename aliases:: Aliases for those names. |
| 1319 |
* Database format:: Syntax details of the database file. |
| 1320 |
@end menu |
| 1321 |
|
| 1322 |
|
| 1323 |
@node ls-R |
| 1324 |
@subsection @file{ls-R} |
| 1325 |
|
| 1326 |
@flindex ls-R @r{database file} |
| 1327 |
|
| 1328 |
As mentioned above, you must name the main filename database |
| 1329 |
@file{ls-R}. You can put one at the root of each @TeX{} installation |
| 1330 |
hierarchy you wish to search (@code{$TEXMF} by default, which expands |
| 1331 |
to a braced list of several hierarchies in @TeX{} Live). |
| 1332 |
|
| 1333 |
@vindex TEXMFDBS |
| 1334 |
@kindex !! @r{in @code{TEXMFDBS}} |
| 1335 |
Kpathsea looks for @file{ls-R} files along the @code{TEXMFDBS} |
| 1336 |
path. It is best for this to contain all and only those hierarchies |
| 1337 |
from @code{$TEXMF} which are specified with @code{!!}---and also to |
| 1338 |
specify them with @code{!!} in @code{TEXMFDBS}. (See the end of this |
| 1339 |
section for more on @code{!!}.) |
| 1340 |
|
| 1341 |
The recommended way to create and maintain @samp{ls-R} is to run the |
| 1342 |
@code{mktexlsr} script, which is installed in @samp{$(bindir)} |
| 1343 |
(@file{/usr/local/bin} by default). That script goes to some trouble to |
| 1344 |
follow symbolic links as necessary, etc. It's also invoked by the |
| 1345 |
distributed @samp{mktex@dots{}} scripts. |
| 1346 |
|
| 1347 |
@flindex ls-R@r{, simplest build} |
| 1348 |
At its simplest, though, you can build @file{ls-R} with the command |
| 1349 |
@example |
| 1350 |
cd @var{/your/texmf/root} && ls -LAR ./ >ls-R |
| 1351 |
@end example |
| 1352 |
|
| 1353 |
@noindent |
| 1354 |
@opindex --color=tty |
| 1355 |
@flindex /etc/profile @r{and aliases} |
| 1356 |
presuming your @code{ls} produces the right output format (see the |
| 1357 |
section below). GNU @code{ls}, for example, outputs in this format. |
| 1358 |
Also presuming your @code{ls} hasn't been aliased in a system file |
| 1359 |
(e.g., @file{/etc/profile}) to something problematic, e.g., @samp{ls |
| 1360 |
--color=tty}. In that case, you will have to disable the alias before |
| 1361 |
generating @file{ls-R}. For the precise definition of the file format, |
| 1362 |
see @ref{Database format}. |
| 1363 |
|
| 1364 |
Regardless of whether you use the supplied script or your own, you |
| 1365 |
will almost certainly want to invoke it via @code{cron}, so when you |
| 1366 |
make changes in the installed files (say if you install a new @LaTeX{} |
| 1367 |
package), @file{ls-R} will be automatically updated. However, for |
| 1368 |
those using @TeX{} Live or system distributions, the package managers |
| 1369 |
should run @code{mktexlsr} as needed. |
| 1370 |
|
| 1371 |
@opindex -A @r{option to @code{ls}} |
| 1372 |
@cindex dot files |
| 1373 |
@flindex . @r{files} |
| 1374 |
@flindex . @r{directories, ignored} |
| 1375 |
@flindex .tex @r{file, included in @file{ls-R}} |
| 1376 |
The @samp{-A} option to @code{ls} includes files beginning with @samp{.} |
| 1377 |
(except for @file{.} and @file{..}), such as the file @file{.tex} |
| 1378 |
included with the @LaTeX{} tools package. (On the other hand, |
| 1379 |
@emph{directories} whose names begin with @samp{.} are always ignored.) |
| 1380 |
|
| 1381 |
@cindex symbolic links, and @file{ls-R} |
| 1382 |
@opindex -L @r{option to @code{ls}} |
| 1383 |
If your system does not support symbolic links, omit the @samp{-L}. |
| 1384 |
|
| 1385 |
@cindex automounter, and @file{ls-R} |
| 1386 |
@cindex NFS and @file{ls-R} |
| 1387 |
@code{ls -LAR @var{/your/texmf/root}} will also work. But using |
| 1388 |
@samp{./} avoids embedding absolute pathnames, so the hierarchy can be |
| 1389 |
easily transported. It also avoids possible trouble with automounters |
| 1390 |
or other network filesystem conventions. |
| 1391 |
|
| 1392 |
@cindex warning about unusable @file{ls-R} |
| 1393 |
@cindex unusable @file{ls-R} warning |
| 1394 |
Kpathsea warns you if it finds an @file{ls-R} file, but the file does |
| 1395 |
not contain any usable entries. The usual culprit is running plain |
| 1396 |
@samp{ls -R} instead of @samp{ls -LR ./} or @samp{ls -R |
| 1397 |
@var{/your/texmf/root}}. Another possibility is some system directory |
| 1398 |
name starting with a @samp{.} (perhaps if you are using AFS); Kpathsea |
| 1399 |
ignores everything under such directories. |
| 1400 |
|
| 1401 |
@kindex !! @r{in path specifications} |
| 1402 |
@cindex disk searching, avoiding |
| 1403 |
If a particular path element begins with @samp{!!}, @emph{only} the |
| 1404 |
database will be searched for that element, never the disk; and if the |
| 1405 |
database does not exist, nothing at all will be searched. In @TeX{} |
| 1406 |
Live, most of the trees are specified with @samp{!!}. |
| 1407 |
|
| 1408 |
For path elements that do not begin with @samp{!!}, if the database |
| 1409 |
exists, it will be used, and the disk will not be searched. However, |
| 1410 |
in this case, if the database does not exist, the disk will be |
| 1411 |
searched. In @TeX{} Live, the most notable case of this is the |
| 1412 |
@code{TEXMFHOME} tree, to allow users to add and remove files from |
| 1413 |
their own tree without having to worry about @code{ls-R}. |
| 1414 |
|
| 1415 |
(Aside: there are uncommon cases where a @samp{!!} tree will be |
| 1416 |
searched on disk even if the @code{ls-R} file exists; they are too |
| 1417 |
obscure to try to explain here. See @file{pathsearch.c} in the source |
| 1418 |
if you need to know.) |
| 1419 |
|
| 1420 |
To sum up: do not create an @code{ls-R} file unless you also take care |
| 1421 |
to keep it up to date. Otherwise newly-installed files will not be |
| 1422 |
found. |
| 1423 |
|
| 1424 |
|
| 1425 |
|
| 1426 |
@node Filename aliases |
| 1427 |
@subsection Filename aliases |
| 1428 |
|
| 1429 |
@cindex filename aliases |
| 1430 |
@cindex aliases, for filenames |
| 1431 |
|
| 1432 |
In some circumstances, you may wish to find a file under several names. |
| 1433 |
For example, suppose a @TeX{} document was created using a DOS system |
| 1434 |
and tries to read @file{longtabl.sty}. But now it's being run on a Unix |
| 1435 |
system, and the file has its original name, @file{longtable.sty}. The |
| 1436 |
file won't be found. You need to give the actual file |
| 1437 |
@file{longtable.sty} an alias @samp{longtabl.sty}. |
| 1438 |
|
| 1439 |
@c As another example, suppose you are creating a @TeX{} distribution on a |
| 1440 |
@c CD-ROM or a DOS system; then the file @file{mf.base} gets stored as |
| 1441 |
@c @file{mf.bas}. But Metafont on Unix wants to find @file{mf.base}. Here |
| 1442 |
@c you need to give the actual file @file{mf.bas} an alias @samp{mf.base}. |
| 1443 |
|
| 1444 |
You can handle this by creating a file @file{aliases} as a companion to |
| 1445 |
the @file{ls-R} for the hierarchy containing the file in question. (You |
| 1446 |
must have an @file{ls-R} for the alias feature to work.) |
| 1447 |
|
| 1448 |
The format of @file{aliases} is simple: two whitespace-separated words |
| 1449 |
per line; the first is the real name @file{longtable.sty}, and second is |
| 1450 |
the alias (@file{longtabl.sty}). These must be base filenames, with no |
| 1451 |
directory components. @file{longtable.sty} must be in the sibling |
| 1452 |
@file{ls-R}. |
| 1453 |
|
| 1454 |
Also, blank lines and lines starting with @samp{%} or @samp{#} are |
| 1455 |
ignored in @file{aliases}, to allow for comments. |
| 1456 |
|
| 1457 |
If a real file @file{longtabl.sty} exists, it is used regardless of any |
| 1458 |
aliases. |
| 1459 |
|
| 1460 |
|
| 1461 |
@node Database format |
| 1462 |
@subsection Database format |
| 1463 |
|
| 1464 |
@cindex format of external database |
| 1465 |
@cindex database, format of |
| 1466 |
|
| 1467 |
The ``database'' read by Kpathsea is a line-oriented file of plain |
| 1468 |
text. The format is that generated by GNU (and most other) @code{ls} |
| 1469 |
programs given the @samp{-R} option, as follows. |
| 1470 |
|
| 1471 |
@itemize @bullet |
| 1472 |
@item |
| 1473 |
Blank lines are ignored. |
| 1474 |
|
| 1475 |
@item |
| 1476 |
If a line begins with @samp{/} or @samp{./} or @samp{../} and ends with |
| 1477 |
a colon, it's the name of a directory. (@samp{../} lines aren't useful, |
| 1478 |
however, and should not be generated.) |
| 1479 |
|
| 1480 |
@item |
| 1481 |
All other lines define entries in the most recently seen directory. |
| 1482 |
@t{/}'s in such lines will produce possibly-strange results. |
| 1483 |
|
| 1484 |
@item |
| 1485 |
Files with no preceding directory line are ignored. |
| 1486 |
@end itemize |
| 1487 |
|
| 1488 |
For example, here's the first few lines of @file{ls-R} (which totals |
| 1489 |
about 30K bytes) on my system: |
| 1490 |
|
| 1491 |
@example |
| 1492 |
bibtex |
| 1493 |
dvips |
| 1494 |
fonts |
| 1495 |
ls-R |
| 1496 |
metafont |
| 1497 |
metapost |
| 1498 |
tex |
| 1499 |
web2c |
| 1500 |
|
| 1501 |
./bibtex: |
| 1502 |
bib |
| 1503 |
bst |
| 1504 |
doc |
| 1505 |
|
| 1506 |
./bibtex/bib: |
| 1507 |
asi.bib |
| 1508 |
btxdoc.bib |
| 1509 |
@dots{} |
| 1510 |
@end example |
| 1511 |
|
| 1512 |
|
| 1513 |
@node Invoking kpsewhich |
| 1514 |
@section @code{kpsewhich}: Standalone path searching |
| 1515 |
|
| 1516 |
@pindex kpsewhich |
| 1517 |
@cindex path searching, standalone |
| 1518 |
@cindex standalone path searching |
| 1519 |
|
| 1520 |
The Kpsewhich program exercises the path searching functionality |
| 1521 |
independent of any particular application. This can also be useful as a |
| 1522 |
sort of @code{find} program to locate files in your @TeX{} hierarchies, |
| 1523 |
perhaps in administrative scripts. It is used heavily in the |
| 1524 |
distributed @samp{mktex@dots{}} scripts. |
| 1525 |
|
| 1526 |
Synopsis: |
| 1527 |
|
| 1528 |
@example |
| 1529 |
kpsewhich @var{option}@dots{} @var{filename}@dots{} |
| 1530 |
@end example |
| 1531 |
|
| 1532 |
The options and filename(s) to look up can be intermixed. |
| 1533 |
Options can start with either @samp{-} or @samp{--}, and any unambiguous |
| 1534 |
abbreviation is accepted. |
| 1535 |
|
| 1536 |
Kpsewhich looks up each non-option argument on the command line as a |
| 1537 |
filename, and outputs (by default) the first file found to standard |
| 1538 |
output. If a file is not found, and more than @var{filename} is given, |
| 1539 |
a blank line is output for that file. See examples below. |
| 1540 |
|
| 1541 |
The exit status is zero if all files were found, nonzero otherwise. |
| 1542 |
|
| 1543 |
@menu |
| 1544 |
* kpsewhich examples:: Simple examples of running kpsewhich. |
| 1545 |
* Path searching options:: Changing the mode, resolution, etc. |
| 1546 |
* Specially-recognized files:: Default formats for texmf.cnf, etc. |
| 1547 |
* Auxiliary tasks:: Path and variable expansion, etc. |
| 1548 |
* Standard options:: @samp{--help} and @samp{--version}. |
| 1549 |
@end menu |
| 1550 |
|
| 1551 |
|
| 1552 |
@node kpsewhich examples |
| 1553 |
@subsection @code{kpsewhich} examples |
| 1554 |
|
| 1555 |
@cindex @code{kpsewhich} examples |
| 1556 |
@cindex examples, of running @code{kpsewhich} |
| 1557 |
|
| 1558 |
Some examples of running @code{kpsewhich} with a typical @TeX{} tree. |
| 1559 |
A basic successful search (exit status 0): |
| 1560 |
|
| 1561 |
@example |
| 1562 |
$ kpsewhich plain.tex |
| 1563 |
/usr/local/texlive/2024/texmf-dist/tex/plain/base/plain.tex |
| 1564 |
@end example |
| 1565 |
|
| 1566 |
Searching for multiple files, one of which is not found (exit status |
| 1567 |
is 1 for this): |
| 1568 |
|
| 1569 |
@example |
| 1570 |
$ kpsewhich plain.tex foobar plain.mf |
| 1571 |
/usr/local/texlive/2024/texmf-dist/tex/plain/base/plain.tex |
| 1572 |
|
| 1573 |
/usr/local/texlive/2024/texmf-dist/metafont/base/plain.mf |
| 1574 |
@end example |
| 1575 |
|
| 1576 |
Using @code{--all} to see all files by the same name (exit status 0): |
| 1577 |
|
| 1578 |
@example |
| 1579 |
$ kpsewhich --all language.dat |
| 1580 |
/usr/local/texlive/2024/texmf-dist/tex/generic/config/language.dat |
| 1581 |
/usr/local/texlive/2024/texmf-dist/lambda/generic/config/language.dat |
| 1582 |
@end example |
| 1583 |
|
| 1584 |
@node Path searching options |
| 1585 |
@subsection Path searching options |
| 1586 |
|
| 1587 |
@cindex path searching options |
| 1588 |
|
| 1589 |
Various options alter the path searching behavior. Options apply to |
| 1590 |
all lookups. |
| 1591 |
|
| 1592 |
@table @samp |
| 1593 |
@item --all |
| 1594 |
@opindex --all |
| 1595 |
@cindex all matches, finding |
| 1596 |
Report all matches found, one per line. By default, if there is more |
| 1597 |
than one match, just one will be reported (chosen effectively at |
| 1598 |
random). Exception: with the glyph formats (@code{pk}, @code{gf}), |
| 1599 |
this option has no effect and only the first match is returned. |
| 1600 |
|
| 1601 |
With both @code{-all} and multiple input files, there's no easy way to |
| 1602 |
discern which matches belong to which files; you have to check the |
| 1603 |
basename of the output. This could be improved, if there is any demand. |
| 1604 |
|
| 1605 |
@item --casefold-search |
| 1606 |
@itemx --no-casefold-search |
| 1607 |
@opindex --casefold-search |
| 1608 |
@opindex --no-casefold-search |
| 1609 |
Explicitly enable or disable the fallback to a case-insensitive search |
| 1610 |
on Unix platforms (@pxref{Casefolding search}); no effect on Windows. |
| 1611 |
The default is enabled, set in @code{texmf.cnf}. Disabling |
| 1612 |
(@code{--no-casefold-search}) does not mean that searches magically |
| 1613 |
become case-sensitive when the underlying (file)system is |
| 1614 |
case-insensitive, it merely means that Kpathsea does not do any |
| 1615 |
casefolding itself. |
| 1616 |
|
| 1617 |
@item --cnf-line=@var{str} |
| 1618 |
@opindex --cnf-line |
| 1619 |
Parse @var{str} as if it were a line in the @file{texmf.cnf} |
| 1620 |
configuration file (@pxref{Config files}), overriding settings in the |
| 1621 |
actual configuration files, and also in the environment (@pxref{Path |
| 1622 |
sources}). This is implemented by making any settings from @var{str} |
| 1623 |
in the environment, overwriting any value already there. Thus, an |
| 1624 |
extra colon in a @samp{--cnf-line} value will refer to the value from |
| 1625 |
a configuration file, not a user-set environment variable. |
| 1626 |
|
| 1627 |
Furthermore, any variable set from @var{str} will also be set with the |
| 1628 |
program name suffix. For example, @code{pdftex |
| 1629 |
--cnf-line=TEXINPUTS=/foo:} will set both @code{TEXINPUTS} and |
| 1630 |
@code{TEXINPUTS_pdftex} in the environment (and the value will be |
| 1631 |
@file{/foo} followed by the setting from @file{texmf.cnf}, ignoring |
| 1632 |
any user-set @code{TEXINPUTS}). |
| 1633 |
|
| 1634 |
This behavior is desirable because, in practice, many variables in the |
| 1635 |
distributed @file{texmf.cnf} are program-specific, and the intuitive |
| 1636 |
behavior is for values set on the command line with @code{--cnf-line} |
| 1637 |
to override them. |
| 1638 |
|
| 1639 |
@item --dpi=@var{num} |
| 1640 |
@opindex --dpi=@var{num} |
| 1641 |
@opindex -D @var{num} |
| 1642 |
@cindex resolution, setting |
| 1643 |
Set the resolution to @var{num}; this only affects @samp{gf} and |
| 1644 |
@samp{pk} lookups. @samp{-D} is a synonym, for compatibility with |
| 1645 |
Dvips. Default is 600. |
| 1646 |
|
| 1647 |
@item --engine=@var{name} |
| 1648 |
@opindex --engine=@var{name} |
| 1649 |
@cindex engine name |
| 1650 |
Set the engine name to @var{name}. By default it is not set in |
| 1651 |
@code{kpsewhich} (@TeX{} engines set it to the appropriate string). |
| 1652 |
The engine name is used in some search paths to allow files with the |
| 1653 |
same name but used by different engines to coexist. |
| 1654 |
|
| 1655 |
In particular, since the memory dump files |
| 1656 |
(@file{.fmt}/@file{.base}/@file{.mem}) are now stored in |
| 1657 |
subdirectories named for the engine (@file{tex}, @file{pdftex}, |
| 1658 |
@file{xetex}, etc.), you must specify an engine name in order to find |
| 1659 |
them. For example, @file{cont-en.fmt} typically exists for both |
| 1660 |
@file{pdftex} and @file{xetex}. With the default path settings, you |
| 1661 |
can use @samp{--engine=/} to look for any dump file, regardless of |
| 1662 |
engine; if a dump file exists for more than one engine, it's |
| 1663 |
indeterminate which one is returned. (The @samp{/} ends up specifying |
| 1664 |
a normal recursive search along the path where the dumps are stored, |
| 1665 |
namely @samp{$TEXMF/web2c@{/$engine,@}}.) |
| 1666 |
|
| 1667 |
@item --format=@var{name} |
| 1668 |
@opindex --format=@var{name} |
| 1669 |
Set the format for lookup to @var{name}. By default, the format is |
| 1670 |
guessed from the filename, with @samp{tex} being used if nothing else |
| 1671 |
fits. The recognized filename extensions (including any leading |
| 1672 |
@samp{.}) are also allowable @var{name}s. |
| 1673 |
|
| 1674 |
All formats also have a name, which is the only way to specify formats |
| 1675 |
with no associated suffix. For example, for Dvips configuration files |
| 1676 |
you can use @samp{--format="dvips config"}. (The quotes are for the |
| 1677 |
sake of the shell.) |
| 1678 |
|
| 1679 |
Here's the current list of recognized names and the associated suffixes. |
| 1680 |
@xref{Supported file formats}, for more information on each of these. |
| 1681 |
|
| 1682 |
The strings in parentheses are abbreviations recognized only by |
| 1683 |
@code{kpsewhich} (not the underlying library calls). They are |
| 1684 |
provided when it would otherwise require an argument containing a |
| 1685 |
space to specify the format, to simplify quoting of calls from shells. |
| 1686 |
|
| 1687 |
@example |
| 1688 |
gf: gf |
| 1689 |
pk: pk |
| 1690 |
bitmap font (bitmapfont): |
| 1691 |
tfm: .tfm |
| 1692 |
afm: .afm |
| 1693 |
base: .base |
| 1694 |
bib: .bib |
| 1695 |
bst: .bst |
| 1696 |
cnf: .cnf |
| 1697 |
ls-R: ls-R ls-r |
| 1698 |
fmt: .fmt |
| 1699 |
map: .map |
| 1700 |
mem: .mem |
| 1701 |
mf: .mf |
| 1702 |
mfpool: .pool |
| 1703 |
mft: .mft |
| 1704 |
mp: .mp |
| 1705 |
mppool: .pool |
| 1706 |
MetaPost support (mpsupport): |
| 1707 |
ocp: .ocp |
| 1708 |
ofm: .ofm .tfm |
| 1709 |
opl: .opl .pl |
| 1710 |
otp: .otp |
| 1711 |
ovf: .ovf .vf |
| 1712 |
ovp: .ovp .vpl |
| 1713 |
graphic/figure: .eps .epsi |
| 1714 |
tex: .tex .sty .cls .fd .aux .bbl .def .clo .ldf |
| 1715 |
TeX system documentation (doc): |
| 1716 |
texpool: .pool |
| 1717 |
TeX system source (source, src): .dtx .ins |
| 1718 |
PostScript header (psheader): .pro |
| 1719 |
Troff fonts (trofffont): |
| 1720 |
type1 fonts: .pfa .pfb |
| 1721 |
vf: .vf |
| 1722 |
dvips config (dvipsconfig): |
| 1723 |
ist: .ist |
| 1724 |
truetype fonts (truetype, ttf): .ttf .ttc .TTF .TTC .dfont |
| 1725 |
type42 fonts (type42): .t42 .T42 |
| 1726 |
web2c files (web2c): |
| 1727 |
other text files (othertext): |
| 1728 |
other binary files (otherbin): |
| 1729 |
misc fonts (miscfont): |
| 1730 |
web: .web .ch |
| 1731 |
cweb: .w .web .ch |
| 1732 |
enc files (enc): .enc |
| 1733 |
cmap files (cmap): |
| 1734 |
subfont definition files (sfd): .sfd |
| 1735 |
opentype fonts (opentype, otf): .otf .OTF |
| 1736 |
pdftex config (pdftexconfig): |
| 1737 |
lig files (lig): .lig |
| 1738 |
texmfscripts: |
| 1739 |
lua: .lua .luatex .luc .luctex .texlua .texluc .tlu |
| 1740 |
font feature files (fea): .fea |
| 1741 |
cid maps (cidmap): .cid .cidmap |
| 1742 |
mlbib: .mlbib .bib |
| 1743 |
mlbst: .mlbst .bst |
| 1744 |
clua: .dll .so |
| 1745 |
ris: .ris |
| 1746 |
bltxml: .bltxml |
| 1747 |
@end example |
| 1748 |
|
| 1749 |
This option and @samp{--path} are mutually exclusive. |
| 1750 |
|
| 1751 |
@item --interactive |
| 1752 |
@opindex --interactive |
| 1753 |
@cindex interactive query |
| 1754 |
After processing the command line, read additional filenames to look up |
| 1755 |
from standard input. |
| 1756 |
|
| 1757 |
@item --mktex=@var{filetype} |
| 1758 |
@itemx --no-mktex=@var{filetype} |
| 1759 |
@opindex --mktex=@var{filetype} |
| 1760 |
@opindex --no-mktex=@var{filetype} |
| 1761 |
Turn on or off the @samp{mktex} script associated with @var{filetype}. |
| 1762 |
Usual values for @var{filetype} are @samp{pk}, @samp{mf}, @samp{tex}, |
| 1763 |
and @samp{tfm}. By default, all are off in Kpsewhich, even if they |
| 1764 |
are enabled for @TeX{}. This option implies setting |
| 1765 |
@code{--must-exist}. @xref{mktex scripts}. |
| 1766 |
|
| 1767 |
@item --mode=@var{string} |
| 1768 |
@opindex --mode=@var{string} |
| 1769 |
Set the mode name to @var{string}; this also only affects @samp{gf} and |
| 1770 |
@samp{pk} lookups. No default: any mode will be found. @xref{mktex |
| 1771 |
script arguments}. |
| 1772 |
|
| 1773 |
@item --must-exist |
| 1774 |
@opindex --must-exist |
| 1775 |
Do everything possible to find the files, notably including searching |
| 1776 |
the disk and running the @samp{mktex} scripts. By default, only the |
| 1777 |
@file{ls-R} database is checked, in the interest of efficiency. |
| 1778 |
|
| 1779 |
@item --path=@var{string} |
| 1780 |
@opindex --path=@var{string} |
| 1781 |
Search along the path @var{string} (colon-separated as usual), instead |
| 1782 |
of guessing the search path from the filename. @samp{//} and all the |
| 1783 |
usual expansions are supported (@pxref{Path expansion}). This option |
| 1784 |
and @samp{--format} are mutually exclusive. To output the complete |
| 1785 |
directory expansion of a path, instead of doing a one-shot lookup, see |
| 1786 |
@samp{--expand-path} and @samp{--show-path} in the following section. |
| 1787 |
|
| 1788 |
@item --progname=@var{name} |
| 1789 |
@opindex --progname=@var{name} |
| 1790 |
Set the program name to @var{name}; default is @samp{kpsewhich}. This |
| 1791 |
can affect the search paths via the @samp{.@var{prognam}} feature in |
| 1792 |
configuration files (@pxref{Config files}). |
| 1793 |
|
| 1794 |
@item --subdir=@var{string} |
| 1795 |
@opindex --subdir=@var{string} |
| 1796 |
Report only those matches whose directory part @emph{ends} with |
| 1797 |
@var{string} (compared literally, except case is ignored on a |
| 1798 |
case-insensitive operating system). For example, suppose there are |
| 1799 |
two matches for a given name: |
| 1800 |
|
| 1801 |
@example |
| 1802 |
kpsewhich foo.sty |
| 1803 |
@result{} /some/where/foo.sty |
| 1804 |
/another/place/foo.sty |
| 1805 |
@end example |
| 1806 |
|
| 1807 |
@noindent |
| 1808 |
Then we can narrow the result to what we are interested in with |
| 1809 |
@option{--subdir}: |
| 1810 |
|
| 1811 |
@example |
| 1812 |
kpsewhich --subdir=where foo.sty |
| 1813 |
@result{} /some/where/foo.sty |
| 1814 |
|
| 1815 |
kpsewhich --subdir=place foo.sty |
| 1816 |
@result{} /another/place/foo.sty |
| 1817 |
@end example |
| 1818 |
|
| 1819 |
@noindent |
| 1820 |
The string to match must be at the end of the directory part of the |
| 1821 |
match, and it is taken literally, with no pattern matching: |
| 1822 |
|
| 1823 |
@example |
| 1824 |
kpsewhich --subdir=another foo.sty |
| 1825 |
@result{} |
| 1826 |
@end example |
| 1827 |
|
| 1828 |
@noindent |
| 1829 |
The string to match may cross directory components: |
| 1830 |
|
| 1831 |
@example |
| 1832 |
kpsewhich --subdir=some/where foo.sty |
| 1833 |
@result{} /some/where/foo.sty |
| 1834 |
@end example |
| 1835 |
|
| 1836 |
@noindent |
| 1837 |
@option{--subdir} implies @option{--all}; if there is more than one |
| 1838 |
match, they will all be reported (in our example, both @samp{where} |
| 1839 |
and @samp{place} end in @samp{e}): |
| 1840 |
|
| 1841 |
@example |
| 1842 |
kpsewhich --subdir=e |
| 1843 |
@result{} /some/where/foo.sty |
| 1844 |
/another/place/foo.sty |
| 1845 |
@end example |
| 1846 |
|
| 1847 |
@noindent |
| 1848 |
Because of the above rules, the presence of a leading @samp{/} is |
| 1849 |
important, since it ``anchors'' the match to a full component name: |
| 1850 |
|
| 1851 |
@example |
| 1852 |
kpsewhich --subdir=/lace foo.sty |
| 1853 |
@result{} |
| 1854 |
@end example |
| 1855 |
|
| 1856 |
@noindent |
| 1857 |
However, a trailing @samp{/} is immaterial (and ignored), since the |
| 1858 |
match always takes place at the end of the directory part: |
| 1859 |
|
| 1860 |
@example |
| 1861 |
kpsewhich --subdir=lace/ foo.sty |
| 1862 |
@result{} /another/place/foo.sty |
| 1863 |
@end example |
| 1864 |
|
| 1865 |
@noindent |
| 1866 |
The purpose of these rules is to make it convenient to find results |
| 1867 |
only within a particular area of the tree. For instance, a given |
| 1868 |
script named @file{foo.lua} might exist within both |
| 1869 |
@file{texmf-dist/scripts/pkg1/} and @file{texmf-dist/scripts/pkg2/}. |
| 1870 |
By specifying, say, @samp{--subdir=/pkg1}, you can be sure of getting |
| 1871 |
the one you are interested in. |
| 1872 |
|
| 1873 |
We only match at the end because a site might happen to install @TeX{} |
| 1874 |
in @file{/some/coincidental/pkg1/path/}, and we wouldn't want to match |
| 1875 |
@file{texmf-dist/scripts/pkg2/} that when searching for @samp{/pkg1}. |
| 1876 |
|
| 1877 |
@end table |
| 1878 |
|
| 1879 |
|
| 1880 |
@node Specially-recognized files |
| 1881 |
@subsection Specially-recognized files for @command{kpsewhich} |
| 1882 |
|
| 1883 |
@command{kpsewhich} recognizes a few special filenames on the command |
| 1884 |
line and defaults to using the `known' file formats for them, merely |
| 1885 |
to save the time and trouble of specifying the format. This is only a |
| 1886 |
feature of @command{kpsewhich}; when using the Kpathsea library |
| 1887 |
itself, none of these special filenames are recognized, and it's still |
| 1888 |
up to the caller to specify the desired format. |
| 1889 |
|
| 1890 |
Here is the list of special filenames to @command{kpsewhich}, along |
| 1891 |
with their corresponding format: |
| 1892 |
|
| 1893 |
@table @file |
| 1894 |
|
| 1895 |
@flindex config.ps |
| 1896 |
@item config.ps |
| 1897 |
@code{dvips config} |
| 1898 |
|
| 1899 |
@flindex dvipdfmx.cfg |
| 1900 |
@item dvipdfmx.cfg |
| 1901 |
@samp{other text files} |
| 1902 |
|
| 1903 |
@flindex fmtutil.cnf |
| 1904 |
@item fmtutil.cnf |
| 1905 |
@samp{web2c files} |
| 1906 |
|
| 1907 |
@flindex glyphlist.txt |
| 1908 |
@item glyphlist.txt |
| 1909 |
@samp{map} |
| 1910 |
|
| 1911 |
@flindex mktex.cnf |
| 1912 |
@item mktex.cnf |
| 1913 |
@samp{web2c files} |
| 1914 |
|
| 1915 |
@flindex pdfglyphlist.txt |
| 1916 |
@item pdfglyphlist.txt |
| 1917 |
@samp{map} |
| 1918 |
|
| 1919 |
@flindex pdftex.cfg |
| 1920 |
@flindex pdftexconfig.tex |
| 1921 |
@item pdftex.cfg |
| 1922 |
@samp{pdftex config} (although @file{pdftex.cfg} is not used any more; |
| 1923 |
look for the file @file{pdftexconfig.tex} instead.) |
| 1924 |
|
| 1925 |
@flindex texmf.cnf |
| 1926 |
@item texmf.cnf |
| 1927 |
@samp{cnf} |
| 1928 |
|
| 1929 |
@flindex XDvi |
| 1930 |
@item XDvi |
| 1931 |
@samp{other text files} |
| 1932 |
|
| 1933 |
@end table |
| 1934 |
|
| 1935 |
A user-specified format will override the above defaults. |
| 1936 |
|
| 1937 |
@flindex tcfmgr.map |
| 1938 |
Another reference for information about @TeX{}'s many special files is |
| 1939 |
@file{tcfmgr.map}, found in @file{texmf/texconfig/tcfmgr.map}, which |
| 1940 |
records various information about the above configuration files (among |
| 1941 |
others). |
| 1942 |
|
| 1943 |
|
| 1944 |
@node Auxiliary tasks |
| 1945 |
@subsection Auxiliary tasks |
| 1946 |
|
| 1947 |
@cindex auxiliary tasks |
| 1948 |
|
| 1949 |
Kpsewhich provides some features in addition to path lookup as such: |
| 1950 |
|
| 1951 |
@table @samp |
| 1952 |
@item --debug=@var{num} |
| 1953 |
@opindex --debug=@var{num} |
| 1954 |
Set debugging options to @var{num}. @xref{Debugging}. |
| 1955 |
|
| 1956 |
@item --expand-braces=@var{string} |
| 1957 |
@opindex --expand-braces=@var{string} |
| 1958 |
Output variable, tilde, and brace expansion of @var{string}, which is |
| 1959 |
assumed to be a single path element. @xref{Path expansion}. |
| 1960 |
|
| 1961 |
@item --expand-path=@var{string} |
| 1962 |
@opindex --expand-path=@var{string} |
| 1963 |
Output the complete expansion of @var{string}, with each element |
| 1964 |
separated by the usual path separator on the current system (@samp{;} |
| 1965 |
on Windows, @samp{:} otherwise). This may be useful to construct a |
| 1966 |
custom search path for a format not otherwise supported. To retrieve |
| 1967 |
the search path for a format that is already supported, see |
| 1968 |
@samp{--show-path}. |
| 1969 |
|
| 1970 |
Nonexistent directories are culled from the output: |
| 1971 |
|
| 1972 |
@example |
| 1973 |
$ kpsewhich --expand-path '/tmp' |
| 1974 |
@result{} /tmp |
| 1975 |
$ kpsewhich --expand-path '/nonesuch' |
| 1976 |
@result{} |
| 1977 |
@end example |
| 1978 |
|
| 1979 |
For one-shot uses of an arbitrary (not built in to Kpathsea) path, see |
| 1980 |
@samp{--path} (@pxref{Path searching options}). |
| 1981 |
|
| 1982 |
@item --expand-var=@var{string} |
| 1983 |
@opindex --expand-var=@var{string} |
| 1984 |
Output the variable and tilde expansion of @var{string}. For example, |
| 1985 |
with the usual @file{texmf.cnf}, @samp{kpsewhich |
| 1986 |
--expand-var='$TEXMF'} returns the @TeX{} system hierarchy root(s). |
| 1987 |
@xref{Path expansion}. The specified @var{string} can contain |
| 1988 |
anything, though, not just variable references. This calls |
| 1989 |
@code{kpse_var_expand} (@pxref{Programming with config files}). |
| 1990 |
|
| 1991 |
@item --help-formats |
| 1992 |
@opindex --help-formats |
| 1993 |
Output information about each supported format (@pxref{Supported file |
| 1994 |
formats}), including the names and abbreviations, variables |
| 1995 |
looked for, and the original path. |
| 1996 |
|
| 1997 |
@item --safe-extended-in-name=@var{name} |
| 1998 |
@itemx --safe-extended-out-name=@var{name} |
| 1999 |
@opindex --safe-extended-in-name=@var{name} |
| 2000 |
@opindex --safe-extended-out-name=@var{name} |
| 2001 |
As with @samp{--safe-in-name} and @samp{--safe-out-name} (next item), |
| 2002 |
but also allow files under the variables @code{TEXMFVAR} and |
| 2003 |
@code{TEXMFSYSVAR} (@pxref{Calling sequence}). |
| 2004 |
|
| 2005 |
@item --safe-in-name=@var{name} |
| 2006 |
@itemx --safe-out-name=@var{name} |
| 2007 |
@opindex --safe-in-name=@var{name} |
| 2008 |
@opindex --safe-out-name=@var{name} |
| 2009 |
Exit successfully if @var{name} is safe to open for reading or |
| 2010 |
writing, respectively, else unsuccessfully. No errors are output. |
| 2011 |
These tests take account of the related Kpathsea configuration |
| 2012 |
settings (@pxref{Calling sequence}). |
| 2013 |
|
| 2014 |
@item --show-path=@var{name} |
| 2015 |
@opindex --show-path=@var{name} |
| 2016 |
Show the path that would be used for file lookups of file type |
| 2017 |
@var{name}. Either a filename extension (@samp{pk}, @samp{.vf}, etc.) |
| 2018 |
or an integer can be used, just as with @samp{--format}, described in |
| 2019 |
the previous section. |
| 2020 |
|
| 2021 |
@item --var-brace-value=@var{variable} |
| 2022 |
@opindex --var-brace-value=@var{variable} |
| 2023 |
Like @samp{--var-value} (next), but also expands @samp{@{...@}} |
| 2024 |
constructs. (@pxref{Brace expansion}). Thus, the value is assumed to |
| 2025 |
possibly be several path elements, and @samp{~} is expanded at the |
| 2026 |
beginning of each. The path separator is changed to that of the |
| 2027 |
current system in the expansion. |
| 2028 |
|
| 2029 |
Example: @samp{FOO='.;~' kpsewhich --var-brace-value=FOO} outputs (on |
| 2030 |
a Unix-ish system) @samp{.:/home/karl}, supposing the latter is the |
| 2031 |
current user's home directory. Note that the @samp{;} in the source |
| 2032 |
value, as commonly used in @file{texmf.cnf}, has changed to a |
| 2033 |
@samp{:}, as the normal path separator on the current system. On a |
| 2034 |
Windows-ish system, the @samp{;} would remain. |
| 2035 |
|
| 2036 |
@item --var-value=@var{variable} |
| 2037 |
@opindex --var-value=@var{variable} |
| 2038 |
Outputs the value of @var{variable} (a simple identifier like |
| 2039 |
@samp{TEXMFDIST}, with no @samp{$} or other constructs), expanding |
| 2040 |
@samp{$} (@pxref{Variable expansion}) and @samp{~} (@pxref{Tilde |
| 2041 |
expansion}) constructs in the value. @samp{~} expansion happens at the |
| 2042 |
beginning of the overall value and at the beginning of a variable |
| 2043 |
expansion, but not arbitrarily within the string. Braces are not expanded. |
| 2044 |
|
| 2045 |
Example: @samp{--var-value=texmf_casefold_search} outputs (if the |
| 2046 |
default is not changed) @samp{1}. |
| 2047 |
|
| 2048 |
Example to contrast with @samp{--var-brace-value}: @samp{FOO='.;~' |
| 2049 |
kpsewhich --var-value=FOO} outputs @samp{.;~}, i.e., the same as the |
| 2050 |
input value, on all systems. |
| 2051 |
|
| 2052 |
@end table |
| 2053 |
|
| 2054 |
|
| 2055 |
@node Standard options |
| 2056 |
@subsection Standard options |
| 2057 |
|
| 2058 |
@cindex standard options |
| 2059 |
|
| 2060 |
Kpsewhich accepts the standard GNU options: |
| 2061 |
|
| 2062 |
@itemize @bullet |
| 2063 |
@item |
| 2064 |
@opindex --help |
| 2065 |
@samp{--help} prints a help message on standard output and exits |
| 2066 |
successfully. |
| 2067 |
|
| 2068 |
@item |
| 2069 |
@opindex --version |
| 2070 |
@samp{--version} prints the Kpathsea version number and exits successfully. |
| 2071 |
@end itemize |
| 2072 |
|
| 2073 |
|
| 2074 |
@node TeX support |
| 2075 |
@chapter @TeX{} support |
| 2076 |
|
| 2077 |
@cindex @TeX{} support |
| 2078 |
|
| 2079 |
Although the basic features in Kpathsea can be used for any type of |
| 2080 |
path searching, it came about, as usual, with a specific application |
| 2081 |
in mind: I wrote Kpathsea specifically for @TeX{} system programs. I |
| 2082 |
had been struggling with the programs I was using (Dvips, Xdvi, and |
| 2083 |
@TeX{} itself) having slightly different notions of how to specify |
| 2084 |
paths; and debugging was painful, since no code was shared. |
| 2085 |
|
| 2086 |
Therefore, Kpathsea provides some @TeX{}-specific formats and |
| 2087 |
features. Indeed, many of the purportedly generic path searching |
| 2088 |
features were provided because they seemed useful in that con@TeX{}t |
| 2089 |
(font lookup, particularly). |
| 2090 |
|
| 2091 |
Kpathsea provides a standard way to search for files of any of the |
| 2092 |
supported file types; glyph fonts are a bit different than all the |
| 2093 |
rest. Searches are based solely on names of files, not their |
| 2094 |
contents---if a GF file is (mis)named @file{cmr10.600pk}, it will be |
| 2095 |
found as a PK file. |
| 2096 |
|
| 2097 |
@menu |
| 2098 |
* Supported file formats:: File types Kpathsea knows about. |
| 2099 |
* File lookup:: Searching for most kinds of files. |
| 2100 |
* Glyph lookup:: Searching for bitmap fonts. |
| 2101 |
* Suppressing warnings:: Avoiding warnings via TEX_HUSH. |
| 2102 |
* mktex scripts:: Generating files at runtime. |
| 2103 |
@end menu |
| 2104 |
|
| 2105 |
|
| 2106 |
@node Supported file formats |
| 2107 |
@section Supported file formats |
| 2108 |
|
| 2109 |
@cindex supported file formats |
| 2110 |
@cindex file formats, supported |
| 2111 |
|
| 2112 |
@cindex environment variables for @TeX{} |
| 2113 |
@cindex @TeX{} environment variables |
| 2114 |
|
| 2115 |
Kpathsea has support for a number of file types. Each file type has a |
| 2116 |
list of environment and config file variables that are checked to define |
| 2117 |
the search path, and most have a default suffix that plays a role in |
| 2118 |
finding files (see the next section). Some also define additional |
| 2119 |
suffixes, and/or a program to be run to create missing files on the fly. |
| 2120 |
|
| 2121 |
@cindex program-varying paths |
| 2122 |
Since environment variables containing periods, such as |
| 2123 |
@samp{TEXINPUTS.latex}, are not allowed on some systems, Kpathsea looks |
| 2124 |
for environment variables with an underscore, e.g., |
| 2125 |
@samp{TEXINPUTS_latex} (@pxref{Config files}). |
| 2126 |
|
| 2127 |
The following table lists the above information. You can also get the |
| 2128 |
list by giving the @samp{--help-formats} option to @code{kpsewhich} |
| 2129 |
(@pxref{Auxiliary tasks}). |
| 2130 |
|
| 2131 |
@table @samp |
| 2132 |
@item afm |
| 2133 |
@flindex .afm |
| 2134 |
@vindex AFMFONTS |
| 2135 |
(Adobe font metrics, @pxref{Metric files,,, dvips, Dvips}) |
| 2136 |
@code{AFMFONTS}; |
| 2137 |
suffix @samp{.afm}. |
| 2138 |
|
| 2139 |
@item base |
| 2140 |
@flindex .base |
| 2141 |
@vindex MFBASES |
| 2142 |
@vindex TEXMFINI |
| 2143 |
(Metafont memory dump, @pxref{Memory dumps,,, web2c, Web2c}) |
| 2144 |
@code{MFBASES}, @code{TEXMFINI}; |
| 2145 |
suffix @samp{.base}. |
| 2146 |
|
| 2147 |
@item bib |
| 2148 |
@flindex .bib |
| 2149 |
@vindex BIBINPUTS |
| 2150 |
@vindex TEXBIB |
| 2151 |
(Bib@TeX{} bibliography source, @pxref{bibtex invocation,,, web2c, Web2c}) |
| 2152 |
@code{BIBINPUTS}, @code{TEXBIB}; |
| 2153 |
suffix @samp{.bib}. |
| 2154 |
|
| 2155 |
@item bltxml |
| 2156 |
@flindex .bltxml |
| 2157 |
@vindex BLTXMLINPUTS |
| 2158 |
(Bib@LaTeX{}ML bibliography files for Biber, @url{https://ctan.org/pkg/biber}) |
| 2159 |
@code{BLTXMLINPUTS} |
| 2160 |
suffix @samp{.bltxml}. |
| 2161 |
|
| 2162 |
@item bst |
| 2163 |
@flindex .bst |
| 2164 |
@vindex BSTINPUTS |
| 2165 |
(Bib@TeX{} style, @pxref{Basic BibTeX style files,, Basic Bib@TeX{} |
| 2166 |
style files, web2c, Web2c}) |
| 2167 |
@code{BSTINPUTS}; |
| 2168 |
suffix @samp{.bst}. |
| 2169 |
|
| 2170 |
@item clua |
| 2171 |
@flindex .dll |
| 2172 |
@flindex .so |
| 2173 |
@vindex CLUAINPUTS |
| 2174 |
(dynamic libraries for Lua, @url{https://ctan.org/pkg/luatex}) |
| 2175 |
@code{CLUAINPUTS} |
| 2176 |
suffixes @samp{.dll} and @samp{.so}. |
| 2177 |
|
| 2178 |
@item cmap |
| 2179 |
@flindex .cmap |
| 2180 |
@vindex CMAPFONTS |
| 2181 |
(character map files) |
| 2182 |
@code{CMAPFONTS}; |
| 2183 |
suffix @samp{.cmap}. |
| 2184 |
|
| 2185 |
@item cnf |
| 2186 |
@flindex .cnf |
| 2187 |
@vindex TEXMFCNF |
| 2188 |
(Runtime configuration files, @pxref{Config files}) |
| 2189 |
@code{TEXMFCNF}; |
| 2190 |
suffix @samp{.cnf}. |
| 2191 |
|
| 2192 |
@item cweb |
| 2193 |
@flindex .w |
| 2194 |
@flindex .web |
| 2195 |
@vindex CWEBINPUTS |
| 2196 |
(CWEB input files) |
| 2197 |
@code{CWEBINPUTS}; |
| 2198 |
suffixes @samp{.w}, @samp{.web}; |
| 2199 |
additional suffix @samp{.ch}. |
| 2200 |
|
| 2201 |
@item dvips config |
| 2202 |
@vindex TEXCONFIG |
| 2203 |
@flindex config.ps@r{, search path for} |
| 2204 |
(Dvips @samp{config.*} files, such as @file{config.ps}, @pxref{Config |
| 2205 |
files,,, dvips, Dvips}) |
| 2206 |
@code{TEXCONFIG}. |
| 2207 |
|
| 2208 |
@item enc files |
| 2209 |
@flindex .enc |
| 2210 |
@vindex ENCFONTS |
| 2211 |
(encoding vectors) |
| 2212 |
@code{ENCFONTS}; |
| 2213 |
suffix @samp{.enc}. |
| 2214 |
|
| 2215 |
@item fmt |
| 2216 |
@flindex .fmt |
| 2217 |
@vindex TEXFORMATS |
| 2218 |
@vindex TEXMFINI |
| 2219 |
(@TeX{} memory dump, @pxref{Memory dumps,,, web2c, Web2c}) |
| 2220 |
@code{TEXFORMATS}, @code{TEXMFINI}; |
| 2221 |
suffix @samp{.fmt}. |
| 2222 |
|
| 2223 |
@item font cid map |
| 2224 |
@flindex .cid |
| 2225 |
@vindex FONTCIDMAPS |
| 2226 |
(CJK mapping) |
| 2227 |
@code{FONTCIDMAPS} |
| 2228 |
suffix @samp{.cid}. |
| 2229 |
|
| 2230 |
@item font feature files |
| 2231 |
@flindex .fea |
| 2232 |
@vindex FONTFEATURES |
| 2233 |
(primarily for OpenType font features) |
| 2234 |
@code{FONTFEATURES} |
| 2235 |
suffix @samp{.fea}. |
| 2236 |
|
| 2237 |
@item gf |
| 2238 |
@flindex gf |
| 2239 |
@vindex GFFONTS |
| 2240 |
@vindex GLYPHFONTS |
| 2241 |
@vindex TEXFONTS |
| 2242 |
(generic font bitmap, @pxref{Glyph files,,, dvips, Dvips}) |
| 2243 |
@code{@var{program}FONTS}, @code{GFFONTS}, @code{GLYPHFONTS}, @code{TEXFONTS}; |
| 2244 |
suffix @samp{gf}. |
| 2245 |
|
| 2246 |
@item graphic/figure |
| 2247 |
@flindex .eps |
| 2248 |
@flindex .epsi |
| 2249 |
@vindex TEXPICTS |
| 2250 |
@vindex TEXINPUTS |
| 2251 |
(Encapsulated PostScript figures, @pxref{PostScript figures,,, dvips, Dvips}) |
| 2252 |
@code{TEXPICTS}, @code{TEXINPUTS}; |
| 2253 |
additional suffixes: @samp{.eps}, @samp{.epsi}. |
| 2254 |
|
| 2255 |
@item ist |
| 2256 |
@flindex .ist |
| 2257 |
@vindex TEXINDEXSTYLE |
| 2258 |
@vindex INDEXSTYLE |
| 2259 |
(makeindex style files) |
| 2260 |
@code{TEXINDEXSTYLE}, @code{INDEXSTYLE}; |
| 2261 |
suffix @samp{.ist}. |
| 2262 |
|
| 2263 |
@item lig files |
| 2264 |
@flindex .lig |
| 2265 |
@vindex LIGFONTS |
| 2266 |
(ligature definition files) |
| 2267 |
@code{LIGFONTS}; |
| 2268 |
suffix @samp{.lig}. |
| 2269 |
|
| 2270 |
@item ls-R |
| 2271 |
@flindex ls-R |
| 2272 |
@vindex TEXMFDBS |
| 2273 |
(Filename databases, @pxref{Filename database}) |
| 2274 |
@code{TEXMFDBS}. |
| 2275 |
|
| 2276 |
@item lua |
| 2277 |
@flindex .lua |
| 2278 |
@flindex .luatex |
| 2279 |
@flindex .luc |
| 2280 |
@flindex .luctex |
| 2281 |
@flindex .texlua |
| 2282 |
@flindex .texluc |
| 2283 |
@flindex .tlu |
| 2284 |
@vindex LUAINPUTS |
| 2285 |
(Lua scripts, @url{https://ctan.org/pkg/luatex}) |
| 2286 |
@code{LUAINPUTS} |
| 2287 |
suffixes @samp{.lua}, @samp{.luatex}, @samp{.luc}, @samp{.luctex}, |
| 2288 |
@samp{.texlua}, @samp{.texluc}, @samp{.tlu}. |
| 2289 |
|
| 2290 |
@item map |
| 2291 |
@flindex .map |
| 2292 |
@vindex TEXFONTMAPS |
| 2293 |
(Fontmaps, @pxref{Fontmap}) |
| 2294 |
@code{TEXFONTMAPS}; |
| 2295 |
suffix @samp{.map}. |
| 2296 |
|
| 2297 |
@item mem |
| 2298 |
@flindex .mem |
| 2299 |
@vindex MPMEMS |
| 2300 |
@vindex TEXMFINI |
| 2301 |
(MetaPost memory dump, @pxref{Memory dumps,,, web2c, Web2c}) |
| 2302 |
@code{MPMEMS}, @code{TEXMFINI}; |
| 2303 |
suffix @samp{.mem}. |
| 2304 |
|
| 2305 |
@item @r{MetaPost support} |
| 2306 |
@vindex MPSUPPORT |
| 2307 |
(MetaPost support files, used by DMP; @pxref{dmp invocation,,, web2c, Web2c}) |
| 2308 |
@code{MPSUPPORT}. |
| 2309 |
|
| 2310 |
@item mf |
| 2311 |
@flindex .mf |
| 2312 |
@vindex MFINPUTS |
| 2313 |
(Metafont source, @pxref{mf invocation,,, web2c, Web2c}) |
| 2314 |
@code{MFINPUTS}; |
| 2315 |
suffix @samp{.mf}; |
| 2316 |
dynamic creation program: @code{mktexmf}. |
| 2317 |
|
| 2318 |
@item mfpool |
| 2319 |
@flindex .pool |
| 2320 |
@vindex MFPOOL |
| 2321 |
(Metafont program strings, @pxref{pooltype invocation,,, web2c, Web2c}) |
| 2322 |
@code{MFPOOL}, @code{TEXMFINI}; |
| 2323 |
suffix @samp{.pool}. |
| 2324 |
|
| 2325 |
@item mft |
| 2326 |
@flindex .mft |
| 2327 |
@vindex MFTINPUTS |
| 2328 |
(@code{MFT} style file, @pxref{mft invocation,,, web2c, Web2c}) |
| 2329 |
@code{MFTINPUTS}; |
| 2330 |
suffix @samp{.mft}. |
| 2331 |
|
| 2332 |
@item misc fonts |
| 2333 |
@vindex MISCFONTS |
| 2334 |
(font-related files that don't fit the other categories) |
| 2335 |
@code{MISCFONTS} |
| 2336 |
|
| 2337 |
@item mlbib |
| 2338 |
@flindex .mlbib |
| 2339 |
@vindex MLBIBINPUTS |
| 2340 |
@vindex BIBINPUTS |
| 2341 |
@vindex TEXBIB |
| 2342 |
(MlBib@TeX{} bibliography source) |
| 2343 |
@code{MLBIBINPUTS}, @code{BIBINPUTS}, @code{TEXBIB}; |
| 2344 |
suffixes @samp{.mlbib}, @samp{.mlbib}. |
| 2345 |
|
| 2346 |
@item mlbst |
| 2347 |
@flindex .mlbst |
| 2348 |
@vindex MLBSTINPUTS |
| 2349 |
@vindex BSTINPUTS |
| 2350 |
(MlBib@TeX{} style) |
| 2351 |
@code{MLBSTINPUTS}, @code{BSTINPUTS}; |
| 2352 |
suffixes @samp{.mlbst}, @samp{.bst}. |
| 2353 |
|
| 2354 |
@item mp |
| 2355 |
@flindex .mp |
| 2356 |
@vindex MPINPUTS |
| 2357 |
(MetaPost source, @pxref{mpost invocation,,, web2c, Web2c}) |
| 2358 |
@code{MPINPUTS}; |
| 2359 |
suffix @samp{.mp}. |
| 2360 |
|
| 2361 |
@item mppool |
| 2362 |
@flindex .pool |
| 2363 |
@vindex MPPOOL |
| 2364 |
(MetaPost program strings, @pxref{pooltype invocation,,, web2c, Web2c}) |
| 2365 |
@code{MPPOOL}, @code{TEXMFINI}; |
| 2366 |
suffix @samp{.pool}. |
| 2367 |
|
| 2368 |
@item ocp |
| 2369 |
@flindex .ocp |
| 2370 |
@vindex OCPINPUTS |
| 2371 |
(Omega compiled process files) |
| 2372 |
@code{OCPINPUTS}; @* |
| 2373 |
suffix @samp{.ocp}; |
| 2374 |
dynamic creation program: @code{MakeOmegaOCP}. |
| 2375 |
|
| 2376 |
@item ofm |
| 2377 |
@flindex .ofm |
| 2378 |
@vindex OFMFONTS |
| 2379 |
(Omega font metrics) |
| 2380 |
@code{OFMFONTS}, @code{TEXFONTS}; @* |
| 2381 |
suffixes @samp{.ofm}, @samp{.tfm}; |
| 2382 |
dynamic creation program: @code{MakeOmegaOFM}. |
| 2383 |
|
| 2384 |
@item opentype fonts |
| 2385 |
@vindex OPENTYPEFONTS |
| 2386 |
(OpenType fonts) |
| 2387 |
@code{OPENTYPEFONTS}. |
| 2388 |
|
| 2389 |
@item opl |
| 2390 |
@flindex .opl |
| 2391 |
(Omega property lists) |
| 2392 |
@code{OPLFONTS}, @code{TEXFONTS}; |
| 2393 |
suffix @samp{.opl}. |
| 2394 |
|
| 2395 |
@item otp |
| 2396 |
@flindex .otp |
| 2397 |
@vindex OTPINPUTS |
| 2398 |
(Omega translation process files) |
| 2399 |
@code{OTPINPUTS}; |
| 2400 |
suffix @samp{.otp}. |
| 2401 |
|
| 2402 |
@item ovf |
| 2403 |
@flindex .ovf |
| 2404 |
@vindex OVFFONTS |
| 2405 |
(Omega virtual fonts) |
| 2406 |
@code{OVFFONTS}, @code{TEXFONTS}; |
| 2407 |
suffix @samp{.ovf}. |
| 2408 |
|
| 2409 |
@item ovp |
| 2410 |
@flindex .ovp |
| 2411 |
@vindex OVPFONTS |
| 2412 |
(Omega virtual property lists) |
| 2413 |
@code{OVPFONTS}, @code{TEXFONTS}; |
| 2414 |
suffix @samp{.ovp}. |
| 2415 |
|
| 2416 |
@item pdftex config |
| 2417 |
@vindex PDFTEXCONFIG |
| 2418 |
(PDF@TeX{}-specific configuration files) |
| 2419 |
@code{PDFTEXCONFIG}. |
| 2420 |
|
| 2421 |
@item pk |
| 2422 |
@flindex .pk |
| 2423 |
@vindex PKFONTS |
| 2424 |
@vindex TEXPKS |
| 2425 |
@vindex GLYPHFONTS |
| 2426 |
@vindex TEXFONTS |
| 2427 |
(packed bitmap fonts, @pxref{Glyph files,,, dvips, Dvips}) |
| 2428 |
@code{@var{PROGRAM}FONTS} (@var{program} being @samp{XDVI}, etc.), |
| 2429 |
@code{PKFONTS}, @code{TEXPKS}, @code{GLYPHFONTS}, @code{TEXFONTS}; |
| 2430 |
suffix @samp{pk}; |
| 2431 |
dynamic creation program: @code{mktexpk}. |
| 2432 |
|
| 2433 |
@item PostScript header |
| 2434 |
@flindex .pro |
| 2435 |
@vindex TEXPSHEADERS |
| 2436 |
@vindex PSHEADERS |
| 2437 |
(downloadable PostScript, @pxref{Header files,,, dvips, Dvips}) |
| 2438 |
@code{TEXPSHEADERS}, @code{PSHEADERS}; |
| 2439 |
additional suffix @samp{.pro}. |
| 2440 |
|
| 2441 |
@item ris |
| 2442 |
@flindex .ris |
| 2443 |
@vindex RISINPUTS |
| 2444 |
(RIS bibliography files, primarily for Biber, @url{https://ctan.org/pkg/biber}) |
| 2445 |
@code{RISINPUTS} |
| 2446 |
suffix @samp{.ris}. |
| 2447 |
|
| 2448 |
@item subfont definition files |
| 2449 |
@flindex .sfd |
| 2450 |
@vindex SFDFONTS |
| 2451 |
(subfont definition files) |
| 2452 |
@code{SFDFONTS} |
| 2453 |
suffix @samp{.sfd}. |
| 2454 |
|
| 2455 |
@item tex |
| 2456 |
@flindex .tex |
| 2457 |
@vindex TEXINPUTS |
| 2458 |
(@TeX{} source, @pxref{tex invocation,,, web2c, Web2c}) |
| 2459 |
@code{TEXINPUTS}; |
| 2460 |
suffix @samp{.tex}; |
| 2461 |
additional suffixes: none, because such a list cannot be complete; |
| 2462 |
dynamic creation program: @code{mktextex}. |
| 2463 |
|
| 2464 |
@item TeX system documentation |
| 2465 |
@flindex doc files |
| 2466 |
@vindex TEXDOCS |
| 2467 |
(Documentation files for the @TeX{} system) |
| 2468 |
@code{TEXDOCS}. |
| 2469 |
|
| 2470 |
@item TeX system sources |
| 2471 |
@flindex source files |
| 2472 |
@vindex TEXSOURCES |
| 2473 |
(Source files for the @TeX{} system) |
| 2474 |
@code{TEXSOURCES}. |
| 2475 |
|
| 2476 |
@item texmfscripts |
| 2477 |
@vindex TEXMFSCRIPTS |
| 2478 |
(Architecture-independent executables distributed in the texmf trees) |
| 2479 |
@code{TEXMFSCRIPTS}. |
| 2480 |
|
| 2481 |
@item texpool |
| 2482 |
@flindex .pool |
| 2483 |
@vindex TEXPOOL |
| 2484 |
(@TeX{} program strings, @pxref{pooltype invocation,,, web2c, Web2c}) |
| 2485 |
@code{TEXPOOL}, @code{TEXMFINI}; |
| 2486 |
suffix @samp{.pool}. |
| 2487 |
|
| 2488 |
@item tfm |
| 2489 |
@flindex .tfm |
| 2490 |
@vindex TFMFONTS |
| 2491 |
@vindex TEXFONTS |
| 2492 |
(@TeX{} font metrics, @pxref{Metric files,,, dvips, Dvips}) |
| 2493 |
@code{TFMFONTS}, @code{TEXFONTS}; |
| 2494 |
suffix @samp{.tfm}; |
| 2495 |
dynamic creation program: @code{mktextfm}. |
| 2496 |
|
| 2497 |
@item Troff fonts |
| 2498 |
@vindex TRFONTS |
| 2499 |
(Troff fonts, used by DMP; @pxref{DMP invocation,,, web2c, Web2c}) |
| 2500 |
@code{TRFONTS}. |
| 2501 |
|
| 2502 |
@item truetype fonts |
| 2503 |
@flindex .ttf |
| 2504 |
@flindex .ttc |
| 2505 |
@vindex TTFONTS |
| 2506 |
(TrueType outline fonts) @code{TTFONTS}; suffixes @samp{.ttf} and |
| 2507 |
@samp{.TTF}, @samp{.ttc} and @samp{.TTC}, @samp{.dfont}. |
| 2508 |
|
| 2509 |
@item type1 fonts |
| 2510 |
@flindex .pfa |
| 2511 |
@flindex .pfb |
| 2512 |
@vindex T1FONTS |
| 2513 |
@vindex T1INPUTS |
| 2514 |
@vindex TEXPSHEADERS |
| 2515 |
@vindex DVIPSHEADERS |
| 2516 |
(Type 1 PostScript outline fonts, @pxref{Glyph files,,, dvips, Dvips}) |
| 2517 |
@code{T1FONTS}, @code{T1INPUTS}, @code{TEXPSHEADERS}, @code{DVIPSHEADERS}; |
| 2518 |
suffixes @samp{.pfa}, @samp{.pfb}. |
| 2519 |
|
| 2520 |
@item type42 fonts |
| 2521 |
@vindex T42FONTS |
| 2522 |
(Type 42 PostScript outline fonts) @code{T42FONTS}. |
| 2523 |
|
| 2524 |
@item vf |
| 2525 |
@flindex .vf |
| 2526 |
@vindex VFFONTS |
| 2527 |
@vindex TEXFONTS |
| 2528 |
(virtual fonts, @pxref{Virtual fonts,,, dvips, Dvips}) |
| 2529 |
@code{VFFONTS}, @code{TEXFONTS}; |
| 2530 |
suffix @samp{.vf}. |
| 2531 |
|
| 2532 |
@item web |
| 2533 |
@flindex .web |
| 2534 |
@vindex WEBINPUTS |
| 2535 |
(WEB input files) |
| 2536 |
@code{WEBINPUTS}; |
| 2537 |
suffix @samp{.web}; |
| 2538 |
additional suffix @samp{.ch}. |
| 2539 |
|
| 2540 |
@item web2c files |
| 2541 |
@vindex WEB2C |
| 2542 |
(files specific to the web2c implementation) |
| 2543 |
@code{WEB2C}. |
| 2544 |
@end table |
| 2545 |
|
| 2546 |
There are two special cases, because the paths and environment variables |
| 2547 |
always depend on the name of the program: the variable name is |
| 2548 |
constructed by converting the program name to upper case, and then |
| 2549 |
appending @samp{INPUTS}. Assuming the program is called @samp{foo}, |
| 2550 |
this gives us the following table. |
| 2551 |
|
| 2552 |
@table @samp |
| 2553 |
@item other text files |
| 2554 |
@vindex FOOINPUTS |
| 2555 |
(text files used by @samp{foo}) |
| 2556 |
@code{FOOINPUTS}. |
| 2557 |
|
| 2558 |
@item other binary files |
| 2559 |
@vindex FOOINPUTS |
| 2560 |
(binary files used by @samp{foo}) |
| 2561 |
@code{FOOINPUTS}. |
| 2562 |
@end table |
| 2563 |
|
| 2564 |
If an environment variable by these names are set, the corresponding |
| 2565 |
@file{texmf.cnf} definition won't be looked at (unless, as usual, the |
| 2566 |
environment variable value has an extra @samp{:}). @xref{Default |
| 2567 |
expansion}. |
| 2568 |
|
| 2569 |
For the font variables, the intent is that: |
| 2570 |
@itemize @bullet |
| 2571 |
@item |
| 2572 |
@code{TEXFONTS} is the default for everything. |
| 2573 |
|
| 2574 |
@item |
| 2575 |
@code{GLYPHFONTS} is the default for bitmap (or, more precisely, |
| 2576 |
non-metric) files. |
| 2577 |
|
| 2578 |
@item |
| 2579 |
Each font format has a variable of its own. |
| 2580 |
|
| 2581 |
@item |
| 2582 |
@vindex XDVIFONTS |
| 2583 |
@vindex DVIPSFONTS |
| 2584 |
Each program has its own font override path as well; e.g., |
| 2585 |
@code{DVIPSFONTS} for Dvipsk. Again, this is for bitmaps, not metrics. |
| 2586 |
|
| 2587 |
@end itemize |
| 2588 |
|
| 2589 |
|
| 2590 |
@node File lookup |
| 2591 |
@section File lookup |
| 2592 |
|
| 2593 |
@cindex file lookup |
| 2594 |
@cindex searching for files |
| 2595 |
@cindex @TeX{} file lookup |
| 2596 |
|
| 2597 |
This section describes how Kpathsea searches for most files (bitmap font |
| 2598 |
searches are the exception, as described in the next section). |
| 2599 |
|
| 2600 |
Here is the search strategy for a file @var{name}: |
| 2601 |
|
| 2602 |
@enumerate |
| 2603 |
@item |
| 2604 |
If the file format defines default suffixes, and the suffix of |
| 2605 |
@var{name} name is not already a known suffix for that format, try the |
| 2606 |
name with each default appended, and use alternative names found in |
| 2607 |
the fontmaps if necessary. Example: given @samp{foo.bar}, look for |
| 2608 |
@samp{foo.bar.tex}. |
| 2609 |
|
| 2610 |
@item |
| 2611 |
Search for @var{name}, and if necessary for alternative names found in |
| 2612 |
the fontmaps. Example: given @samp{foo.bar}, we also look for |
| 2613 |
@samp{foo.bar}. |
| 2614 |
|
| 2615 |
@item |
| 2616 |
If the file format defines a program to invoke to create missing files, |
| 2617 |
run it (@pxref{mktex scripts}). |
| 2618 |
@end enumerate |
| 2619 |
|
| 2620 |
@cindex extensions, filename |
| 2621 |
@cindex suffixes, filename |
| 2622 |
@vindex try_std_extension_first |
| 2623 |
The order in which we search for ``suffixed'' name (item@tie{}1) or |
| 2624 |
the ``as-is'' name (item@tie{}2) is controlled by the |
| 2625 |
@file{try_std_extension_first} configuration value. The default set |
| 2626 |
in @file{texmf.cnf} is true, since common suffixes are already |
| 2627 |
recognized: @samp{babel.sty} will only look for @samp{babel.sty}, not |
| 2628 |
@samp{babel.sty.tex}, regardless of this setting. |
| 2629 |
|
| 2630 |
When the suffix is unknown (e.g., @samp{foo.bar}), both names are |
| 2631 |
always tried; the difference is the order in which they are tried. |
| 2632 |
|
| 2633 |
@file{try_std_extension_first} only affects names being looked up |
| 2634 |
which *already* have an extension. A name without an extension (e.g., |
| 2635 |
@samp{tex story}) will always have an extension added first. |
| 2636 |
|
| 2637 |
@flindex tex-file.c |
| 2638 |
@findex kpathsea_find_file |
| 2639 |
This algorithm is implemented in the function |
| 2640 |
@code{kpathsea_find_file} in the source file |
| 2641 |
@file{kpathsea/tex-file.c}. You can watch it in action with the |
| 2642 |
debugging options (@pxref{Debugging}). |
| 2643 |
|
| 2644 |
|
| 2645 |
@node Glyph lookup |
| 2646 |
@section Glyph lookup |
| 2647 |
|
| 2648 |
@cindex glyph lookup |
| 2649 |
@cindex searching for glyphs |
| 2650 |
@cindex @TeX{} glyph lookup |
| 2651 |
|
| 2652 |
This section describes how Kpathsea searches for a bitmap font in GF or |
| 2653 |
PK format (or either) given a font name (e.g., @samp{cmr10}) and a |
| 2654 |
resolution (e.g., 600). |
| 2655 |
|
| 2656 |
Here is an outline of the search strategy (details in the sections |
| 2657 |
below) for a file @var{name} at resolution @var{dpi}. The search stops |
| 2658 |
at the first successful lookup. |
| 2659 |
|
| 2660 |
@enumerate |
| 2661 |
@item |
| 2662 |
Look for an existing file @var{name}.@var{dpi}@var{format} in the |
| 2663 |
specified format(s). |
| 2664 |
|
| 2665 |
@item If @var{name} is an alias for a file @var{f} in the fontmap |
| 2666 |
file @file{texfonts.map}, look for @var{f}.@var{dpi}. |
| 2667 |
|
| 2668 |
@item Run an external program (typically named @samp{mktexpk}) to |
| 2669 |
generate the font (@pxref{mktex scripts}) |
| 2670 |
|
| 2671 |
@item Look for @var{fallback}.@var{dpi}, where @var{fallback} is some |
| 2672 |
last-resort font (typically @samp{cmr10}). |
| 2673 |
@end enumerate |
| 2674 |
|
| 2675 |
@flindex tex-glyph.c |
| 2676 |
@findex kpathsea_find_glyph |
| 2677 |
This is implemented in @code{kpathsea_find_glyph} in |
| 2678 |
@file{kpathsea/tex-glyph.c}. |
| 2679 |
|
| 2680 |
@menu |
| 2681 |
* Basic glyph lookup:: Features common to all glyph lookups. |
| 2682 |
* Fontmap:: Aliases for fonts. |
| 2683 |
* Fallback font:: Resolutions and fonts of last resort. |
| 2684 |
@end menu |
| 2685 |
|
| 2686 |
|
| 2687 |
@node Basic glyph lookup |
| 2688 |
@subsection Basic glyph lookup |
| 2689 |
|
| 2690 |
@cindex basic glyph lookup |
| 2691 |
@cindex common features in glyph lookup |
| 2692 |
|
| 2693 |
When Kpathsea looks for a bitmap font @var{name} at resolution @var{dpi} |
| 2694 |
in a format @var{format}, it first checks each directory in the search |
| 2695 |
path for a file @samp{@var{name}.@var{dpi}@var{format}}; for example, |
| 2696 |
@samp{cmr10.600pk}. Kpathsea looks for a PK file first, then a GF file. |
| 2697 |
|
| 2698 |
If that fails, Kpathsea looks for |
| 2699 |
@samp{dpi@var{dpi}/@var{name}.@var{format}}; for example, |
| 2700 |
@samp{dpi600/cmr10.pk}. This is how fonts are typically stored on |
| 2701 |
filesystems (such as DOS) that permit only three-character extensions. |
| 2702 |
|
| 2703 |
@cindex tolerance for glyph lookup |
| 2704 |
@cindex glyph lookup bitmap tolerance |
| 2705 |
@findex KPSE_BITMAP_TOLERANCE |
| 2706 |
If that fails, Kpathsea looks for a font with a close-enough @var{dpi}. |
| 2707 |
``Close enough'' is defined by the macro @code{KPSE_BITMAP_TOLERANCE} in |
| 2708 |
@file{kpathsea/tex-glyph.h} to be @code{@var{dpi} / 500 + 1}. This is |
| 2709 |
slightly more than the 0.2% minimum allowed by the DVI standard |
| 2710 |
(@url{@var{CTAN:}/dviware/driv-standard/level-0}). |
| 2711 |
|
| 2712 |
|
| 2713 |
@node Fontmap |
| 2714 |
@subsection Fontmap |
| 2715 |
|
| 2716 |
@cindex fontmap files |
| 2717 |
@cindex font alias files |
| 2718 |
@cindex aliases for fonts |
| 2719 |
|
| 2720 |
@flindex texfonts.map |
| 2721 |
If a bitmap font or metric file is not found with the original name (see |
| 2722 |
the previous section), Kpathsea looks through any @dfn{fontmap} files |
| 2723 |
for an @dfn{alias} for the original font name. These files are named |
| 2724 |
@file{texfonts.map} and searched for along the @code{TEXFONTMAPS} |
| 2725 |
environment/config file variable. All @file{texfonts.map} files that |
| 2726 |
are found are read; earlier definitions override later ones. |
| 2727 |
|
| 2728 |
This feature is intended to help in two respects: |
| 2729 |
|
| 2730 |
@enumerate |
| 2731 |
|
| 2732 |
@item |
| 2733 |
@cindex fontnames, arbitrary length |
| 2734 |
An alias name is limited in length only by available memory, not by your |
| 2735 |
filesystem. Therefore, if you want to ask for @samp{Times-Roman} |
| 2736 |
instead of @file{ptmr}, you can (you get @samp{ptmr8r}). |
| 2737 |
|
| 2738 |
@item |
| 2739 |
@cindex circle fonts |
| 2740 |
@flindex lcircle10 |
| 2741 |
A few fonts have historically had multiple names: specifically, |
| 2742 |
La@TeX{}'s ``circle font'' has variously been known as @file{circle10}, |
| 2743 |
@file{lcircle10}, and @file{lcirc10}. Aliases can make all the names |
| 2744 |
equivalent, so that it no longer matters what the name of the installed |
| 2745 |
file is; @TeX{} documents will find their favorite name. |
| 2746 |
|
| 2747 |
@end enumerate |
| 2748 |
|
| 2749 |
The format of fontmap files: |
| 2750 |
|
| 2751 |
@itemize @bullet |
| 2752 |
@cindex comments, in fontmap files |
| 2753 |
@item Comments start with the last @samp{%} on a line and continue to |
| 2754 |
the end of the line. (This provides for names that include a %, |
| 2755 |
ill-advised as that may be.) |
| 2756 |
|
| 2757 |
@cindex whitespace, in fontmap files |
| 2758 |
@item Blank lines are ignored. |
| 2759 |
|
| 2760 |
@item Each nonblank line is broken up into a series of @dfn{words}: |
| 2761 |
a sequence of non-whitespace characters. |
| 2762 |
|
| 2763 |
@findex include @r{fontmap directive} |
| 2764 |
@item If the first word is @samp{include}, the second word is used as |
| 2765 |
a filename, and it is searched for and read. |
| 2766 |
|
| 2767 |
@item Otherwise, the first word on each line is the true filename; |
| 2768 |
|
| 2769 |
@item the second word is the alias; |
| 2770 |
|
| 2771 |
@item subsequent words are ignored. |
| 2772 |
@end itemize |
| 2773 |
|
| 2774 |
If an alias has an extension, it matches only those files with that |
| 2775 |
extension; otherwise, it matches anything with the same root, regardless |
| 2776 |
of extension. For example, an alias @samp{foo.tfm} matches only when |
| 2777 |
@file{foo.tfm} is being searched for; but an alias @samp{foo} matches |
| 2778 |
@file{foo.vf}, @file{foo.600pk}, etc. |
| 2779 |
|
| 2780 |
As an example, here is an excerpt from the @file{texfonts.map} in the |
| 2781 |
Web2c distribution. It makes the old and new names of the @LaTeX{} |
| 2782 |
circle fonts equivalent. |
| 2783 |
|
| 2784 |
@example |
| 2785 |
circle10 lcircle10 |
| 2786 |
circle10 lcirc10 |
| 2787 |
lcircle10 circle10 |
| 2788 |
lcircle10 lcirc10 |
| 2789 |
lcirc10 circle10 |
| 2790 |
lcirc10 lcircle10 |
| 2791 |
@dots{} |
| 2792 |
@end example |
| 2793 |
|
| 2794 |
Fontmaps are implemented in the file @file{kpathsea/fontmap.c}. |
| 2795 |
The Fontname distribution has much more information on font naming |
| 2796 |
(@pxref{,,,fontname, Filenames for @TeX{} fonts}). |
| 2797 |
|
| 2798 |
|
| 2799 |
@node Fallback font |
| 2800 |
@subsection Fallback font |
| 2801 |
|
| 2802 |
@cindex fallback font |
| 2803 |
@cindex fallback resolutions |
| 2804 |
@cindex font of last resort |
| 2805 |
@cindex resolutions, last-resort |
| 2806 |
@cindex last-resort font |
| 2807 |
|
| 2808 |
@vindex DVIPSSIZES |
| 2809 |
@vindex XDVISIZES |
| 2810 |
@vindex DVILJSIZES |
| 2811 |
@vindex TEXSIZES |
| 2812 |
@vindex default_texsizes |
| 2813 |
If a bitmap font cannot be found or created at the requested size, |
| 2814 |
Kpathsea looks for the font at a set of @dfn{fallback resolutions}. You |
| 2815 |
specify these resolutions as a colon-separated list (like search paths). |
| 2816 |
Kpathsea looks first for a program-specific environment variable (e.g., |
| 2817 |
@code{DVIPSSIZES} for Dvipsk), then the environment variable |
| 2818 |
@code{TEXSIZES}, then a default specified at compilation time (the Make |
| 2819 |
variable @code{default_texsizes}). You can set this list to be empty if |
| 2820 |
you prefer to find fonts at their stated size or not at all. |
| 2821 |
|
| 2822 |
@flindex cmr10@r{, as fallback font} |
| 2823 |
@findex kpathsea_init_prog |
| 2824 |
Finally, if the font cannot be found even at the fallback resolutions, |
| 2825 |
Kpathsea looks for a fallback font, typically @file{cmr10}. Programs |
| 2826 |
must enable this feature by calling @code{kpathsea_init_prog} |
| 2827 |
(@pxref{Calling sequence}); the default is no fallback font. |
| 2828 |
|
| 2829 |
|
| 2830 |
@node Suppressing warnings |
| 2831 |
@section Suppressing warnings |
| 2832 |
|
| 2833 |
@cindex warnings, suppressing |
| 2834 |
@cindex suppressing warnings |
| 2835 |
|
| 2836 |
@vindex TEX_HUSH |
| 2837 |
Kpathsea provides a way to suppress selected usually-harmless warnings; |
| 2838 |
this is useful at large sites where most users are not administrators, |
| 2839 |
and thus the warnings are merely a source of confusion, not a help. To |
| 2840 |
do this, you set the environment variable or configuration file value |
| 2841 |
@code{TEX_HUSH} to a colon-separated list of values. Here are the |
| 2842 |
possibilities: |
| 2843 |
|
| 2844 |
@vtable @samp |
| 2845 |
@item all |
| 2846 |
Suppress everything possible. |
| 2847 |
|
| 2848 |
@item checksum |
| 2849 |
@cindex mismatched checksum warnings |
| 2850 |
Suppress mismatched font checksum warnings. |
| 2851 |
|
| 2852 |
@item lostchar |
| 2853 |
@cindex missing character warnings |
| 2854 |
Suppress warnings when a character is missing from a font that a DVI or |
| 2855 |
VF file tries to typeset. |
| 2856 |
|
| 2857 |
@item none |
| 2858 |
Don't suppress any warnings. |
| 2859 |
|
| 2860 |
@item readable |
| 2861 |
@cindex unreadable file warnings |
| 2862 |
Suppress warnings about attempts to access a file whose permissions |
| 2863 |
render it unreadable. |
| 2864 |
|
| 2865 |
@item special |
| 2866 |
@cindex unknown special warnings |
| 2867 |
@findex \special@r{, suppressing warnings about} |
| 2868 |
Suppresses warnings about an unimplemented or unparsable |
| 2869 |
@samp{\special} command. |
| 2870 |
@end vtable |
| 2871 |
|
| 2872 |
@noindent @file{tex-hush.c} defines the function that checks the |
| 2873 |
variable value. Each driver implements its own checks where |
| 2874 |
appropriate. |
| 2875 |
|
| 2876 |
|
| 2877 |
@node mktex scripts |
| 2878 |
@section @file{mktex} scripts |
| 2879 |
|
| 2880 |
@cindex @file{mktex} scripts |
| 2881 |
@cindex scripts for file creation |
| 2882 |
|
| 2883 |
@cindex font set, infinite |
| 2884 |
@cindex dynamic creation of files |
| 2885 |
@cindex Sauter fonts, and dynamic source creation |
| 2886 |
@cindex EC fonts, and dynamic source creation |
| 2887 |
If Kpathsea cannot otherwise find a file, for some file types it is |
| 2888 |
configured by default to invoke an external program to create it |
| 2889 |
dynamically (@pxref{mktex configuration}). These are collectively |
| 2890 |
known as @dfn{@code{mktex} scripts}, since most of them are named |
| 2891 |
@code{mktex...}. |
| 2892 |
|
| 2893 |
For example, this is useful for fonts (bitmaps, TFM's, and |
| 2894 |
arbitrarily-sizable Metafont sources such as the Sauter and EC fonts), |
| 2895 |
since any given document can use fonts never before referenced. |
| 2896 |
Building all fonts in advance is therefore impractical, if not |
| 2897 |
impossible. |
| 2898 |
|
| 2899 |
It is also useful for the @TeX{} @samp{.fmt} (and Metafont |
| 2900 |
@samp{.base} and Metapost @samp{.mem} files, @pxref{Memory |
| 2901 |
dumps,,,Web2c,web2c}), where pre-generating every format consumes a |
| 2902 |
lot of both time and space. |
| 2903 |
|
| 2904 |
The script is passed the name of the file to create and possibly other |
| 2905 |
arguments, as explained below. It must echo the full pathname of the |
| 2906 |
file it created (and nothing else) to standard output; it can write |
| 2907 |
diagnostics to standard error. |
| 2908 |
|
| 2909 |
@menu |
| 2910 |
* config: mktex configuration. |
| 2911 |
* names: mktex script names. |
| 2912 |
* args: mktex script arguments. |
| 2913 |
@end menu |
| 2914 |
|
| 2915 |
|
| 2916 |
@node mktex configuration |
| 2917 |
@subsection @file{mktex} configuration |
| 2918 |
|
| 2919 |
@cindex @file{mktex} script configuration |
| 2920 |
@cindex configuration of @file{mktex} scripts |
| 2921 |
@cindex enabling @file{mktex} scripts |
| 2922 |
@cindex disabling @file{mktex} scripts |
| 2923 |
|
| 2924 |
The list of file types and program names that can run an external |
| 2925 |
program to create missing files is listed in the next section. In the |
| 2926 |
absence of @code{configure} options specifying otherwise, everything |
| 2927 |
but @file{mktextex} will be enabled by default. The @code{configure} |
| 2928 |
options to change the defaults are: |
| 2929 |
|
| 2930 |
@cindex @code{configure} options for @file{mktex} scripts |
| 2931 |
@opindex --without-mktexfmt-default |
| 2932 |
@opindex --without-mktexmf-default |
| 2933 |
@opindex --without-mktexocp-default |
| 2934 |
@opindex --without-mktexofm-default |
| 2935 |
@opindex --without-mktexpk-default |
| 2936 |
@opindex --without-mktextfm-default |
| 2937 |
@opindex --with-mktextex-default |
| 2938 |
@example |
| 2939 |
--without-mktexfmt-default |
| 2940 |
--without-mktexmf-default |
| 2941 |
--without-mktexocp-default |
| 2942 |
--without-mktexofm-default |
| 2943 |
--without-mktexpk-default |
| 2944 |
--without-mktextfm-default |
| 2945 |
--with-mktextex-default |
| 2946 |
@end example |
| 2947 |
|
| 2948 |
The @code{configure} setting is overridden if the environment variable |
| 2949 |
or configuration file value named for the script is set; e.g., |
| 2950 |
@file{MKTEXPK} (@pxref{mktex script arguments}). |
| 2951 |
|
| 2952 |
@flindex fmtutils.cnf |
| 2953 |
@code{mktexfmt} reads a file @file{fmtutil.cnf}, typically located in |
| 2954 |
@file{texmf/web2c/} to glean its configuration information. The rest |
| 2955 |
of the files and features in this section are primarily intended for |
| 2956 |
the font generation scripts. |
| 2957 |
|
| 2958 |
@flindex mktex.cnf |
| 2959 |
@flindex mktex.opt |
| 2960 |
@cindex site overrides for @code{mktex@dots{}} |
| 2961 |
As distributed, all the scripts source a file |
| 2962 |
@file{texmf/web2c/mktex.cnf} if it exists, so you can override various |
| 2963 |
defaults. |
| 2964 |
See @file{mktex.opt}, for instance, which defines the default mode, |
| 2965 |
resolution, some special directory names, etc. If you prefer not to |
| 2966 |
change the distributed scripts, you can simply create @file{mktex.cnf} |
| 2967 |
with the appropriate definitions (you do not need to create it if you |
| 2968 |
have nothing to put in it). @file{mktex.cnf} has no special syntax; |
| 2969 |
it's an arbitrary Bourne shell script. The distribution contains a |
| 2970 |
sample @file{mktex.cnf} for you to copy and modify as you please (it |
| 2971 |
is not installed anywhere). |
| 2972 |
|
| 2973 |
@flindex mktex.opt |
| 2974 |
@vindex MT_FEATURES |
| 2975 |
In addition, you can configure a number of features with the |
| 2976 |
@code{MT_FEATURES} variable, which you can define: |
| 2977 |
|
| 2978 |
@itemize @bullet |
| 2979 |
@item |
| 2980 |
in @file{mktex.opt}, as just mentioned; |
| 2981 |
|
| 2982 |
@item |
| 2983 |
by editing the file @file{mktex.opt}, either before @samp{make |
| 2984 |
install} (in the source hierarchy) or after (in the installed |
| 2985 |
hierarchy); |
| 2986 |
|
| 2987 |
@item |
| 2988 |
or in the environment. |
| 2989 |
@end itemize |
| 2990 |
|
| 2991 |
If none of the options below are enabled, @code{mktexpk}, |
| 2992 |
@code{mktextfm}, and @code{mktexmf} follow the following procedure to |
| 2993 |
decide where fonts should be installed. Find the tree where the font's |
| 2994 |
sources are, and test the permissions of the @samp{fonts} directory of |
| 2995 |
that tree to determine whether it is writable. If it is, put the files |
| 2996 |
in the tree in appropriate locations. If it isn't writable, see whether |
| 2997 |
the tree is a system tree (named in @code{SYSTEXMF}). If so, the |
| 2998 |
@code{VARTEXFONTS} tree is used. In all other cases the working |
| 2999 |
directory is used. |
| 3000 |
|
| 3001 |
The @samp{appendonlydir} option is enabled by default. |
| 3002 |
|
| 3003 |
@vtable @samp |
| 3004 |
@item appendonlydir |
| 3005 |
@cindex directories, making append-only |
| 3006 |
@flindex mktexdir |
| 3007 |
Tell @code{mktexdir} to create directories append-only, i.e., set |
| 3008 |
their sticky bit (@pxref{Mode Structure,,, coreutils, GNU Core |
| 3009 |
Utilities}). This feature is silently ignored on non-Unix platforms |
| 3010 |
(e.g. Windows/NT and MS-DOS) which don't support similar functionality. |
| 3011 |
This feature is enabled by default. |
| 3012 |
|
| 3013 |
@item dosnames |
| 3014 |
@cindex 8.3 filenames, using |
| 3015 |
@cindex DOS compatible names |
| 3016 |
@flindex dpi@var{nnn} directories |
| 3017 |
Use 8.3 names; e.g., @file{dpi600/cmr10.pk} instead of |
| 3018 |
@file{cmr10.600pk}. Note that this feature only affects filenames that |
| 3019 |
would otherwise clash with other TeX-related filenames; @file{mktex} |
| 3020 |
scripts do nothing about filenames which exceed the 8+3 MS-DOS limits |
| 3021 |
but remain unique when truncated (by the OS) to these limits, and nether |
| 3022 |
do the scripts care about possible clashes with files which aren't |
| 3023 |
related with TeX. For example, @file{cmr10.600pk} would clash with |
| 3024 |
@file{cmr10.600gf} and is therefore changed when @samp{dosnames} is in |
| 3025 |
effect, but @file{mf.pool} and @file{mp.base} don't clash with any |
| 3026 |
TeX-related files and are therefore unchanged. |
| 3027 |
|
| 3028 |
This feature is turned on by default on MS-DOS. If you do not wish |
| 3029 |
@samp{dosnames} to be set on an MS-DOS platform, you need to set the |
| 3030 |
@code{MT_FEATURES} environment variable to a value that doesn't include |
| 3031 |
@samp{dosnames}. You can also change the default setting by editing |
| 3032 |
@file{mktex.opt}, but only if you use the @file{mktex} shell scripts; |
| 3033 |
the emulation programs don't consult @file{mktex.opt}. |
| 3034 |
|
| 3035 |
@item fontmaps |
| 3036 |
@cindex fontmaps |
| 3037 |
@cindex fontname |
| 3038 |
Instead of deriving the location of a font in the destination tree from |
| 3039 |
the location of the sources, the aliases and directory names from the |
| 3040 |
Fontname distribution are used. (@pxref{Top,, Introduction, fontname, |
| 3041 |
Fontname}). |
| 3042 |
|
| 3043 |
@item nomfdrivers |
| 3044 |
@cindex metafont driver files |
| 3045 |
Let mktexpk and mktextfm create metafont driver files in a temporary |
| 3046 |
directory. These will be used for just one metafont run and not |
| 3047 |
installed permanently. |
| 3048 |
|
| 3049 |
@item nomode |
| 3050 |
@cindex mode directory, omitting |
| 3051 |
Omit the directory level for the mode name; this is fine as long as |
| 3052 |
you generate fonts for only one mode. |
| 3053 |
|
| 3054 |
@item stripsupplier |
| 3055 |
@cindex supplier directory, omitting |
| 3056 |
Omit the font supplier name directory level. |
| 3057 |
|
| 3058 |
@item striptypeface |
| 3059 |
@cindex typeface directory, omitting |
| 3060 |
Omit the font typeface name directory level. |
| 3061 |
|
| 3062 |
@item strip |
| 3063 |
@cindex supplier directory, omitting |
| 3064 |
@cindex typeface directory, omitting |
| 3065 |
Omit the font supplier and typeface name directory levels. This feature |
| 3066 |
is deprecated in favour of @samp{stripsupplier} and @samp{striptypeface}. |
| 3067 |
|
| 3068 |
@item varfonts |
| 3069 |
@flindex /var/tmp/texfonts |
| 3070 |
@vindex VARTEXFONTS |
| 3071 |
@cindex Linux File System Standard |
| 3072 |
When this option is enabled, fonts that would otherwise be written in |
| 3073 |
system texmf tree go to the @code{VARTEXFONTS} tree instead. The |
| 3074 |
default value in @file{kpathsea/Makefile.in} is |
| 3075 |
@file{/var/tmp/texfonts}. The @cite{Linux File System Standard} |
| 3076 |
recommends @file{/var/tex/fonts}. |
| 3077 |
|
| 3078 |
@vindex USE_VARTEXFONTS |
| 3079 |
The @samp{varfonts} setting in @code{MT_FEATURES} is overridden by the |
| 3080 |
@code{USE_VARTEXFONTS} environment variable: if set to @samp{1}, the |
| 3081 |
feature is enabled, and if set to @samp{0}, the feature is disabled. |
| 3082 |
|
| 3083 |
@item texmfvar |
| 3084 |
@vindex TEXMFVAR |
| 3085 |
Force generated files that would go into a system tree (as defined by |
| 3086 |
@code{SYSTEXMF}) into @code{TEXMFVAR}. Starting with te@TeX{}-3.0, the |
| 3087 |
variable @code{TEXMFVAR} is always set. The @samp{varfonts} feature takes |
| 3088 |
precedence if also set. |
| 3089 |
|
| 3090 |
@vindex USE_TEXMFVAR |
| 3091 |
The @samp{texmfvar} setting in @code{MT_FEATURES} is overridden by the |
| 3092 |
@code{USE_TEXMFVAR} environment variable: if set to @samp{1}, the |
| 3093 |
feature is enabled, and if set to @samp{0}, the feature is disabled. |
| 3094 |
@end vtable |
| 3095 |
|
| 3096 |
|
| 3097 |
@node mktex script names |
| 3098 |
@subsection @file{mktex} script names |
| 3099 |
|
| 3100 |
@cindex @file{mktex} script names |
| 3101 |
@cindex names for @file{mktex} scripts |
| 3102 |
|
| 3103 |
The following table shows the default name of the script for each |
| 3104 |
of the file types which support runtime generation. |
| 3105 |
|
| 3106 |
@table @file |
| 3107 |
@item mktexfmt |
| 3108 |
@pindex mktexfmt |
| 3109 |
@pindex fmtutil |
| 3110 |
(@samp{.fmt}, @samp{.base}, @samp{.mem}) @TeX{}/Metafont/MetaPost |
| 3111 |
formats. This script is also named @command{fmtutil}, and reads |
| 3112 |
@file{fmtutil.cnf} for configuration information. |
| 3113 |
|
| 3114 |
@item mktexmf |
| 3115 |
@pindex mktexmf |
| 3116 |
(@samp{.mf}) Metafont input files. |
| 3117 |
|
| 3118 |
@item mkocp |
| 3119 |
@pindex mkocp |
| 3120 |
(@samp{.ocp}) Omega compiled process files. |
| 3121 |
|
| 3122 |
@item mkofm |
| 3123 |
@pindex mkofm |
| 3124 |
(@samp{.ofm}) Omega font metric files. |
| 3125 |
|
| 3126 |
@item mktexpk |
| 3127 |
@pindex mktexpk |
| 3128 |
(@samp{pk}) Glyph fonts. |
| 3129 |
|
| 3130 |
@item mktextex |
| 3131 |
@pindex mktextex |
| 3132 |
(@samp{.tex}) @TeX{} input files (disabled by default). |
| 3133 |
|
| 3134 |
@item mktextfm |
| 3135 |
@pindex mktextfm |
| 3136 |
(@samp{.tfm}) TFM files. |
| 3137 |
@end table |
| 3138 |
|
| 3139 |
@vindex DVIPSMAKEPK |
| 3140 |
@vindex XDVIMAKEPK |
| 3141 |
@vindex DVILJMAKEPK |
| 3142 |
@noindent These names can be overridden by an environment variable specific |
| 3143 |
to the program; for example, @code{DVIPSMAKEPK} for Dvipsk. |
| 3144 |
|
| 3145 |
@comment next two paragraphs are repeated in dvips.texi |
| 3146 |
@flindex missfont.log |
| 3147 |
@cindex failed @code{mktex@dots{}} script invocation |
| 3148 |
If a @code{mktex@dots{}} script fails, the invocation is appended to a |
| 3149 |
file @file{missfont.log} (by default) in the current directory. After |
| 3150 |
fixing the problem, you can then execute the log file to create the |
| 3151 |
missing files. |
| 3152 |
|
| 3153 |
@vindex TEXMF_OUTPUT_DIRECTORY@r{, and @file{missfont.log}} |
| 3154 |
@vindex TEXMFOUTPUT@r{, and @file{missfont.log}} |
| 3155 |
If the environment variable @code{TEXMF_OUTPUT_DIRECTORY} is set, |
| 3156 |
@file{missfont.log} is first tried to be written there; if it's not |
| 3157 |
set, the current directory is tried first. If that first write fails |
| 3158 |
and the environment variable or configuration file value |
| 3159 |
@code{TEXMFOUTPUT} is set, we try to write @file{missfont.log} there. |
| 3160 |
Otherwise nothing is written. |
| 3161 |
|
| 3162 |
@vindex MISSFONT_LOG |
| 3163 |
The base filename @samp{missfont.log} is overridden by the |
| 3164 |
@code{MISSFONT_LOG} environment variable or configuration file value. |
| 3165 |
|
| 3166 |
|
| 3167 |
@node mktex script arguments |
| 3168 |
@subsection @file{mktex} script arguments |
| 3169 |
|
| 3170 |
@cindex arguments to @file{mktex} |
| 3171 |
|
| 3172 |
The first argument to a @file{mktex} script is always the name |
| 3173 |
of the file to be created. |
| 3174 |
|
| 3175 |
In the default @file{mktexpk} implementation, additional arguments may |
| 3176 |
also be passed: |
| 3177 |
|
| 3178 |
@table @samp |
| 3179 |
@item --dpi @var{num} |
| 3180 |
Sets the resolution of the generated font to @var{num}. |
| 3181 |
@item --mfmode @var{name} |
| 3182 |
Sets the Metafont mode to @var{name}. |
| 3183 |
@item --bdpi @var{num} |
| 3184 |
Sets the ``base dpi'' for the font. This must match the mode being |
| 3185 |
used. |
| 3186 |
@item --mag @var{string} |
| 3187 |
A ``magstep'' string suitable for the Metafont @code{mag} variable. |
| 3188 |
This must match the combination of @var{bdpi} and @var{dpi} being used. |
| 3189 |
@item --destdir @var{string} |
| 3190 |
A directory name. If the directory is absolute, it is used as-is. |
| 3191 |
Otherwise, it is appended to the root destination directory set in the |
| 3192 |
script. |
| 3193 |
@end table |
| 3194 |
|
| 3195 |
|
| 3196 |
@node Programming |
| 3197 |
@chapter Programming |
| 3198 |
|
| 3199 |
This chapter is for programmers who wish to use Kpathsea. |
| 3200 |
@xref{Introduction}, for the conditions under which you may do so (in |
| 3201 |
short, it is released under LGPLv2.1 or later). |
| 3202 |
|
| 3203 |
@menu |
| 3204 |
* Overview: Programming overview. Introduction. |
| 3205 |
* Calling sequence:: Specifics of what to call. |
| 3206 |
* Safe filenames:: Only opening allowed files. |
| 3207 |
* Program-specific files:: How to handle these. |
| 3208 |
* Config: Programming with config files. Getting info from texmf.cnf. |
| 3209 |
@end menu |
| 3210 |
|
| 3211 |
|
| 3212 |
@node Programming overview |
| 3213 |
@section Programming overview |
| 3214 |
|
| 3215 |
@cindex programming overview |
| 3216 |
@cindex overview of programming with Kpathsea |
| 3217 |
|
| 3218 |
Aside from this manual, your best source of information is the source |
| 3219 |
to the programs that use Kpathsea (@pxref{Introduction}). First, |
| 3220 |
Kpsewhich is a small utility program whose sole purpose is to exercise |
| 3221 |
the main path-searching functionality. Of the drivers, Dviljk is |
| 3222 |
probably the simplest full application program. Xdvik adds VF support |
| 3223 |
and the complication of X resources. Dvipsk adds the complication of |
| 3224 |
its own config files. Web2c is source code I also maintain, so it |
| 3225 |
uses Kpathsea rather straightforwardly, but is of course complicated |
| 3226 |
by the Web to C translation. |
| 3227 |
|
| 3228 |
@cindex re-entrant API |
| 3229 |
@cindex API, re-entrant |
| 3230 |
When looking at these program sources, you should know that previous |
| 3231 |
versions of the library had a different programming interface; the |
| 3232 |
current interface supports re-entrancy. Historically, the library |
| 3233 |
function names were prefixed with @code{kpse_} instead of |
| 3234 |
@code{kpathsea_}, and they did not need an instance variable as first |
| 3235 |
argument. This change was made in 2009. The old functions will never |
| 3236 |
disappear, and can reliably continue to be used when they suffice, as |
| 3237 |
they do for the programs above. The main application using the |
| 3238 |
re-entrant API is the MetaPost library used by MetaPost and Lua@TeX{}. |
| 3239 |
|
| 3240 |
@flindex pathsearch.h |
| 3241 |
@flindex tex-file.h |
| 3242 |
@flindex tex-glyph.h |
| 3243 |
@flindex kpathsea.h |
| 3244 |
Beyond these examples, the @file{.h} files in the Kpathsea source |
| 3245 |
describe the interfaces and functionality (and of course the @file{.c} |
| 3246 |
files define the actual routines, which are the ultimate documentation). |
| 3247 |
@file{pathsearch.h} declares the basic searching routine. |
| 3248 |
@file{tex-file.h} and @file{tex-glyph.h} define the interfaces for |
| 3249 |
looking up particular kinds of files. In view of the way the headers |
| 3250 |
depend on each other, it is recommended to use @code{#include |
| 3251 |
<kpathsea/kpathsea.h>}, which includes every Kpathsea header. |
| 3252 |
|
| 3253 |
@flindex config.h |
| 3254 |
@flindex c-auto.h |
| 3255 |
If you want to include only specific headers, you should still |
| 3256 |
consider including @file{kpathsea/config.h} before including any other |
| 3257 |
Kpathsea header, as it provides symbols used in the other headers; |
| 3258 |
@file{kpathsea/config.h} includes @file{kpathsea/c-auto.h}, which is |
| 3259 |
generated by Autoconf. |
| 3260 |
|
| 3261 |
@cindex file types, registering new |
| 3262 |
The library provides no way for an external program to register new file |
| 3263 |
types: @file{tex-file.[ch]} must be modified to do this. For example, |
| 3264 |
Kpathsea has support for looking up Dvips config files, even though no |
| 3265 |
program other than Dvips is likely to ever want to do so. I felt this |
| 3266 |
was acceptable, since along with new file types should also come new |
| 3267 |
defaults in @file{texmf.cnf} (and its descendant @file{paths.h}), since |
| 3268 |
it's simplest for users if they can modify one configuration file for |
| 3269 |
all kinds of paths. |
| 3270 |
|
| 3271 |
Kpathsea does not parse any formats itself; it barely opens any files. |
| 3272 |
Its primary purpose is to return filenames. The GNU font utilities |
| 3273 |
package contains libraries to read TFM, GF, and PK files, as do the |
| 3274 |
programs above, of course. |
| 3275 |
|
| 3276 |
|
| 3277 |
@node Calling sequence |
| 3278 |
@section Calling sequence |
| 3279 |
|
| 3280 |
@cindex programming with Kpathsea |
| 3281 |
@cindex calling sequence |
| 3282 |
|
| 3283 |
The typical way to use Kpathsea in your program goes something like this: |
| 3284 |
|
| 3285 |
@enumerate |
| 3286 |
|
| 3287 |
@item |
| 3288 |
@findex kpathsea_new |
| 3289 |
Call @code{kpathsea_new} to create a new library instance. This variable |
| 3290 |
must be passed as the first argument to all the following library functions. |
| 3291 |
The rest of this manual will be using @code{kpse} as a placeholder for |
| 3292 |
the name of this variable. |
| 3293 |
|
| 3294 |
@item |
| 3295 |
@findex kpathsea_set_program_name |
| 3296 |
@vindex argv[0] |
| 3297 |
Call @code{kpathsea_set_program_name} with @code{argv[0]} as the second |
| 3298 |
argument; the third argument is a string or @code{NULL}. The third |
| 3299 |
argument is used by Kpathsea as the program name for the |
| 3300 |
@code{.@var{program}} feature of config files (@pxref{Config files}). |
| 3301 |
If the third argument is @code{NULL}, the value of the second argument |
| 3302 |
is used. This function must be called before any other use of the |
| 3303 |
Kpathsea library. |
| 3304 |
|
| 3305 |
@vindex kpse->invocation_name |
| 3306 |
@vindex kpse->invocation_short_name |
| 3307 |
@vindex kpse->program_name |
| 3308 |
@cindex error message macros |
| 3309 |
@code{kpathsea_set_program_name} always sets the variables |
| 3310 |
@code{kpse->invocation_name} and @code{kpse->invocation_short_name}. |
| 3311 |
These variables are used in the error message macros defined in |
| 3312 |
@file{kpathsea/lib.h}. It sets the variable |
| 3313 |
@code{kpse->program_name} to the program name it uses. |
| 3314 |
|
| 3315 |
@vindex KPATHSEA_DEBUG |
| 3316 |
It also initializes debugging options based on the environment |
| 3317 |
variable @code{KPATHSEA_DEBUG} (if that is set). |
| 3318 |
|
| 3319 |
@cindex SELFAUTOLOC |
| 3320 |
@cindex SELFAUTODIR |
| 3321 |
@cindex SELFAUTOPARENT |
| 3322 |
@cindex symlinks, resolving |
| 3323 |
@cindex expanding symlinks |
| 3324 |
Finally, it sets the environment variables @code{SELFAUTOLOC}, |
| 3325 |
@code{SELFAUTODIR} and @code{SELFAUTOPARENT} to the location, parent |
| 3326 |
and grandparent directory of the executable, removing @file{.} and |
| 3327 |
@file{..} path elements and resolving symbolic links. These are used |
| 3328 |
in the default configuration file to allow people to invoke TeX from |
| 3329 |
anywhere. You can use @samp{kpsewhich --expand-var=\$SELFAUTOLOC}, |
| 3330 |
etc., to see the values. |
| 3331 |
|
| 3332 |
@item |
| 3333 |
@vindex kpse->debug @r{variable} |
| 3334 |
@cindex debugging options, in Kpathsea-using program |
| 3335 |
Set debugging options. @xref{Debugging}. If your program doesn't have |
| 3336 |
a debugging option already, you can define one and set |
| 3337 |
@code{kpse->debug} to the number that the user supplies (as in Dviljk |
| 3338 |
and Web2c), or you can just omit this altogether (users can always set |
| 3339 |
the @code{KPATHSEA_DEBUG} environment variable). If you do have |
| 3340 |
runtime debugging already, you need to merge Kpathsea's options with |
| 3341 |
yours (as in Dvipsk and Xdvik). |
| 3342 |
|
| 3343 |
@item |
| 3344 |
@vindex client_path @r{in @code{kpse->format_info}} |
| 3345 |
@vindex kpse->format_info |
| 3346 |
@flindex resident.c |
| 3347 |
@cindex config files, for Kpathsea-using programs |
| 3348 |
If your program has its own configuration files that can define search |
| 3349 |
paths, you should assign those paths to the @code{client_path} member in |
| 3350 |
the appropriate element of the @code{kpse->format_info} array. (This |
| 3351 |
array is indexed by file type; see @file{tex-file.h}.) See |
| 3352 |
@file{resident.c} in Dvipsk for an example. |
| 3353 |
|
| 3354 |
@item |
| 3355 |
@findex kpathsea_init_prog |
| 3356 |
@flindex proginit.h |
| 3357 |
Call @code{kpathsea_init_prog} (see @file{proginit.c}). It's useful |
| 3358 |
for the DVI drivers, at least, but for other programs it may be |
| 3359 |
simpler to extract the parts of it that actually apply. This does not |
| 3360 |
initialize any paths, it just looks for (and sets) certain environment |
| 3361 |
variables and other random information. Search paths are always |
| 3362 |
initialized at the first call to find a file of a given type, not |
| 3363 |
requiring an explicit initialization call; this eliminates much |
| 3364 |
useless work, e.g., initializing the Bib@TeX{} search paths in a DVI |
| 3365 |
driver. |
| 3366 |
|
| 3367 |
@item |
| 3368 |
@findex kpathsea_find_file |
| 3369 |
The routine to actually find a file of type @var{format} is |
| 3370 |
@file{kpathsea_find_file}. You can call |
| 3371 |
@code{kpathsea_find_file} after doing only the first and second of the |
| 3372 |
initialization steps above---Kpathsea automatically reads the |
| 3373 |
@file{texmf.cnf} generic config files, looks for environment variables, |
| 3374 |
and does expansions at the first lookup. |
| 3375 |
|
| 3376 |
@item |
| 3377 |
@findex kpathsea_find_glyph |
| 3378 |
To find PK and/or GF bitmap fonts, the routine |
| 3379 |
is @code{kpathsea_find_glyph}, defined in |
| 3380 |
@file{tex-glyph.h}. This returns a structure in addition to the |
| 3381 |
resultant filename, because fonts can be found in so many ways. See the |
| 3382 |
documentation in the source. |
| 3383 |
|
| 3384 |
@item |
| 3385 |
Before opening a file, especially for writing, you should check if the |
| 3386 |
filename is acceptable. See the next section (@pxref{Safe filenames}). |
| 3387 |
|
| 3388 |
@item |
| 3389 |
@findex kpathsea_open_file |
| 3390 |
To actually open a file, not just return a filename, call |
| 3391 |
@code{kpathsea_open_file}. This function takes the name to look up and a |
| 3392 |
Kpathsea file format as arguments, and returns the usual @code{FILE *}. |
| 3393 |
It always assumes the file must exist, and thus will search the disk if |
| 3394 |
necessary (unless the search path specified @samp{!!}, etc.). In other |
| 3395 |
words, if you are looking up a VF or some other file that need not |
| 3396 |
exist, don't use this. |
| 3397 |
|
| 3398 |
@item |
| 3399 |
@findex kpathsea_finish |
| 3400 |
To close the Kpathsea library instance you are using, call |
| 3401 |
@code{kpathsea_finish}. This function closes any open log files and |
| 3402 |
frees the memory used by the instance. |
| 3403 |
|
| 3404 |
@end enumerate |
| 3405 |
|
| 3406 |
@cindex hash table routines |
| 3407 |
@cindex memory allocation routines |
| 3408 |
@cindex string routines |
| 3409 |
@cindex reading arbitrary-length lines |
| 3410 |
@cindex input lines, reading |
| 3411 |
@cindex lines, reading arbitrary-length |
| 3412 |
Kpathsea also provides many utility routines. Some are generic: hash |
| 3413 |
tables, memory allocation, string concatenation and copying, string |
| 3414 |
lists, reading input lines of arbitrary length, etc. Others are |
| 3415 |
filename-related: default path, tilde, and variable expansion, |
| 3416 |
@code{stat} calls, etc. |
| 3417 |
|
| 3418 |
@flindex c-*.h |
| 3419 |
@pindex autoconf@r{, recommended} |
| 3420 |
The @file{c-*.h} header files can also help your program adapt to many |
| 3421 |
different systems. You will almost certainly want to use Autoconf and |
| 3422 |
probably Automake for configuring and building your software if you use |
| 3423 |
Kpathsea; I strongly recommend using Autoconf and Automake regardless. |
| 3424 |
They are available from @url{https://gnu.org/software}. |
| 3425 |
|
| 3426 |
|
| 3427 |
@node Safe filenames |
| 3428 |
@section Safe filenames |
| 3429 |
|
| 3430 |
@vindex openout_any |
| 3431 |
@anchor{openout_any} |
| 3432 |
@cindex trojan horse |
| 3433 |
@xref{Security}, for some general security considerations with the |
| 3434 |
@TeX{} system. |
| 3435 |
|
| 3436 |
In the implementation, the main security feature to disallow writing |
| 3437 |
to potentially dangerous files is a configuration variable |
| 3438 |
@code{openout_any}. It specifies one of three levels: |
| 3439 |
|
| 3440 |
@itemize |
| 3441 |
@item |
| 3442 |
@cindex unrestricted mode, for output files |
| 3443 |
When set to @samp{a} (for ``any''), no restrictions are imposed. |
| 3444 |
|
| 3445 |
@item |
| 3446 |
@cindex restricted mode, for output files |
| 3447 |
When is set to @samp{r} (for ``restricted''), filenames beginning |
| 3448 |
with @samp{.} are disallowed. |
| 3449 |
|
| 3450 |
@item |
| 3451 |
@cindex paranoid mode, for output files |
| 3452 |
When set to @samp{p} (for ``paranoid''), additional restrictions are |
| 3453 |
imposed. |
| 3454 |
|
| 3455 |
@enumerate |
| 3456 |
@item |
| 3457 |
@vindex TEXMF_OUTPUT_DIRECTORY@r{, and paranoid output files} |
| 3458 |
@vindex TEXMFOUTPUT@r{, and paranoid output files} |
| 3459 |
First, an absolute filename must refer to a file in (or in a |
| 3460 |
subdirectory of) either the @code{TEXMF_OUTPUT_DIRECTORY} environment |
| 3461 |
variable or the @code{TEXMFOUTPUT} environment variable or |
| 3462 |
configuration file setting. |
| 3463 |
|
| 3464 |
@item |
| 3465 |
@vindex TEXMFSYSVAR |
| 3466 |
@vindex TEXMFVAR |
| 3467 |
@findex luaotfload |
| 3468 |
Lua@TeX{} uses a so-called ``extended'' mode, in which the values of |
| 3469 |
@code{TEXMFVAR} and @code{TEXMFSYSVAR} are also checked for absolute |
| 3470 |
filenames. This is done because, in practice, fundamental parts of |
| 3471 |
the Lua@LaTeX{} system (notably @code{luaotfload}) need a cache |
| 3472 |
directory, and historically the @code{TEXMF[SYS]VAR} variables are |
| 3473 |
what has been used. We neither recommend nor expect any other programs |
| 3474 |
to need this. |
| 3475 |
|
| 3476 |
@item |
| 3477 |
Finally, any attempt to go up a directory level is forbidden; that is, |
| 3478 |
paths may not contain a @samp{..} component. |
| 3479 |
|
| 3480 |
@end enumerate |
| 3481 |
@end itemize |
| 3482 |
|
| 3483 |
The paranoid setting is the default. Any program intended to be safely |
| 3484 |
called from @TeX{} should implement the same measures, one way or |
| 3485 |
another. @xref{Shell escapes,,, web2c, Web2c}. |
| 3486 |
|
| 3487 |
Kpathsea does not resolve @samp{..} components, or symbolic links, to |
| 3488 |
see if the final result is an acceptable directory; they are simply |
| 3489 |
forbidden. That is, Kpathsea merely considers the value as a string, |
| 3490 |
not looking on the filesystem at all. (However, if another program |
| 3491 |
wants to do such resolutions and check the result, that's ok; possibly |
| 3492 |
preferable.) |
| 3493 |
|
| 3494 |
For backwards compatibility, @samp{y} and @samp{1} are synonyms of |
| 3495 |
@samp{a}, while @samp{n} and @samp{0} are synonyms for @samp{r}. |
| 3496 |
|
| 3497 |
@findex kpathsea_out_name_ok |
| 3498 |
The function @code{kpathsea_out_name_ok}, with a filename as second |
| 3499 |
argument, returns @code{true} if that filename is acceptable to be |
| 3500 |
opened for output or @code{false} otherwise. The Kpsewhich program |
| 3501 |
has an option (@samp{--safe-out-name}) providing a command line |
| 3502 |
interface for the check. |
| 3503 |
|
| 3504 |
@findex kpathsea_out_name_ok_extended |
| 3505 |
For Lua@TeX{}'s extended mode, the function is |
| 3506 |
@code{kpathsea_out_name_ok_extended}, and the Kpsewhich option is |
| 3507 |
@samp{--safe-extended-out-name}. |
| 3508 |
|
| 3509 |
@findex kpathsea_in_name_ok |
| 3510 |
@findex kpathsea_in_name_ok_extended |
| 3511 |
@vindex openin_any |
| 3512 |
Although the analogous functions @code{kpathsea_in_name_ok} (resp.@: |
| 3513 |
@code{_extended}, as well as the others below, exist to check a |
| 3514 |
filename being acceptable for reading, as of 2026, they always return |
| 3515 |
true without checking anything. This is because no other value was |
| 3516 |
useful (or used) in practice. More comments about this are in the |
| 3517 |
default @file{texmf.cnf}, at @code{openin_any} (which variable is |
| 3518 |
defined, but is now ignored). |
| 3519 |
|
| 3520 |
The functions above write a message to standard error if the usage is |
| 3521 |
forbidden (so every caller does not have to do so). Each function has |
| 3522 |
a @code{_silent} counterpart which does not write the message; this is |
| 3523 |
what Kpsewhich calls, since messages would be counterproductive in |
| 3524 |
that case. Thus: |
| 3525 |
|
| 3526 |
@findex kpathsea_out_name_ok_silent |
| 3527 |
@findex kpathsea_out_name_ok_silent_extended |
| 3528 |
@findex kpathsea_in_name_ok_silent |
| 3529 |
@findex kpathsea_in_name_ok_silent_extended |
| 3530 |
|
| 3531 |
@example |
| 3532 |
kpathsea_out_name_ok_silent |
| 3533 |
kpathsea_out_name_ok_silent_extended |
| 3534 |
kpathsea_in_name_ok_silent |
| 3535 |
kpathsea_in_name_ok_silent_extended |
| 3536 |
@end example |
| 3537 |
|
| 3538 |
Furthermore, there are @code{kpse_...} versions of all the above |
| 3539 |
functions (as usual), with the default library instance implicitly |
| 3540 |
passed as the first argument. Lua@TeX{} provides both @code{kpse.*} |
| 3541 |
and @code{kpathsea.*} bindings, so it's good to always have both. |
| 3542 |
|
| 3543 |
Sorry for the combinatorial explosion, but we hope no further options |
| 3544 |
will ever be needed. If so, we'll likely provide a more generic |
| 3545 |
interface as well as the above. |
| 3546 |
|
| 3547 |
|
| 3548 |
@node Program-specific files |
| 3549 |
@section Program-specific files |
| 3550 |
|
| 3551 |
Many programs will need to find some configuration files. Kpathsea |
| 3552 |
contains some support to make it easy to place them in their own |
| 3553 |
directories. The Standard @TeX{} directory structure (@pxref{Top,, |
| 3554 |
Introduction, tds, A Directory Structure for @TeX{} files}), specifies |
| 3555 |
that such files should go into a subdirectory named after the program, |
| 3556 |
like @samp{texmf/ttf2pk}. |
| 3557 |
|
| 3558 |
Two formats, @samp{kpse_program_text_format} and |
| 3559 |
@samp{kpse_program_binary_format}, use @code{.:$TEXMF/@var{program}//} |
| 3560 |
as their compiled-in search path. To override this default, you can |
| 3561 |
use the variable @code{@var{PROGRAM}INPUTS} in the environment and/or |
| 3562 |
@samp{texmf.cnf}. That is to say, the name of the variable is |
| 3563 |
constructed by converting the name of the program to upper case, and |
| 3564 |
appending @code{INPUTS}. |
| 3565 |
|
| 3566 |
The only difference between these two formats is whether |
| 3567 |
@code{kpathsea_open_file} will open the files it finds in text or binary |
| 3568 |
mode. |
| 3569 |
|
| 3570 |
|
| 3571 |
@node Programming with config files |
| 3572 |
@section Programming with config files |
| 3573 |
|
| 3574 |
@cindex programming with config files |
| 3575 |
@cindex config files, programming with |
| 3576 |
|
| 3577 |
You can (and probably should) use the same @code{texmf.cnf} |
| 3578 |
configuration file that Kpathsea uses for your program. This helps |
| 3579 |
installers by keeping all configuration in one place. |
| 3580 |
|
| 3581 |
@findex kpathsea_var_value |
| 3582 |
@flindex variable.h |
| 3583 |
@vindex shell_escape@r{, example for code} |
| 3584 |
To retrieve a value for a configuration variable @var{var}, the best |
| 3585 |
way is to call @code{kpathsea_var_value} on the string |
| 3586 |
@code{@var{var}}. This will look first for an environment variable |
| 3587 |
@var{var}, then a config file value. The result will be the value |
| 3588 |
found or @samp{NULL}. This function is declared in |
| 3589 |
@file{kpathsea/variable.h}. For an example, see the |
| 3590 |
@code{shell_escape} code in @file{web2c/lib/texmfmp.c}. |
| 3591 |
|
| 3592 |
The routine to do full variable and tilde expansion of an arbitrary |
| 3593 |
string in the context of a search path (as opposed to simply |
| 3594 |
retrieving a value) is @code{kpathsea_var_expand}, also declared in |
| 3595 |
@file{kpathsea/variable.h}. However, it's generally only necessary to |
| 3596 |
set the search path structure components as explained in the previous |
| 3597 |
section instead of using this directly. Because of its usage with any |
| 3598 |
input string, undefined @code{$FOO} constructs in the argument to |
| 3599 |
@code{kpathsea_var_expand} are returned literally (@code{"$FOO"}), |
| 3600 |
while undefined @code{$@{FOO@}} constructs are expanded to the empty |
| 3601 |
string. |
| 3602 |
|
| 3603 |
@findex kpathsea_cnf_get |
| 3604 |
@flindex cnf.h |
| 3605 |
If for some reason you want to retrieve a value @emph{only} from a |
| 3606 |
config file, not automatically looking for a corresponding environment |
| 3607 |
variable, call @code{kpathsea_cnf_get} (declared in @file{kpathsea/cnf.h}) |
| 3608 |
with the string @var{var}. |
| 3609 |
|
| 3610 |
No initialization calls are needed. |
| 3611 |
|
| 3612 |
|
| 3613 |
@node Reporting bugs |
| 3614 |
@chapter Reporting bugs |
| 3615 |
|
| 3616 |
@cindex reporting bugs |
| 3617 |
@cindex bugs, reporting |
| 3618 |
|
| 3619 |
@flindex tex-k@@tug.org @r{(bug address)} |
| 3620 |
@cindex bug address |
| 3621 |
If you have problems or suggestions, please report them to |
| 3622 |
@email{tex-k@@tug.org} using the bug checklist below. |
| 3623 |
|
| 3624 |
Please report bugs in the documentation; not only factual errors or |
| 3625 |
inconsistent behavior, but unclear or incomplete explanations, typos, |
| 3626 |
wrong fonts, @dots{} |
| 3627 |
|
| 3628 |
@menu |
| 3629 |
* Bug checklist:: What to include in a good bug report. |
| 3630 |
* Mailing lists:: Joining the bugs or announcements mailing lists. |
| 3631 |
* Debugging:: Analyzing runtime problems. |
| 3632 |
* Logging:: Recording searches. |
| 3633 |
* Common problems:: When things go wrong. |
| 3634 |
@end menu |
| 3635 |
|
| 3636 |
|
| 3637 |
@node Bug checklist |
| 3638 |
@section Bug checklist |
| 3639 |
|
| 3640 |
@cindex checklist for bug reports |
| 3641 |
@cindex bug checklist |
| 3642 |
|
| 3643 |
Before reporting a bug, please check below to be sure it isn't already |
| 3644 |
known (@pxref{Common problems}). |
| 3645 |
|
| 3646 |
Bug reports should be sent via electronic mail to |
| 3647 |
@email{tex-k@@tug.org}. |
| 3648 |
|
| 3649 |
The general principle is that a good bug report includes all the |
| 3650 |
information necessary for reproduction. Therefore, to enable |
| 3651 |
investigation, your report should include the following: |
| 3652 |
|
| 3653 |
@itemize @bullet |
| 3654 |
@item |
| 3655 |
@cindex version numbers, determining |
| 3656 |
The version number(s) of the program(s) involved, and of Kpathsea |
| 3657 |
itself. You can get the former by giving a sole option @samp{--version} |
| 3658 |
to the program, and the latter by running @samp{kpsewhich --version}. |
| 3659 |
The @file{NEWS} and @file{ChangeLog} files also contain the version |
| 3660 |
number. |
| 3661 |
|
| 3662 |
@item |
| 3663 |
@pindex uname |
| 3664 |
The hardware, operating system (including version), compiler, and |
| 3665 |
@code{make} program you are using (the output of @code{uname -a} is a |
| 3666 |
start on the first two, though incomplete). |
| 3667 |
|
| 3668 |
@item |
| 3669 |
@flindex config.log |
| 3670 |
Any options you gave to @code{configure}. This is recorded in the |
| 3671 |
@file{config.status} files. |
| 3672 |
|
| 3673 |
@cindex configuration bugs |
| 3674 |
@flindex config.status |
| 3675 |
If you are reporting a bug in @samp{configure} itself, it's probably |
| 3676 |
system-dependent, and it will be unlikely the maintainers can do |
| 3677 |
anything useful if you merely report that thus-and-such is broken. |
| 3678 |
Therefore, you need to do some additional work: for some bugs, you can |
| 3679 |
look in the file @file{config.log} where the test that failed should |
| 3680 |
appear, along with the compiler invocation and source program in |
| 3681 |
question. You can then compile it yourself by hand, and discover why |
| 3682 |
the test failed. Other @samp{configure} bugs do not involve the |
| 3683 |
compiler; in that case, the only recourse is to inspect the |
| 3684 |
@code{configure} shell script itself, or the Autoconf macros that |
| 3685 |
generated @code{configure}. |
| 3686 |
|
| 3687 |
@item |
| 3688 |
The log of all debugging output, if the bug is in path searching. You |
| 3689 |
can get this by setting the environment variable @code{KPATHSEA_DEBUG} |
| 3690 |
to @samp{-1} before running the program. Please look at the log |
| 3691 |
yourself to make sure the behavior is really a bug before reporting it; |
| 3692 |
perhaps ``old'' environment variable settings are causing files not to |
| 3693 |
be found, for example. |
| 3694 |
|
| 3695 |
@item |
| 3696 |
The contents of any input files necessary to reproduce the bug. For |
| 3697 |
bugs in DVI-reading programs, for example, this generally means a DVI |
| 3698 |
file (and any EPS or other files it uses)---@TeX{} source files are |
| 3699 |
helpful, but the DVI file is required, because that's the actual |
| 3700 |
program input. |
| 3701 |
|
| 3702 |
@item |
| 3703 |
@cindex context diff |
| 3704 |
@cindex sending patches |
| 3705 |
@flindex ChangeLog @r{entry} |
| 3706 |
If you are sending a patch (do so if you can!), please do so in the form |
| 3707 |
of a context diff (@samp{diff -c}) against the original distribution |
| 3708 |
source. Any other form of diff is either not as complete or harder for |
| 3709 |
me to understand. Please also include a @file{ChangeLog} entry. |
| 3710 |
|
| 3711 |
@item |
| 3712 |
@cindex stack trace |
| 3713 |
@cindex debugger |
| 3714 |
@cindex crashes, reporting |
| 3715 |
@cindex core dumps, reporting |
| 3716 |
@cindex null pointers, dereferencing |
| 3717 |
@pindex gdb@r{, recommended} |
| 3718 |
If the bug involved is an actual crash (i.e., core dump), it is easy |
| 3719 |
and useful to include a stack trace from a debugger (I recommend the |
| 3720 |
GNU debugger GDB (@url{https://gnu.org/software/gdb}). If the |
| 3721 |
cause is apparent (a @code{NULL} value being dereferenced, for |
| 3722 |
example), please send the details along. If the program involved is |
| 3723 |
@TeX{} or Metafont, and the crash is happening at apparently-sound |
| 3724 |
code, however, the bug may well be in the compiler, rather than in the |
| 3725 |
program or the library (@pxref{TeX or Metafont failing,, @TeX{} or |
| 3726 |
Metafont failing}). |
| 3727 |
|
| 3728 |
@item |
| 3729 |
Any additional information that will be helpful in reproducing, |
| 3730 |
diagnosing, or fixing the bug. |
| 3731 |
@end itemize |
| 3732 |
|
| 3733 |
|
| 3734 |
@node Mailing lists |
| 3735 |
@section Mailing lists |
| 3736 |
|
| 3737 |
@cindex mailing lists |
| 3738 |
@cindex bug mailing list |
| 3739 |
@cindex announcement mailing list |
| 3740 |
|
| 3741 |
@flindex tex-k@@tug.org |
| 3742 |
Web2c and Kpathsea in general are discussed on the mailing list |
| 3743 |
@email{tex-k@@tug.org}. You can subscribe and peruse the archives on |
| 3744 |
the web @url{https://lists.tug.org/tex-k}. |
| 3745 |
|
| 3746 |
You do not need to join to submit a report, nor will it affect whether |
| 3747 |
you get a response. Be aware that large data files are sometimes |
| 3748 |
included in bug reports. If this is a problem for you, do not join |
| 3749 |
the list. |
| 3750 |
|
| 3751 |
If you are looking for general @TeX{} help, such as how to install a |
| 3752 |
full @TeX{} system or how to use @LaTeX{}, please see |
| 3753 |
@url{https://tug.org/begin.html}. |
| 3754 |
|
| 3755 |
|
| 3756 |
@node Debugging |
| 3757 |
@section Debugging |
| 3758 |
|
| 3759 |
@cindex debugging |
| 3760 |
@cindex runtime debugging |
| 3761 |
@cindex options for debugging |
| 3762 |
|
| 3763 |
@vindex kpse->debug |
| 3764 |
@flindex debug.h |
| 3765 |
Kpathsea provides a number of runtime debugging options, detailed below |
| 3766 |
by their names and corresponding numeric values. When the files you |
| 3767 |
expect aren't being found, the thing to do is enable these options and |
| 3768 |
examine the output. |
| 3769 |
|
| 3770 |
You can set these with some runtime argument (e.g., @samp{-d}) to the |
| 3771 |
program; in that case, you should use the numeric values described in |
| 3772 |
the program's documentation (which, for Dvipsk and Xdvik, are different |
| 3773 |
than those below). It's best to give the @samp{-d} (or whatever) option |
| 3774 |
first, for maximal output. Dvipsk and Xdvik have additional |
| 3775 |
program-specific debugging options as well. |
| 3776 |
|
| 3777 |
@vindex KPATHSEA_DEBUG |
| 3778 |
@vindex kpse->debug |
| 3779 |
You can also set the environment variable @code{KPATHSEA_DEBUG}; in this |
| 3780 |
case, you should use the numbers below. If you run the program under a |
| 3781 |
debugger and set the instance variable @code{kpse->debug}, also use the numbers |
| 3782 |
below. |
| 3783 |
|
| 3784 |
@kindex -1 @r{debugging value} |
| 3785 |
In any case, by far the simplest value to use is @samp{-1}, which will |
| 3786 |
turn on all debugging output. This is usually better than guessing |
| 3787 |
which particular values will yield the output you need. |
| 3788 |
|
| 3789 |
@cindex debugging output |
| 3790 |
@cindex standard error and debugging output |
| 3791 |
Debugging output always goes to standard error, so you can redirect it |
| 3792 |
easily. For example, in Bourne-compatible shells: |
| 3793 |
@example |
| 3794 |
dvips -d -1 @dots{} 2>/tmp/debug |
| 3795 |
@end example |
| 3796 |
|
| 3797 |
@cindex Kpsewhich, and debugging |
| 3798 |
It is sometimes helpful to run the standalone Kpsewhich utility |
| 3799 |
(@pxref{Invoking kpsewhich}), instead of the original program. |
| 3800 |
|
| 3801 |
@cindex numeric debugging values |
| 3802 |
In any case, you cannot use the names below; you must always use |
| 3803 |
somebody's numbers. (Sorry.) To set more than one option, just sum |
| 3804 |
the corresponding numbers. |
| 3805 |
|
| 3806 |
@vtable @code |
| 3807 |
@item KPSE_DEBUG_STAT @r{(1)} |
| 3808 |
Report @samp{stat}(2) calls. This is useful for verifying that your |
| 3809 |
directory structure is not forcing Kpathsea to do many additional file |
| 3810 |
tests (@pxref{Slow path searching}, and @pxref{Subdirectory |
| 3811 |
expansion}). If you are using an up-to-date @file{ls-R} database |
| 3812 |
(@pxref{Filename database}), this should produce no output unless a |
| 3813 |
nonexistent file that must exist is searched for. |
| 3814 |
|
| 3815 |
@item KPSE_DEBUG_HASH @r{(2)} |
| 3816 |
Report lookups in all hash tables: @file{ls-R} and @file{aliases} |
| 3817 |
(@pxref{Filename database}); font aliases (@pxref{Fontmap}); and config |
| 3818 |
file values (@pxref{Config files}). Useful when expected values are not |
| 3819 |
being found, e.g.., file searches are looking at the disk instead of |
| 3820 |
using @file{ls-R}. |
| 3821 |
|
| 3822 |
@item KPSE_DEBUG_FOPEN @r{(4)} |
| 3823 |
@findex fopen@r{, redefined} |
| 3824 |
Report file openings and closings. Especially useful when your system's |
| 3825 |
file table is full, for seeing which files have been opened but never |
| 3826 |
closed. In case you want to set breakpoints in a debugger: this works by |
| 3827 |
redefining @samp{fopen} (@samp{fclose}) to be @samp{kpse_fopen_trace} |
| 3828 |
(@samp{kpse_fclose_trace}). |
| 3829 |
|
| 3830 |
@item KPSE_DEBUG_PATHS @r{(8)} |
| 3831 |
@tindex kpse_format_info_type |
| 3832 |
Report general path information for each file type Kpathsea is asked to |
| 3833 |
search. This is useful when you are trying to track down how a |
| 3834 |
particular path got defined---from @file{texmf.cnf}, @file{config.ps}, |
| 3835 |
an environment variable, the compile-time default, etc. This is the |
| 3836 |
contents of the @code{kpse_format_info_type} structure defined in |
| 3837 |
@file{tex-file.h}. |
| 3838 |
|
| 3839 |
@item KPSE_DEBUG_EXPAND @r{(16)} |
| 3840 |
Report the directory list corresponding to each path element Kpathsea |
| 3841 |
searches. This is only relevant when Kpathsea searches the disk, since |
| 3842 |
@file{ls-R} searches don't look through directory lists in this way. |
| 3843 |
|
| 3844 |
@item KPSE_DEBUG_SEARCH @r{(32)} |
| 3845 |
Report on each file search: the name of the file searched for, the path |
| 3846 |
searched in, whether or not the file must exist (when drivers search for |
| 3847 |
@file{cmr10.vf}, it need not exist), and whether or not we are |
| 3848 |
collecting all occurrences of the file in the path (as with, e.g., |
| 3849 |
@file{texmf.cnf} and @file{texfonts.map}), or just the first (as with |
| 3850 |
most lookups). This can help you correlate what Kpathsea is doing with |
| 3851 |
what is in your input file. |
| 3852 |
|
| 3853 |
@item KPSE_DEBUG_VARS @r{(64)} |
| 3854 |
Report the value of each variable Kpathsea looks up. This is useful for |
| 3855 |
verifying that variables do indeed obtain their correct values. |
| 3856 |
|
| 3857 |
@item GSFTOPK_DEBUG @r{(128)} |
| 3858 |
Activates debugging printout specific to @code{gsftopk} program. |
| 3859 |
|
| 3860 |
@item MAKETEX_DEBUG @r{(512)} |
| 3861 |
If you use the optional @code{mktex} programs instead of the |
| 3862 |
traditional shell scripts, this will report the name of the site file |
| 3863 |
(@file{mktex.cnf} by default) which is read, directories created by |
| 3864 |
@code{mktexdir}, the full path of the @file{ls-R} database built by |
| 3865 |
@code{mktexlsr}, font map searches, @code{MT_FEATURES} in effect, |
| 3866 |
parameters from @code{mktexnam}, filenames added by |
| 3867 |
@code{mktexupd}, and some subsidiary commands run by the programs. |
| 3868 |
|
| 3869 |
@item MAKETEX_FINE_DEBUG @r{(1024)} |
| 3870 |
When the optional @code{mktex} programs are used, this will print |
| 3871 |
additional debugging info from functions internal to these programs. |
| 3872 |
@end vtable |
| 3873 |
|
| 3874 |
@cindex @samp{kdebug:} |
| 3875 |
@vindex hash_summary_only @r{variable for debugging} |
| 3876 |
@cindex hash table buckets, printing |
| 3877 |
Debugging output from Kpathsea is always written to standard error, and |
| 3878 |
begins with the string @samp{kdebug:}. (Except for hash table buckets, |
| 3879 |
which just start with the number, but you can only get that output |
| 3880 |
running under a debugger. See comments at the @code{hash_summary_only} |
| 3881 |
variable in @file{kpathsea/db.c}.) |
| 3882 |
|
| 3883 |
|
| 3884 |
@node Logging |
| 3885 |
@section Logging |
| 3886 |
|
| 3887 |
@cindex log file |
| 3888 |
|
| 3889 |
@cindex logging successful searches |
| 3890 |
@cindex recording successful searches |
| 3891 |
@cindex usage patterns, finding |
| 3892 |
@cindex disk usage, reducing |
| 3893 |
Kpathsea can record the time and filename found for each successful |
| 3894 |
search. This may be useful in finding good candidates for deletion when |
| 3895 |
your filesystem is full, or in discovering usage patterns |
| 3896 |
at your site. |
| 3897 |
|
| 3898 |
@vindex TEXMFLOG |
| 3899 |
To do this, define the environment or config file variable |
| 3900 |
@code{TEXMFLOG}. The value is the name of the file to append the |
| 3901 |
information to. The file is created if it doesn't exist, and appended |
| 3902 |
to if it does. |
| 3903 |
|
| 3904 |
@cindex epoch, seconds since |
| 3905 |
@findex time @r{system call} |
| 3906 |
Each successful search turns into one line in the log file: two words |
| 3907 |
separated by a space. The first word is the time of the search, as the |
| 3908 |
integer number of seconds since ``the epoch'', i.e., UTC midnight 1 |
| 3909 |
January 1970 (more precisely, the result of the @code{time} system |
| 3910 |
call). The second word is the filename. |
| 3911 |
|
| 3912 |
For example, after @code{setenv TEXMFLOG /tmp/log}, running Dvips on |
| 3913 |
@file{story.dvi} appends the following lines: |
| 3914 |
|
| 3915 |
@example |
| 3916 |
774455887 /usr/local/share/texmf/dvips/config.ps |
| 3917 |
774455887 /usr/local/share/texmf/dvips/psfonts.map |
| 3918 |
774455888 /usr/local/share/texmf/dvips/texc.pro |
| 3919 |
774455888 /usr/local/share/texmf/fonts/pk/ljfour/public/cm/cmbx10.600pk |
| 3920 |
774455889 /usr/local/share/texmf/fonts/pk/ljfour/public/cm/cmsl10.600pk |
| 3921 |
774455889 /usr/local/share/texmf/fonts/pk/ljfour/public/cm/cmr10.600pk |
| 3922 |
774455889 /usr/local/share/texmf/dvips/texc.pro |
| 3923 |
@end example |
| 3924 |
|
| 3925 |
@cindex privacy, semblance of |
| 3926 |
@noindent Only filenames that are absolute are recorded, to preserve |
| 3927 |
some semblance of privacy. |
| 3928 |
|
| 3929 |
In addition to this Kpathsea-specific logging, @command{pdftex} |
| 3930 |
provides an option @option{-recorder} to write the names of all files |
| 3931 |
accessed during a run to the file @file{@var{basefile}.fls}. |
| 3932 |
|
| 3933 |
Finally, most systems provide a general tool to output each system |
| 3934 |
call, thus including opening and closing files. It might be named |
| 3935 |
@command{strace}, @command{truss}, @command{struss}, or something |
| 3936 |
else. |
| 3937 |
|
| 3938 |
|
| 3939 |
@node Common problems |
| 3940 |
@section Common problems |
| 3941 |
|
| 3942 |
@cindex common problems |
| 3943 |
@cindex problems, common |
| 3944 |
@cindex FAQ, Kpathsea |
| 3945 |
|
| 3946 |
Here are some common problems with configuration, compilation, linking, |
| 3947 |
execution, @dots{} |
| 3948 |
|
| 3949 |
@menu |
| 3950 |
* Unable to find files:: If your program can't find fonts (or whatever). |
| 3951 |
* Slow path searching:: If it takes forever to find anything. |
| 3952 |
* Unable to generate fonts:: If mktexpk fails. |
| 3953 |
* TeX or Metafont failing:: Likely compiler bugs. |
| 3954 |
@end menu |
| 3955 |
|
| 3956 |
@node Unable to find files |
| 3957 |
@subsection Unable to find files |
| 3958 |
|
| 3959 |
@cindex unable to find files |
| 3960 |
@cindex files, unable to find |
| 3961 |
|
| 3962 |
If a program complains it cannot find fonts (or other input files), any |
| 3963 |
of several things might be wrong. In any case, you may find the |
| 3964 |
debugging options helpful. @xref{Debugging}. |
| 3965 |
|
| 3966 |
@itemize @bullet |
| 3967 |
@item |
| 3968 |
Perhaps you simply haven't installed all the necessary files; the basic |
| 3969 |
fonts and input files are distributed separately from the programs. |
| 3970 |
@xref{unixtex.ftp}. |
| 3971 |
|
| 3972 |
@item |
| 3973 |
@flindex /etc/profile |
| 3974 |
@cindex environment variables, old |
| 3975 |
You have (perhaps unknowingly) told Kpathsea to use search paths that |
| 3976 |
don't reflect where the files actually are. One common cause is having |
| 3977 |
environment variables set from a previous installation, thus overriding |
| 3978 |
what you carefully set in @file{texmf.cnf} (@pxref{Supported file |
| 3979 |
formats}). System @file{/etc/profile} or other files such may be the |
| 3980 |
culprit. |
| 3981 |
|
| 3982 |
@item |
| 3983 |
@cindex symbolic links not found |
| 3984 |
@cindex leaf directories wrongly guessed |
| 3985 |
Your files reside in a directory that is only pointed to via a symbolic |
| 3986 |
link within a leaf directory, and is not listed in @file{ls-R}. |
| 3987 |
|
| 3988 |
Unfortunately, Kpathsea's subdirectory searching has a problematic |
| 3989 |
deficiency: If a directory @var{d} being searched for subdirectories |
| 3990 |
contains symbolic links to other directories (and possibly other plain |
| 3991 |
files or symlinks), but no true subdirectories, by default @var{d} |
| 3992 |
will be considered a leaf directory, i.e., the symbolic links will not |
| 3993 |
be followed. @xref{Subdirectory expansion}. |
| 3994 |
|
| 3995 |
You can work around this problem by creating an empty dummy subdirectory |
| 3996 |
in @var{d}. Then @var{d} will no longer be a leaf, and the symlinks will |
| 3997 |
be followed. |
| 3998 |
|
| 3999 |
Another workaround is to set the configuration variable |
| 4000 |
@code{kpse_ignore_nlink_for_leaf} to 1. Then Kpathsea will look at |
| 4001 |
all entries in all directories in determining whether they are |
| 4002 |
(symlinks to) subdirectories. This is not the default because it is |
| 4003 |
considerably expensive to consider the contents of every leaf directory. |
| 4004 |
|
| 4005 |
The directory immediately followed by the @samp{//} in the path |
| 4006 |
specification is always searched for subdirectories, even if it is a |
| 4007 |
leaf. Presumably you would not have asked for the directory to be |
| 4008 |
searched for subdirectories if you didn't want it to be. |
| 4009 |
|
| 4010 |
@item |
| 4011 |
If the fonts (or whatever) don't already exist, @code{mktexpk} (or |
| 4012 |
@code{mktexmf} or @code{mktextfm}) will try to create them. If |
| 4013 |
these rather complicated shell scripts fail, you'll eventually get an |
| 4014 |
error message saying something like @samp{Can't find font |
| 4015 |
@var{fontname}}. The best solution is to fix (or at least report) the |
| 4016 |
bug in @code{mktexpk}; the workaround is to generate the necessary |
| 4017 |
fonts by hand with Metafont, or to grab them from a CTAN site |
| 4018 |
(@pxref{unixtex.ftp}). |
| 4019 |
|
| 4020 |
@item |
| 4021 |
There is a bug in the library. @xref{Reporting bugs}. |
| 4022 |
@end itemize |
| 4023 |
|
| 4024 |
|
| 4025 |
@node Slow path searching |
| 4026 |
@subsection Slow path searching |
| 4027 |
|
| 4028 |
@cindex excessive startup time |
| 4029 |
@cindex slow startup time |
| 4030 |
@cindex startup time, excessive |
| 4031 |
|
| 4032 |
If your program takes an excessively long time to find fonts or other |
| 4033 |
input files, but does eventually succeed, here are some possible culprits: |
| 4034 |
|
| 4035 |
@itemize @bullet |
| 4036 |
@item |
| 4037 |
Most likely, you just have a lot of directories to search, and that |
| 4038 |
takes a noticeable time. The solution is to create and maintain a |
| 4039 |
separate @file{ls-R} file that lists all the files in your main @TeX{} |
| 4040 |
hierarchy. @xref{Filename database}. Kpathsea always uses @file{ls-R} |
| 4041 |
if it's present; there's no need to recompile or reconfigure any of the |
| 4042 |
programs. |
| 4043 |
|
| 4044 |
@item |
| 4045 |
Your recursively-searched directories (e.g., |
| 4046 |
@file{/usr/local/share/texmf/fonts//}), contain a mixture of files and |
| 4047 |
directories. This prevents Kpathsea from using a useful optimization |
| 4048 |
(@pxref{Subdirectory expansion}). |
| 4049 |
|
| 4050 |
It is best to have only directories (and perhaps a @file{README}) in the |
| 4051 |
upper levels of the directory structure, and it's very important to have |
| 4052 |
@emph{only} files, and no subdirectories, in the leaf directories where |
| 4053 |
the dozens of TFM, PK, or whatever files reside. |
| 4054 |
@end itemize |
| 4055 |
|
| 4056 |
In any case, you may find the debugging options helpful in determining |
| 4057 |
precisely when the disk or network is being pounded. @xref{Debugging}. |
| 4058 |
|
| 4059 |
|
| 4060 |
@node Unable to generate fonts |
| 4061 |
@subsection Unable to generate fonts |
| 4062 |
|
| 4063 |
@cindex unable to generate fonts |
| 4064 |
@cindex font generation failures |
| 4065 |
|
| 4066 |
Metafont outputs fonts in bitmap format, tuned for a particular |
| 4067 |
device at a particular resolution, in order to allow for the |
| 4068 |
highest-possible quality of output. Some DVI-to-whatever programs, |
| 4069 |
such as Dvips, try to generate these on the fly when they are needed, |
| 4070 |
but this generation may fail in several cases. |
| 4071 |
|
| 4072 |
@cindex @code{mktexpk} can't guess mode |
| 4073 |
If @code{mktexpk} runs, but fails with this error: |
| 4074 |
@example |
| 4075 |
mktexpk: Can't guess mode for @var{nnn} dpi devices. |
| 4076 |
mktexpk: Use a config file to specify the mode, or update me. |
| 4077 |
@end example |
| 4078 |
you need to ensure the resolution and mode match; just |
| 4079 |
specifying the resolution, as in @code{-D 360}, is not enough. |
| 4080 |
|
| 4081 |
You can specify the mode name with the @code{-mode} option on the |
| 4082 |
Dvips command line, or in a Dvips configuration file (@pxref{Config |
| 4083 |
files,,, dvips, Dvips}), such as @file{config.ps} in your document |
| 4084 |
directory, @file{~/.dvipsrc} in your home directory, or in a system |
| 4085 |
directory (again named @file{config.ps}). (Other drivers use other |
| 4086 |
files, naturally.) |
| 4087 |
|
| 4088 |
For example, if you need 360@dmn{dpi} fonts, you could include this in |
| 4089 |
a configuration file: |
| 4090 |
@example |
| 4091 |
D 360 |
| 4092 |
M lqmed |
| 4093 |
@end example |
| 4094 |
|
| 4095 |
@cindex Metafont using the wrong device |
| 4096 |
@cindex device, wrong |
| 4097 |
If Metafont runs, but generates fonts at the wrong resolution or for |
| 4098 |
the wrong device, most likely @code{mktexpk}'s built-in guess for the |
| 4099 |
mode is wrong, and you should override it as above. |
| 4100 |
|
| 4101 |
See @url{https://ctan.org/pkg/modes} for a list of resolutions and mode |
| 4102 |
names for most devices (additional submissions are welcome). |
| 4103 |
|
| 4104 |
@flindex .2602gf |
| 4105 |
@flindex 2602gf |
| 4106 |
@cindex Metafont making too-large fonts |
| 4107 |
@cindex proof mode |
| 4108 |
@cindex online Metafont display, spurious |
| 4109 |
If Metafont runs but generates fonts at a resolution of 2602@dmn{dpi} |
| 4110 |
(and prints out the name of each character as well as just a character |
| 4111 |
number, and maybe tries to display the characters), then your Metafont |
| 4112 |
base file probably hasn't been made properly. (It's using the default |
| 4113 |
@code{proof} mode, instead of an actual device mode.) To make a proper |
| 4114 |
@file{plain.base}, assuming the local mode definitions are contained in |
| 4115 |
a file @file{modes.mf}, run the following command (assuming Unix): |
| 4116 |
|
| 4117 |
@example |
| 4118 |
inimf "plain; input modes; dump" |
| 4119 |
@end example |
| 4120 |
|
| 4121 |
@noindent |
| 4122 |
@flindex plain.base |
| 4123 |
Then copy the @file{plain.base} file from the current directory to where |
| 4124 |
the base files are stored on your system |
| 4125 |
(@file{/usr/local/share/texmf/web2c} by default), and make a link |
| 4126 |
(either hard or soft) from @file{plain.base} to @file{mf.base} in that |
| 4127 |
directory. |
| 4128 |
@xref{inimf invocation,,, web2c, Web2c}. |
| 4129 |
|
| 4130 |
@cindex Metafont installation |
| 4131 |
If @code{mf} is a command not found at all by @code{mktexpk}, then you |
| 4132 |
need to install Metafont (@pxref{unixtex.ftp}). |
| 4133 |
|
| 4134 |
|
| 4135 |
@node TeX or Metafont failing |
| 4136 |
@subsection @TeX{} or Metafont failing |
| 4137 |
|
| 4138 |
@cindex @TeX{} failures |
| 4139 |
@cindex Metafont failures |
| 4140 |
@cindex compiler bugs |
| 4141 |
If @TeX{} or Metafont get a segmentation fault or otherwise fail while |
| 4142 |
running a normal input file, the problem is usually a compiler bug |
| 4143 |
(unlikely as that may sound). Even if the trip and trap tests are |
| 4144 |
passed, problems may lurk. Optimization occasionally causes trouble in |
| 4145 |
programs other than @TeX{} and Metafont themselves, too. |
| 4146 |
|
| 4147 |
@cindex optimization caveat |
| 4148 |
For a workaround, if you enabled any optimization flags, it's best to |
| 4149 |
omit optimization entirely. In any case, the way to find the facts is |
| 4150 |
to run the program under the debugger and see where it's failing. |
| 4151 |
|
| 4152 |
@cindex GNU C compiler bugs |
| 4153 |
@cindex system C compiler bugs |
| 4154 |
Also, if you have trouble with a system C compiler, I advise trying the |
| 4155 |
GNU C compiler. And vice versa, unfortunately; but in that case I also |
| 4156 |
recommend reporting a bug to the GCC mailing list; see @ref{Bugs,,, gcc, |
| 4157 |
Using and Porting GNU CC}. |
| 4158 |
|
| 4159 |
@cindex compiler bugs, finding |
| 4160 |
To report compiler bugs effectively requires perseverance and |
| 4161 |
perspicacity: you must find the miscompiled line, and that usually |
| 4162 |
involves delving backwards in time from the point of error, checking |
| 4163 |
through @TeX{}'s (or whatever program's) data structures. Good luck. |
| 4164 |
|
| 4165 |
|
| 4166 |
@node Index |
| 4167 |
@unnumbered Index |
| 4168 |
|
| 4169 |
@printindex cp |
| 4170 |
|
| 4171 |
@bye |