Werner is right, I once mentioned that the code to produce listings might become available. And I still believe it would be nice if it would.
However, the TikZ manual styles are still (a) quite useful and (b) almost undocumented and (c) untidy without much progress since that comment.
I have assembled a minimum working example which demonstrates a couple of key features such that you may be able to start such a document. I believe it is a good starting point, and it allows to skip a few unavoidable usability issues.
Perhaps someone of the power-users on this site might want to create a "right" package out of the complete styles - including documentation for the documentation.
In order to get this piece of code up and running, you NEED TO COPY pgfmanual-en-macros.tex from doc/generic/pgf/macros/pgfmanual-en-macros.tex into your local directory.
Then, use
pdflatex file.tex
makeindex file
pdflatex file.tex
to compile it.
% to allow compression of cross references.
% both pgfmanual and pgfplots manual would be MUCH larger without it.
\pdfminorversion=5
\pdfobjcompresslevel=2
\documentclass{ltxdoc} % the pgf manual styles are based on ltxdoc
\usepackage{tikz}
% necessary for the manual styles:
\usepackage{calc}
% if you need an index.
\usepackage{makeidx}
% for cross-references:
\usepackage[pdfborder=0 0 0]{hyperref}
\hypersetup{%
colorlinks=true, % use true to enable colors below:
linkcolor=blue,%red,
filecolor=blue,%magenta,
pagecolor=blue,%red,
urlcolor=blue,%cyan,
citecolor=blue,
%frenchlinks=false, % small caps instead of colors
pdfborder=0 0 0, % PDF link-darstellung, falls colorlinks=false. 0 0 0: nix. 0 0 1: default.
%plainpages=false, % Das ist notwendig, wenn die Seitenzahlen z.T. in Arabischen und z.T. in römischen Ziffern gemacht werden.
%pdfsubject=,
}
% just in case you need it:
\newcommand\Tikz{Ti\textit kZ}
% this is due to some stupidity in pgfmanual-en-macros.tex:
% if this macro is not defined, the automatic cross-referencing is
% disabled:
\def\pgfautoxrefs{1}
% this here contains definitions (and the ONLY documentation for these
% definitions) like
% \begin{command}{\macro}
% \end{command}
%
% \begin{key}{/some/key=\marg{value}}
% \end{key}
\input pgfmanual-en-macros.tex
\makeatletter
% the index of PGF contains
% ----
% This index only contains automatically generated entries. A good index should
% also contain carefully selected keywords. This index is not a good index.
% ---
% use this line to reset that entry:
\def\index@prologue{\section*{Index}\addcontentsline{toc}{section}{Index}
}
\makeatother
% this here allows automatic cross referencing:
\RequirePackage{pgfmanual}
% this here configures automatic cross referencing.
% It works for ANY package that uses pgfkeys and is independent on tikz/pgf.
\pgfkeys{
% whenever an unqualified key is found, the following key prefix
% list is tried to find a match.
/pdflinks/search key prefixes in={/tikz/,/pgf/},
%
% the link prefix written to the pdf file:
/pdflinks/internal link prefix=pgfp,
%
/pdflinks/codeexample links=true,
/pdflinks/warnings=false, % for debugging
/pdflinks/show labels=false,% for debugging
}
% belongs to \usepackage{makeindex}
\makeindex
\begin{document}
\begin{command}{{\tikz}\marg{macro}}
This is some command definition.
\end{command}
\begin{key}{/tikz/key=\marg{value} (initially somevalue)}
This is some key definition.
\end{key}
\begin{key}{/tikz/red}
Sets the color to red.
\end{key}
\begin{key}{/something/strange=\mchoice{choice1,choice2} (initially choice1)}
A special key.
\end{key}
We want to reference |key|.
\begin{codeexample}[]
\begin{tikzpicture}
\draw[red,->] (0,0) -- (1,1);
\end{tikzpicture}
\end{codeexample}
Note that |/something/strange| does not belong to \Tikz. Note that |\tikz| is a macro of \Tikz.
% belongs to \usepackage{makeindex}
\printindex
\end{document}
PS
the manual is a customized verbatim environment. It is unrelated to listings. In fact, the auto-cross referencing is unique to the PGF verbatim environment.
pgfmanual-en-macros.texfile in your distribution. It contains the definition of thecodexampleenvironment... – Paul Gaborit Sep 18 '12 at 08:28