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/)?

  • 2
    With a recent TeX Live, you don't need to texhash ~/texmf/
    – Joseph Wright
    Oct 3, 2011 at 5:59

3 Answers 3


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.


Short answer: no.

Slightly longer answer: If your package is on this list, kind of. The tds.zip files already have the structure of the TeX Directory Structure built in, so when you unzip it in the root of your texmf tree, all the files go in the right places. So if you download that zip file, then it should work.

  • Note that there are other directories with TDS ZIP files on CTAN, e.g. PGF related packages are not in macros/latex/contrib but somewhere below graphics/... The package entry should link to the TDS ZIP file for the package. Oct 3, 2011 at 7:56
  • Ah yes, for more on this issue, see this question: tex.stackexchange.com/questions/24636/…
    – Seamus
    Oct 3, 2011 at 10:48

Based on @Martin Scharrer answer I made script that first tries to install from CTAN tds archive, than from texlive archive and if everything fails it will try to ctanify.

Example execution: ./script.sh makecell

#!/usr/bin/env bash

if wget http://mirrors.ctan.org/install/macros/latex/contrib/$1.tds.zip ; then
    unzip -d $texmf_dir $1.tds.zip
    rm $1.tds.zip
    echo installed via tds
elif wget ftp://sunsite.icm.edu.pl/pub/CTAN/systems/texlive/tlnet/archive/$1.tar.xz ; then
    tar -xf $1.tar.xz -C $texmf_dir
    rm $1.tar.xz
    echo installed from texlive archive  
    wget http://mirror.ctan.org/macros/latex/contrib/$1.zip
    unzip $1.zip
    cd $1/
    tex $1.ins
    ctanify *.ins *.dtx
    tar -xzf $1.tar.gz
    unzip -d $texmf_dir $1.tds.zip
    cd ..
    rm -rf $1 $1.zip
    echo "installed via *.ins *.dtx"
test -e ~/texmf/ls-R && texhash $texmf_dir

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .