# [Tex/LaTex] How to install LaTeX .zip package (from CTAN) using texhash on a ‘nix system

installingpackages

Is there an automated script which places files in the relevant directory tree in ~/texmf/ and is that all that is required to install a package (in addition to calling texhash on ~/texmf/)?

Only some packages on CTAN come also in so called TDS ZIP files which already hold the required directory structure so that you only need to unzip them over your $TEXMF tree (e.g. ~/texmf). If the package author didn't uploaded a TDS ZIP file it most likely isn't on CTAN. To my knowledge there is no direct script available which turns a CTAN package into the required TDS structure and installs it directly. (The TeXLive developers should have something like that to build the TeXLive package files.) I was thinking writing such a script recently. So far I wrote a Makefile which does it for most LaTeX packages, but currently it is ydoc specific, i.e. for my packages only. However, you could download the whole CTAN directory for a package as a flat ZIP file, unpack it and then use the ctanify script on the directory. It is intended to create an upload ZIP file for CTAN which also includes a TDS ZIP file. You then can use this TDS ZIP file and unpack it over your TEXMF tree. I just tested this using colortbl as a random example. The steps are as follows and could be turned into a script easily. Simple add #!/bin/sh as first line and replace colortbl with $1 and call it using yourscriptname <name of package>. However, most but not all LaTeX package are located in /macro/latex/contrib, so for the others you would need to provide the download link somehow.

cd /tmp
wget http://mirror.ctan.org/macros/latex/contrib/colortbl.zip
unzip colortbl.zip
cd colortbl/
tex colortbl.ins
ctanify *.ins *.dtx
tar -xzf colortbl.tar.gz
unzip -d ~/texmf colortbl.tds.zip
test -e ~/texmf/ls-R && texhash ~/texmf


Note that you only need to run texhash for the per-user TEXMF directory if the ls-R file already exists. Modern TeXLive installation search it automatically every run if the ls-R file doesn't exists.