LaTeX/Instalarea de pachete adiționale

De la Wikimanuale, o colecţie de manuale libere !


Cele mai multe distribuții LaTeX au o serie de pachete de stiluri pre-instalate, însă puteți găsi multe altele pe net. Cel mai bun loc să căutați pachete pentru stiluri pe Internet este CTAN (http://www.ctan.org/). Îndată ce ați identificat un pachet de care aveți nevoie și pe care nu-l aveți deja (sau îl aveți, dar vă trebuie o versiune mai nouă), folosiți indexurile de pe orice server CTAN pentru a găsi pachetul necesar și directorul de unde puteți să-l luați.

Dacă sunteți pe un sistem Linux (cum este Debian), puteți instala pachetele prin intermediul unui manager de pachete (de genul Synaptic).

Descărcarea de pachete[modificare]

Trebuie să luați întotdeauna două fișiere, unul cu extensia .dtx și celălalt cu extensia .ins. Primul este un fișier DOCTeX, care combină programul pentru pachet și documentația acestuia într-un singur fișier. Al doilea este scriptul de instalare (mult mai mic). Trebuie să faceți download întotdeauna la ambele fișiere. Dacă cele două fișiere nu sunt acolo, poate să însemne unul din următoarele două lucruri:

  • Fie pachetul face parte dintr-un grup mult mai mare, pe care în mod normal nu ar trebui să-l aduceți la zi decât dacă schimbați versiunea de LaTeX;
  • fie este unul din puținele și neobișnuitele pachete care încă mai sunt furnizate sub forma unui singur fișier .sty menit pentru versiunea de acum învechită de LaTeX 2.09.

Descărcați ambele fișiere într-un director temporar. Deseori veți găsi un fișier readme.txt cu o scurtă descriere a pachetului. Evident, ar fi bine să citiți mai întâi acest fișier.

Installing a package[modificare]

There are four steps to installing a LaTeX package:

1. Extract the files Run LaTeX on the .ins file. That is, open the file in your editor and process it as if it were a LaTeX document (which it is), or if you prefer, type latex followed by the .ins filename in a command window in your temporary directory. This will extract all the files needed from the .dtx file (which is why you must have both of them present in the temporary directory). Note down or print the names of the files created if there are a lot of them (read the log file if you want to see their names again).

2. Create the documentation Run LaTeX on the .dtx file. You might need to run it twice or more, to get the cross-references right (just like any other LaTeX document). This will create a .dvi file of documentation explaining what the package is for and how to use it. If you prefer to create PDF then run pdfLaTeX instead. If you created a .idx as well, it means that the document contains an index, too. If you want the index to be created properly, follow the steps in the indexing section. Sometimes you will see that a .glo (glossary) file has been produced. Run the following command instead:

makeindex -s gglo.ist -o name.gls name.glo

3. Install the files While the documentation is printing, move or copy the files created in step 1 from your temporary directory to the right place[s] in your TeX local installation directory tree - always your 'local' directory tree, a) to prevent your new package accidentally overwriting files in the main TeX directories; and b) to avoid your newly-installed files being overwritten when you next update your version of TeX. The "right place" sometimes causes confusion, especially if your TeX installation is old or does not conform to the TeX Directory Structure. For a TDS-conformant system, this is either a) for LaTeX packages, a suitably-named subdirectory of texmf-local/tex/latex/; or b) a suitably-named sub-directory of texmf-local/ for files like BIBTeX styles which are not just for LaTeX but can be used in other TeX systems. "Suitably-named" means sensible and meaningful (and probably short). For a package like paralist, for example, I'd call the directory paralist. Often there is just a .sty file to move but in the case of complex packages there may be more, and they may belong in different locations. For example, new BibTeX packages or font packages will typically have several files to install. This is why it is a good idea to create a sub-directory for the package rather than dump the files into misc along with other unrelated stuff. If there are configuration or other files, read the documentation to find out if there is a special or preferred location to move them to.

