# How to install a current version of TikZ?

TikZ is undergoing lots of development with new features being added, but the versions distributed with standard TeX releases are often a little old. How do I get the latest version? If I want to be sure that I get the latest stable version, how do I do that?

Note: I'm not asking this question for myself, but because a question like this seems to be useful for pointing to it when a new feature of TikZ is mentioned in an answer to some other question. Feel free to post answers for any operating system/TeX distribution combination.

-
I was about to complain about a broken link since the only link is to the main page on texample and not to a specific picture! Then I realised that it wasn't a real question. I think this is a very good thing to have on this site, but I'm not convinced by the "fake question" style. Why not simply, "TikZ is undergoing lots of development with new features being added, but the versions distributed with standard TeX releases are often a little old. How do I get the latest version? If I want to be sure that I get the latest stable version, how do I do that?" –  Andrew Stacey Aug 19 '10 at 15:01
@Andrew: you are right. I changed the text. Feel free to add further changes. –  Caramdir Aug 19 '10 at 16:40
I just noticed that the accepted answer is not topped -- presumably because questioner and respondent are identical. I have added a copy of your answer (CWed) and suggest you accept my answer instead. –  lockstep Feb 25 '11 at 21:57
@lockstep: thanks –  Caramdir Feb 25 '11 at 21:59

Unless you want to use a development version of TikZ or are stuck with an old TeX distribution, do not manually install TikZ. Simply updating your TeX distribution should give you the newest stable release of TikZ, see How do I update my TeX distribution?

Of course, if you want to get a development version, follow the appropriate answer here.

-

The tikz offical update cycle is rather slow. However, development goes on and the latest build can be found here (tikz builds). The build has to be installed manually, but comes in the correct tex-tree-structure already.

For Windows users who use MikTeX, it is advisable to create a local-tree to install packages which are not available in the MkTeX package browser.

2. Create a new folder e.g C:\LocalTexFiles
3. Copy the downloaded zip-file in this folder and unpack it You should now have two new folders in C:\LocalTexFiles, namely 'tex' and 'doc'
4. Go to Start->Program Files->MikTeX2.x->Settings (Administrator)
5. In the settings window click the Root tab, click Add and browse to C:\LocalTexFiles and select it, confirm by clicking OK
6. MikTeX should now automatically execute texhash and the local tree is from now on the first to be searched by MikTeX
7. If you want to confirm that the latest version is used, create a document with \usepackage{tikz} and add the \listfiles command before the \documentclass command. The log file will then show a file list with dates
-
I looked up the link you gave, but I don't see any "Latest stable build" like the one they have at sourceforge. Is there a way of making sure that I get the latest stable build? –  Kit Sep 11 '10 at 12:54
Note that this is still serving version 2.10, so isn't the latest version any more - it may be late enough for many applications. –  Chris H Feb 18 at 14:50

# Simple way: via SourceForge

The current CVS version of TikZ/PGF is now available on sourceforge.

The .tds.zip archive should be unpacked in the root directory of a TDS tree (like ~/texmf for example).

# Complex way: create your own TDS archive from sourceforge source code via CVS

## 1. Get the current version from sourceforge via CVS

cvs -d:pserver:anonymous@pgf.cvs.sourceforge.net:/cvsroot/pgf login
cvs -z3 -d:pserver:anonymous@pgf.cvs.sourceforge.net:/cvsroot/pgf co -P pgf

• first command request a password: you can type Enter (to use an empty password).
• after using these two commands, you get a pgf subdirectory with latest files.

## 2. Create a script to compile pgfmanual and make the TDS archive

#!/bin/sh
# update from sourceforge via CVS
cd pgf; cvs update -d; cd ..
# compile pgfmanual via lualatex
cd pgf/doc/generic/pgf/version-for-luatex/en
LUAINPUTS=".:../../../../..//:" TEXINPUTS=".:../../../../..//:" make
LUAINPUTS=".:../../../../..//:" TEXINPUTS=".:../../../../..//:" make dist
LUAINPUTS=".:../../../../..//:" TEXINPUTS=".:../../../../..//:" make dist
cd ../../../../../..
# create TDS archive
make -f pgf/scripts/pgf/Makefile.pgf_release
cp pgf/doc/generic/pgf/ChangeLog pgf_CVS.ChangeLog


