I would seriously recommend not to use the teTeX packages of Zenwalk. While I have never heard of the Zenwalk distribution before, teTeX is unmaintained since 2006. Its successor is TeX Live. Manually installing TeX Live is easy (just run the installer script and the set $PATH). TeX Live contains the newest TikZ version and all dependencies (maybe you need to run tlmgr update --all
after installing to get the newest package versions).
Before you install TeX Live you should remove teTeX to avoid any potential problems.
According to the Zenwalk Wiki, this is how you set the path:
After the installation is completed open a text editor such as Geany and create a file called texlive.sh
and put the following two lines in it:
export PATH=$PATH:/opt/texlive/2010/bin/i386-linux
export MANPATH=$MANPATH:/opt/texlive/2010/texmf/doc/man
Save texlive.sh
file. Make this file executable. Move this file to /etc/profile.d
(as root, afterwards you need to log out and then log in again).
By default TeX Live installs itself to /usr/local/texlive/2010
so you might need to change the paths.
As there are no tutorials for exactly what you are asking, I will endeavor to provide a short one here to provide an answer to the question, and with the hope that other more experienced users will provide additional information. To understand properly the development of a tikZ/pgf
package/library one has to distinguish between the different aspects of the question.
Writing a LaTeX Package
To write a LaTeX package is a fairly simple procedure. One has to save the file with the extension .sty
and include a few lines of mandatory code:
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{tower}[2012/02/03 v1.0a Draw towers package]
....
\endinput
A more comprehensive guide is provided in the clsguide and there is also a lot of information on this site as well.
Writing your Package in Literate Style
If you browse through the code of most packages or classes, you will observe that the documentation is provided with the code in .dtx
files (with the exception of pgf
and tikZ
packages, but more about this later). What enables this method of writing is the doc/docstrip
system developed by Frank Mittelbach, David Carlisle and others. The doc software can automatically generate indexes of definitions, indexes
of command use, and change-log lists.
The doc system is very useful for maintaining and
documenting large TeX sources, such as the LaTeX2e code. LaTeX classes and
packages written using this can be processed in two ways: they can be run
through LaTeX, to produce documentation; and they can be processed with
docstrip, to produce the .cls
or .sty
file.
A basic template, where you can just simply type in your code and user manual can be found at
tex-sx
PGF/TikZ Libraries
Most of the packages at tex-sx are packages and not libraries. A pgf
library is a file with the specific extension tikzlibrary<filename>.code.tex
. Instead of being loaded as \usepackage{...}
, they are loaded as \usetikzlibrary{...}
or similar.
There are two advantages in using such a method. Firstly it organizes the code in a hierarchy which is easier to manage and second the underlying loading mechanism can be used transparently to load the code in LaTeX, TeX Plain or ConTeXt formats.
Other package authors design their own library loading mechanisms following the same style. A great example to study is the tcolorbox
package. The extract below shows that a library simply defines the code and when loaded the right paths are set. Some list management code is provided to keep track of options, available libraries for the package and error trapping.
\def\tcblibrary@documentation@loaded{}
\def\tcb@optionlist{}
\def\tcbuselibrary#1{\tcbset{library/.cd,#1}}
\def\tcb@add@library#1#2{%
\tcbset{library/#1/.code={\@ifundefined{tcblibrary@#1@loaded}{\input #2}{}}}%
\DeclareOption{#1}{\edef\tcb@optionlist{\tcb@optionlist,#1}}%
}
\tcb@add@library{listings}{tcblistings.code.tex}
\tcb@add@library{theorems}{tcbtheorems.code.tex}
\tcb@add@library{documentation}{tcbdocumentation.code.tex}
Writing a Package for tex-sx
Most of these packages were originally answers to questions, which were later refined and published as packages. There are some very impressive packages on the current list. If you want to contribute it is very easy and the best place to start is to come over to chat and speak to people like Andrew Stacey who was instrumental in kick starting it and either Andrew or one of the other contributors can provide valuable advice.
As a closing remark, most of the pgf family of large packages are not written in .dtx
files but rather use variants of the pgfmanual
package. This enables examples to be typeset as well as executed in the user documentation and also provide a consistent feel and look with the pgf/tikz
style manuals.
Suggestion for a Package
There is a great need for a good TikZ library for Computer Science and enough questions and answers on this site to kick start it.
Best Answer
The easiest way to keep up with your TeX library is to download the TeX Live Utility. You can find it in several places if you Google it; however, if you download the MacTeXExtras file from the MacTeX website you can find a copy of it there along with some other useful applications for LaTeX. Using the TeX Live Utility you can download, update, remove individual packages from a repository you specify or just use the default. You can also simply update your entire TeX Library at once if you like. Hobby is among the available packages in the list, but is not installed by default, so just highlight it and click install.