Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install a package in LaTeX

I'm fairly new to LaTeX, but have been using my own document template for a couple of years now to do basic typesetting. What I want to do is to add the pst-gantt package from PSTricks.

I have never installed a new package before, but want it available to all of my projects. For the sake of completeness, I am running OSX10.6 and use TeXShop to edit text, however am slowly switching over to TextEdit.

Anyway, I have googled and the results all say to use .dtx and .ins files (which I cannot find). If someone can give me some pointers as to what I need to install (do I need PSTricks first?) and how to go about doing it, that would be great.

Thanks

like image 999
Jack Avatar asked Jan 23 '23 03:01

Jack


2 Answers

If you're using MacTeX 2008, pop open your terminal and type:

sudo tlmgr install package-name

the package will be installed. If you have perl/TK installed, open your terminal and type:

sudo tlmgr --gui

There is also a native mac package manager for MacTeX that can be had from their website.

like image 167
Mica Avatar answered Feb 12 '23 03:02

Mica


The first thing to do would be to check if your distribution doesn't already provide a way to add the package to your TeX installation. You didn't say which distribution you used (MacTeX ? TeX Live ?) and that's actually the most important part. The editor you use for typing source files is unrelated, it's only the front-end to the actual TeX binaries and files.

To answer your second question, you do need core PSTricks macros in order to use any PSTricks-related package, so do that first; all the major distributions ship PSTricks, so first try to figure out how to install it (and maybe it's there already). There really should be a way to do so, so only try the steps in the next paragraphs if all else fails.

If installation is not possible via graphical applications shipped with your TeX distribution, you may have to install the files by hand. I outline the process briefly here, but you can read the manual for "kpathsea" for more information (it's the library through which TeX and related programs find files). First identify the main directory where your TeX files resides; it's usually called texmf-[something]. In TeX Live it's /usr/local/texlive/[year]/texmf-dist by default; in MacTeX it should be somewhere under /Library/TeX/Distributions.

From there, look for a directory called texmf-local (or texmf.local, etc.); that's where you should drop the files; more precisely in texmf-local/tex/latex/pst-gantt. Then run "texhash" from the command line in Terminal, and you should be done. The latter command may not be in your PATH environment variable, so you may have to set up this first.

Hope this helps.

Oh, and you don't need .dtx and .ins; they're just a LaTeXy way of packing all the files together for upstream distribution; what you really need is the .sty file, as well as, obviously, docs.

like image 27
Arthur Reutenauer Avatar answered Feb 12 '23 03:02

Arthur Reutenauer