Put the above script in a file named make-distrib-lua.sh and change file mode bits to allow execution (chmod a+x make-distrib-lua.sh).

After these two steps, you have the make-distrib-lua.sh script and the pgf subdirectory in the same location.

## 3. Make your TDS archive

Launch the script above to compile pgfmanual and make your own TDS archive:

./make-distrib-lua.sh

This script:

• compile the pgfmanual via lualatex.
• make the TDS archive
• copy the ChangeLog file

With a good computer, the complete operation takes about fifteen minutes and you get three files:

1. pgf_CVS.tds.zip (the TDS archive)
2. pgf_CVS.pdf (the pgfmanual)
3. pgf_CVS.ChangeLog (the ChangeLog file)

Important: At each update, only the third step must be done !

-
When I try to follow your steps, I get an error message:  (../../text-en/pgfmanual-en-tutorial-nodes.tex ! Undefined control sequence. \tikz@p@c@s@group #1^^@-\iftikz@handle@active@node \expandafter \def \expandaf... l.41 ... (w1) {}; –  A.Ellett Jun 25 '13 at 4:15
@A.Ellett This is a CVS version. It is sometimes unstable... Today, I get the same error as you. –  Paul Gaborit Jun 25 '13 at 6:58
@PaulGaborit That's what I will do. (b.t.w I deleted the ancient comments to not make this place look like reddit) –  user42341 Jan 20 at 17:30

There are fairly good installation instruction in the pgf manual, however, there seems to be few small discrepancies between the current (v. 2.10) manual and the reality. First, the manual mentions tarball (.tgz) file, and the recent builds seem to all be distributed as zip files, second, the recent builds all seem to contain a TDS (TeX Directory Structure) compliant trees (you can tell since the files have names like pgfCVS2010-09-28_TDS.zip, which means that a TDS compliant installation should be really easy.

I highly recommend installing the package into either a local or a personal texmf tree. That way when your package manager (whether it is a part of your operating system or your tex distribution) will not replace your major upgrade a some minor one in the future.

The usual locations of these threes are described in the pgf manual. The local tree is usually /usr/local/share/texmf/ on unix based systems (linux, bsd, maybe mac?) and C:\localtexmf\ on windows. If you do not have administrator privileges on your system, you will want to use your local tree, usually in ~/texmf/ on unix (I don't know where the location is on windows).

Now to the actual installation: download the zipped file (either current stable release from sourceforge or a development build from texample.net). Make sure the file has TDS in the name somewhere, it should be something like pgf_some_version_info.tds.zip or pgfsome_version_info_TDS.zip. Simply unzip the file into your local or personal TDS tree directory. Then run texhash, which should update the tex file database so TeX can find your new files.

I am making this a community wiki, since there are so many things other people can add or correct (different operating systems, different TeX distributions, ...)

-
On a mac the good directory is ~/Library/texmf I think now with TL2010 or MACTEX2010 run texhash is not necessary. When I want for example to try pgf 2.1 CVS, I put the files inside ~/Library/texmf ( I used only generic files and latex files) then If I want to go back at pgf 2.1, I make an archive (.zip) of the pgf folders and I put the cvs version in the trash. This is enough to compile with pgf 2.1 or pgf 2.1 cvs. It's the same way with 2.0 and 2.1 –  Alain Matthes Feb 9 '11 at 11:51

This answer is for users of PGF and Debian or Ubuntu, or other Debian derived Linux distributions.

The most recent version of PGF available in Debian and Ubuntu is 2.0, from 2008. The TeX distribution used by Debian and Ubuntu is Tex Live, currently Tex Live 2009. It turns out that making a PGF 2.10 package for Debian is easy, and works with Tex Live 2009. This method should also work with development versions. Making Debian packages as opposed to a local installation has obvious advantages, including clean upgrades and the opportunity for automated installs across large numbers of machines.

According to the Debian PGF maintainer, he will be packaging 2.10 soon. See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=606128

So, here is a recipe, assuming only a modest amount of knowledge about Debian packaging.

If you don't want to go through the recipe below, you can download the PGF binary from the following temporary location. But the recipe below is easier than it looks, honest.

http://bulldog.duhs.duke.edu/~faheem/debian/pgf_2.10-0_all.deb

1) Download the Debian sources for PGF 2.0. This assumes you have a line in /etc/apt/sources.list like

deb-src http://debian.csail.mit.edu/debian/ squeeze main non-free contrib

Then do

$apt-get source pgf This will download and unpack the pgf source directory $ apt-get source pgf
Building dependency tree
Need to get 3,770 kB of source archives.
Get:1 http://debian.csail.mit.edu/debian/ squeeze/main pgf 2.00-1 (dsc) [902 B]
Get:2 http://debian.csail.mit.edu/debian/ squeeze/main pgf 2.00-1 (tar) [3,759 kB]
Get:3 http://debian.csail.mit.edu/debian/ squeeze/main pgf 2.00-1 (diff) [10.8 kB]
Fetched 3,770 kB in 22s (170 kB/s)
dpkg-source: info: extracting pgf in pgf-2.00
dpkg-source: info: unpacking pgf_2.00.orig.tar.gz
dpkg-source: info: applying pgf_2.00-1.diff.gz


$wget -c http://sourceforge.net/projects/pgf/files/pgf/version%202.10/pgf_2.10.tds.zip/download -O pgf_2.10.tds.zip 3) Unzip the source $ mkdir pgf-2.10
$cp pgf_2.10.tds.zip pgf-2.10$ cd pgf-2.10
$unzip pgf_2.10.tds.zip$ rm pgf_2.10.tds.zip


4) Copy the debian directory from pgf-2.00

$cd ..$ cp -ar pgf-2.00/debian/ pgf-2.10/


At this point it is probably a good idea to put the files under pgf-2.10/ under version control so you can roll back if you screw up. I use and recommend mercurial.

$cd pgf-2.10/debian/ 5) Now some easy changes. Change 1: This corresponds to a reorganization of the files in PGF. Just change the following line. You need to use a tab instead of spaces here. # HG changeset patch # User Faheem Mitha <faheem@email.unc.edu> # Date 1298803034 -19800 # Node ID a0b004038f1525f2c4b9826d04624ac086df85ed # Parent 84bf199052f3b87890ece302867a0ed0eeed73b9 Changes to debian/rules diff -r 84bf199052f3 -r a0b004038f15 debian/rules --- a/debian/rules Sun Feb 27 15:43:12 2011 +0530 +++ b/debian/rules Sun Feb 27 16:07:14 2011 +0530 @@ -63,7 +63,7 @@$(DOCDIR)/pgf
#      cp -r doc/generic/pgf/version-for-tex4ht/en/* \
#              $(DOCDIR)/pgf/html/ - cp -r context generic latex plain$(TEXMF)/tex
+       cp -r tex/context tex/generic tex/latex tex/plain $(TEXMF)/tex  CHANGE 2: Change the compat level. The file debian/compat contains the number 4. Simply change it to 7. pgf-2.10/debian$ echo 7 > compat

will work

# HG changeset patch
# User Faheem Mitha <faheem@email.unc.edu>
# Date 1298803274 -19800
# Parent  302a183d556d05654c4b045ffe028ce6557cc008
Update debian/compat

diff -r 302a183d556d -r a3f351d6056a debian/compat
--- a/debian/compat     Sun Feb 27 16:08:54 2011 +0530
+++ b/debian/compat     Sun Feb 27 16:11:14 2011 +0530
@@ -1,1 +1,1 @@
-4
+7


CHANGE 3: Update the changelog.

pgf-2.10/debian$dch -i I used # HG changeset patch # User Faheem Mitha <faheem@email.unc.edu> # Date 1298803134 -19800 # Node ID 302a183d556d05654c4b045ffe028ce6557cc008 # Parent a0b004038f1525f2c4b9826d04624ac086df85ed Update changelog. diff -r a0b004038f15 -r 302a183d556d debian/changelog --- a/debian/changelog Sun Feb 27 16:07:14 2011 +0530 +++ b/debian/changelog Sun Feb 27 16:08:54 2011 +0530 @@ -1,3 +1,10 @@ +pgf (2.10-0) unstable; urgency=low + + * Non-maintainer upload. + * New upstream version. + + -- Faheem Mitha <faheem@email.unc.edu> Sun, 27 Feb 2011 16:07:35 +0530 + pgf (2.00-1) unstable; urgency=low  6) Then pgf-2.10/debian$ debuild binary

should build your package and place in the directory above pgf-2.10.

-