For expample: MiKTeX 2.7 ot later (in Windows enviroment), you will find the directory to be in Program Files/MiKTeX 2.7 (the exact name of folder varies with the version of MiKTeX installed). According to the tabel you'll find lower on this page, move the files into appropriate folders of the MiKTeX file directory (create new folders in directories, if needed).


Where to put files from packages
Type Directory (under texmf-local/) Description
.cls tex/latex/base Document class file
.sty tex/latex/packagename Style file: the normal package content
.bst bibtex/bst/packagename BibTeX style
.mf fonts/source/public/typeface METAFONT outline
.fd tex/latex/mfnfss Font Definition files for METAFONT fonts
.fd tex/latex/psnfss Font Definition files for PostScript Type 1 fonts
.pfb /fonts/type1/foundry/typeface PostScript Type 1 outline
.afm /fonts/afm/foundry/typeface Adobe Font Metrics for Type 1 fonts
.tfm /fonts/tfm/foundry/typeface TeX Font Metrics for METAFONT and Type 1 fonts
.vf /fonts/vf/foundry/typeface TeX virtual fonts
.dvi /doc package documentation
.pdf /doc package documentation
others tex/latex/packagename other types of file unless instructed otherwise

4. Update your index Finally, run your TeX indexer program to update the package database. This program comes with every modern version of TeX and is variously called depending on the LaTeX distribution you use (Read the documentation that came with your installation to find out which it is):

  • teTeX, TeX Live, fpTeX: texhash
  • web2c: mktexlsr
  • MikTeX: initexmf --update-fndb (or use the GUI)
  • MiKTeX 2.7 ot later versions, installed on Widows XP or later versions of Windows: Start -> All Programs -> MikTex -> Settings. In Settings menu choose the first tab and click on Refresh FNDB-button (MikTex will then check the Program Files directory and update the list of File Name DataBase). After that just verify by clicking 'OK'.
This last step is utterly essential, otherwise nothing will work.

The reason this process has not been automated widely is that there are still thousands of installations which do not conform to the TDS, such as old shared Unix systems and some Microsoft Windows systems, so there is no way for an installation program to guess where to put the files: you have to know this. There are also systems where the owner, user, or installer has chosen not to follow the recommended TDS directory structure, or is unable to do so for political or security reasons (such as a shared system where she cannot write to a protected directory). The reason for having the texmf-local directory (called texmf.local on some systems) is to provide a place for local modifications or personal updates, especially if you are a user on a shared or managed system (Unix, Linux, VMS, Windows NT/2000/XP, etc.) where you may not have write-access to the main TeX installation directory tree. You can also have a personal texmf subdirectory in your own login directory. Your installation must be configured to look in these directories first, however, so that any updates to standard packages will be found there before the superseded copies in the main texmf tree. All modern TeX installations should do this anyway, but if not, you can edit texmf/web2c/texmf.cnf yourself.


Where to put files from packages
Type Directory (under texmf-local/) Description
.cls tex/latex/base Document class file
.sty tex/latex/packagename Style file: the normal package content
.bst bibtex/bst/packagename BibTeX style
.mf fonts/source/public/typeface METAFONT outline
.fd tex/latex/mfnfss Font Definition files for METAFONT fonts
.fd tex/latex/psnfss Font Definition files for PostScript Type 1 fonts
.pfb /fonts/type1/foundry/typeface PostScript Type 1 outline
.afm /fonts/afm/foundry/typeface Adobe Font Metrics for Type 1 fonts
.tfm /fonts/tfm/foundry/typeface TeX Font Metrics for METAFONT and Type 1 fonts
.vf /fonts/vf/foundry/typeface TeX virtual fonts
.dvi /doc package documentation
.pdf /doc package documentation
others tex/latex/packagename other types of file unless instructed otherwise


Anterior: Pachete LaTeX Următor: Pachete individuale