summaryrefslogtreecommitdiff
path: root/Master/texmf-doc/doc/english/FAQ-en/html/FAQ-instpackages.html
blob: 98112a4fc4ceeefd2bc24e9c33f51b39d919c680 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<head>
<title>UK TeX FAQ -- question label instpackages</title>
</head><body>
<h3>Installing a new package</h3>
<p>The first step in installing a new package for your LaTeX system
is usually to <a href="FAQ-findfiles.html">find where it is</a>
and then to get it, usually from CTAN.  However MiKTeX,
since version 2.1, offers a <a href="FAQ-miktexinst.html">simpler procedure</a>
than that described here, for packages it knows about. 
<p>Ordinarily, you should download the whole distribution directory; the
only occasion when this is not necessary is when you are getting
something from one of the (La)TeX contributed "<i>misc</i>"
directories on CTAN; these directories contain collections of
single files, which are supposedly complete in themselves.
<p>A small package &lt;<i>smallpack</i>&gt; might be just a single <code>.sty</code> file
(typically <i>smallpack.sty</i>) with the usage instructions either
included as comments in the file or in a seperate user manual or
<i>README</i> file.  More often a package &lt;<i>pack</i>&gt; will come as
a pair of files, <i>pack.ins</i> and <i>pack.dtx</i>, written to be
used with the LaTeX <i>doc</i> system.  The package code must be
extracted from these files.  If there is a <i>README</i> file as part
of the package distribution, read it!
<p>In the <i>doc</i> system, the user manual and documented package
code is in the <code>.dtx</code> file, and the <code>.ins</code> file contains LaTeX
instructions on what code should be extracted from the <code>.dtx</code> file. To
unpack a <i>doc</i> package &lt;<i>pack</i>&gt;, do the following:
<ul>
<li> Run latex on <i>pack.ins</i>. This will generate one or more
  files (normally a <i>pack.sty</i> file but there may be others
  depending on the particular package).
<li> Run latex on <i>pack.dtx</i> as a start to getting the user
  manual and possibly a commented version of the package code.
<li> Run latex again on <i>pack.dtx</i>, which should resolve any
  references and generate a Table of Contents if it was called for.
<li> LaTeX may have said "<code>No file pack.ind</code>"; this is the
  source for the command index; if you want the index, process the raw
  material with:<br>
  <code>  makeindex -s gind.ist pack</code><br>
  and run LaTeX again.
<li> Print and read <i>pack.dvi</i>
</ul>
Sometimes a user manual is supplied seperately from the <i>.dtx</i>
file. Process this <em>after</em> doing the above, just in case the user
manual uses the package it is describing.
<p>Almost the final stage of the installation is to put the package
file(s) <em>'where LaTeX can find them'</em>. Where the magic place
is, and how you put the files there depends on your particular
LaTeX system and how it is set up (see

<a href="FAQ-tds.html">the TeX directory structure standard</a> for
general principles,
<a href="FAQ-wherefiles.html">where to put files</a> for specific advice).
<p>The final stage is to tell LaTeX that there is a new file, or
files, that it should be able to go and find. Most free LaTeX systems
maintain a database of the names and locations of latex-related files
to enable faster searching.  In these systems the database must be
updated, using the script or program provided with the distribution
for this purpose.
<dl>
<dt>teTeX<dd> Run: <br>
   <code>texhash</code> 
<dt>web2c<dd> On a current <i>web2c</i> distribution, <code>texhash</code>
   ought to work; if it doesn't, run <code>mktexlsr</code>
 <dt>fpTeX<dd> Click
  <code>Start</code>-&gt; 
  <code>Programs</code>-&gt; 
  <code>Texlive</code>-&gt; 
  <code>Maintenance</code>-&gt; 
  <code>Rebuild ls-R filenames databases</code>, or open a "command"
  window and run <code>texhash</code>
<dt>MiKTeX<dd> On a <i>MikTeX</i> distribution earlier than v2.0,
  click 
  <code>Start</code>-&gt; 
  <code>Programs</code>-&gt; 
  <code>MikTeX</code>-&gt; 
  <code>Maintenance</code>-&gt; 
  <code>Refresh filename database</code>


<p>  or get a DOS window and run:<br>
  <code>initexmf --update-fndb</code>
<p>  On a <i>MikTeX</i> distribution v2.0 or later, do:<br>
  <code>Start</code>-&gt; 
  <code>Programs</code>-&gt; 
  <code>MikTeX 2</code>-&gt; 
  <code>MikTeX Options</code>, and press the
  
  <code>Refresh now</code> button (<code>Update filename database</code> in
  earlier versions of MiKTeX).
</dl>
<p>Remember that a <code>\usepackage{pack}</code> command must be put in the preamble
of each document in which you want to use the <i>pack</i> package.
<p><p>This question on the Web: <a href="http://www.tex.ac.uk/cgi-bin/texfaq2html?label=instpackages">http://www.tex.ac.uk/cgi-bin/texfaq2html?label=instpackages</a>
</body>