diff options
author | Karl Berry <karl@freefriends.org> | 2009-12-31 01:26:26 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-12-31 01:26:26 +0000 |
commit | 01294f46bb60e2b571fe1cc4b8a4428366240d8b (patch) | |
tree | 9a247291b962904733ebfd2e6e5748bba9d24ca7 /Master/texmf-dist/source/latex/tikz-timing | |
parent | 824638c603c772ef55ee6b4f8b3c1e8b680abe5b (diff) |
tikz-timing update (30dec09)
git-svn-id: svn://tug.org/texlive/trunk@16537 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/tikz-timing')
-rw-r--r-- | Master/texmf-dist/source/latex/tikz-timing/Makefile | 171 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/tikz-timing/tikz-timing.dtx | 2462 |
2 files changed, 1591 insertions, 1042 deletions
diff --git a/Master/texmf-dist/source/latex/tikz-timing/Makefile b/Master/texmf-dist/source/latex/tikz-timing/Makefile deleted file mode 100644 index d83b96c88e9..00000000000 --- a/Master/texmf-dist/source/latex/tikz-timing/Makefile +++ /dev/null @@ -1,171 +0,0 @@ -# $Id: Makefile 1537 2009-12-01 15:19:58Z martin $ - -PACKAGE=tikz-timing -PACKAGE_STY = ${PACKAGE}.sty ${PACKAGE}-*.sty -PACKAGE_DOC = ${PACKAGE}.pdf -PACKAGE_SRC = ${PACKAGE}.dtx ${PACKAGE}.ins Makefile -PACKFILES = ${PACKAGE_SRC} ${PACKAGE_DOC} README -TEXAUX = *.aux *.log *.glo *.ind *.idx *.out *.svn *.svx *.svt *.toc *.ilg *.gls *.hd *.exa *.exb *.thm *.fdb_latexmk -TESTDIR = tests -INSGENERATED = ${PACKAGE_STY} -ZIPFILE = ${PACKAGE}-${ZIPVERSION}.zip -TDSZIPFILE = ${PACKAGE}-${ZIPVERSION}.tds.zip -GENERATED = ${INSGENERATED} ${PACKAGE}.pdf -ZIPS = zip tdszip - -LATEX_OPTIONS = -interaction=batchmode -LATEX = pdflatex ${LATEX_OPTIONS} - -SHELL=/bin/bash - -TEXMFDIR = ${HOME}/texmf - -CP = cp -v -MV = mv -v -RMDIR = rm -rf -MKDIR = mkdir -p - -.PHONY: all doc package clean fullclean tds reload - -all: package doc example -new: fullclean all - -doc: ${PACKAGE}.pdf reload - -pdf: one_run reload - - -package: ${PACKAGE}.sty - -reload: - -@pdfreload --file ${PACKAGE}.pdf 2>/dev/null || pdfopen --file ${PACKAGE}.pdf - -example: - -ctanify: ${PACKFILES} - ctanify $^ - -one_run: ${PACKAGE}.dtx - ${LATEX} $< - -%.pdf: %.dtx - ${LATEX} $*.dtx - -makeindex -s gind.ist -o $*.ind $*.idx - -makeindex -s gglo.ist -o $*.gls $*.glo - ${LATEX} $*.dtx - ${LATEX} $*.dtx - -${PACKAGE}.pdf: ${PACKAGE}.sty - -${INSGENERATED}: *.dtx ${PACKAGE}.ins - yes | latex ${PACKAGE}.ins - -clean: - rm -f ${TEXAUX} $(addprefix ${TESTDIR}/, ${TEXAUX}) - -fullclean: - rm -f ${TEXAUX} $(addprefix ${TESTDIR}/, ${TEXAUX}) ${GENERATED} *~ *.backup - rm -f ${PACKAGE}*.zip - rm -rf tds/ .tds - -${PACKAGE}.zip: zip - -zip: ${PACKAGE}.pdf - -zip: ZIPVERSION=$(shell grep "Package: ${PACKAGE} " ${PACKAGE}.log | \ - sed -e "s/.*Package: ${PACKAGE} ....\/..\/..\s\+\(v\S\+\).*/\1/") - -zip: - @${MAKE} --no-print-directory ${ZIPFILE} - -${PACKAGE}%.zip: ${PACKFILES} - @test -n "${IGNORE_CHECKSUM}" || grep -q '\* Checksum passed \*' ${PACKAGE}.log - -pdfopt ${PACKAGE}.pdf opt_${PACKAGE}.pdf && mv opt_${PACKAGE}.pdf ${PACKAGE}.pdf - ${RM} $@ - zip $@ ${PACKFILES} - @echo - @echo "ZIP file $@ created!" - -tds: .tds - -.tds: ${PACKAGE_STY} ${PACKAGE_DOC} ${PACKAGE_SRC} - @test -n "${IGNORE_CHECKSUM}" || grep -q '\* Checksum passed \*' ${PACKAGE}.log - ${RMDIR} tds - ${MKDIR} tds/ - ${MKDIR} tds/tex/ tds/tex/latex/ tds/tex/latex/${PACKAGE}/ - ${MKDIR} tds/doc/ tds/doc/latex/ tds/doc/latex/${PACKAGE}/ - ${MKDIR} tds/source/ tds/source/latex/ tds/source/latex/${PACKAGE}/ - ${CP} ${PACKAGE_STY} tds/tex/latex/${PACKAGE}/ - ${CP} ${PACKAGE_DOC} tds/doc/latex/${PACKAGE}/ - ${CP} ${PACKAGE_SRC} tds/source/latex/${PACKAGE}/ - @touch $@ - -tdszip: ${TDSZIPFILE} - -tdszip: ZIPVERSION=$(shell grep "Package: ${PACKAGE} " ${PACKAGE}.log | \ - sed -e "s/.*Package: ${PACKAGE} ....\/..\/..\s\+\(v\S\+\).*/\1/") - -${TDSZIPFILE}: .tds - ${RM} ${TDSZIPFILE} - cd tds && zip -r ../${TDSZIPFILE} . - -install: .tds - test -d "${TEXMFDIR}" && ${CP} -a tds/* "${TEXMFDIR}/" && texhash ${TEXMFDIR} - -sinstall: - @touch ${PACKAGE}.pdf - ${MAKE} install - -uninstall: - test -d "${TEXMFDIR}" && ${RM} -rv "${TEXMFDIR}/tex/latex/${PACKAGE}" \ - "${TEXMFDIR}/doc/latex/${PACKAGE}" "${TEXMFDIR}/source/latex/${PACKAGE}" && texhash ${TEXMFDIR} - -test: test.pdf - -test.pdf: ${PACKAGE}.sty test.tex - pdflatex test - pdfcrop test.pdf - -CHARS=H L Z X M U D T C "" - -ACHARS='N(a)' [] ';' H L Z X M U U{A} D D{A} G T tt C cc E ee - -acompare: ${PACKAGE}.sty test2.tex - for a in ${ACHARS}; do \ - echo "$$a"; \ - pdflatex -jobname "test-$$a" "\\def\\a{$$a}\\input{test2}";\ - compare -density 500 "test-$$a.pdf[0]" "test-$$a.pdf[1]" "diff-$${a}_0x1.png"; \ - compare -density 500 "test-$$a.pdf[0]" "test-$$a.pdf[2]" "diff-$${a}_0x2.png"; \ - compare -density 500 "test-$$a.pdf[0]" "test-$$a.pdf[3]" "diff-$${a}_0x3.png"; \ - compare -density 500 "test-$$a.pdf[1]" "test-$$a.pdf[2]" "diff-$${a}_1x2.png"; \ - compare -density 500 "test-$$a.pdf[1]" "test-$$a.pdf[3]" "diff-$${a}_1x3.png"; \ - compare -density 500 "test-$$a.pdf[2]" "test-$$a.pdf[3]" "diff-$${a}_2x3.png"; \ - done - -icompare: ${PACKAGE}.sty test.tex - rm -f new-*.* old-*.* diff-*.* - for I in ${CHARS}; do \ - pdflatex -jobname "new-$$I" "\\def\\I{$$I}\\input{test}";\ - mv ${PACKAGE}.sty ${PACKAGE}.sty.save; \ - pdflatex -jobname "old-$$I" "\\def\\I{$$I}\\input{test}";\ - mv ${PACKAGE}.sty.save ${PACKAGE}.sty; \ - P=$$(( $$(pdfinfo new-$$I.pdf | grep ^Pages: | cut -d: -f2) - 1 )); \ - for N in $$(seq -w 0 $$P); do \ - compare -density 500 old-$$I.pdf[$$N] new-$$I.pdf[$$N] diff-$$I-$$N.png; \ - done; \ - done - -compare: ${PACKAGE}.sty test.tex - rm -f new*.* old*.* diff*.* - pdflatex test - pdfcrop test.pdf new.pdf - mv ${PACKAGE}.sty ${PACKAGE}.sty.save; - pdflatex test - pdfcrop test.pdf old.pdf - mv ${PACKAGE}.sty.save ${PACKAGE}.sty; - P=$$(( $$(pdfinfo new.pdf | grep ^Pages: | cut -d: -f2) - 1 )); \ - for N in $$(seq -w 0 $$P); do \ - echo -n "$$N: "; \ - compare -density 500 -metric MAE old.pdf[$$N] new.pdf[$$N] diff-$$N.png; \ - done - diff --git a/Master/texmf-dist/source/latex/tikz-timing/tikz-timing.dtx b/Master/texmf-dist/source/latex/tikz-timing/tikz-timing.dtx index cb770a0b90b..0cb364529cf 100644 --- a/Master/texmf-dist/source/latex/tikz-timing/tikz-timing.dtx +++ b/Master/texmf-dist/source/latex/tikz-timing/tikz-timing.dtx @@ -1,4 +1,5 @@ -% \iffalse meta-comment +% \iffalse +%<*copyright> % % Copyright (C) 2009 by Martin Scharrer <martin@scharrer-online.de> % ----------------------------------------------------------------- @@ -20,7 +21,8 @@ % This work consists of the files tikz-timing.dtx, tikz-timing.ins % and the derived file tikz-timing.sty. % -% $Id: tikz-timing.dtx 1580 2009-12-09 11:14:01Z martin $ +% $Id: tikz-timing.dtx 1647 2009-12-28 14:18:14Z martin $ +%</copyright> % \fi % % \iffalse @@ -45,8 +47,8 @@ %<*driver> \ProvidesFileSVN %</driver> - {$Id: tikz-timing.dtx 1580 2009-12-09 11:14:01Z martin $} - [v0.7 + {$Id: tikz-timing.dtx 1647 2009-12-28 14:18:14Z martin $} + [v0.7a %<package> Digital Timing Diagrams using TikZ] %<examplecode> Macros to produce examples for the tikz-timing package] %<ydoc> Documentation Macros for tikz-timing package] @@ -75,12 +77,41 @@ %<examplecode>\RequirePackage{pgffor}% %<examplecode>\usetikzlibrary{calc}% %<*driver> -\documentclass{ltxdoc} +\newif\ifprintversion % \fi +\ifx\printversion\@undefined +\else + \printversiontrue +\fi + +\ifprintversion + \documentclass{ltxdoc} + \let\chapter\section + \let\section\subsection + \let\subsection\subsubsection +\else + \documentclass[landscape,12pt]{scrreprt} + + \usepackage{doc} + \marginparwidth=2.5cm\relax + + \def\chapterheadstartvskip{\vspace*{0\baselineskip}} + \def\cmd#1{\cs{\expandafter\cmd@to@cs\string#1}} + \def\cmd@to@cs#1#2{\char\number`#2\relax} + \DeclareRobustCommand\cs[1]{\texttt{\char`\\#1}} + \providecommand\marg[1]{% + {\ttfamily\char`\{}\meta{#1}{\ttfamily\char`\}}} + \providecommand\oarg[1]{% + {\ttfamily[}\meta{#1}{\ttfamily]}} + \providecommand\parg[1]{% + {\ttfamily(}\meta{#1}{\ttfamily)}} +\fi + \usepackage{tikz-timing}[\tikztiming@date] \usetikztiminglibrary{arrows,either,overlays,clockarrows,columntype} \usetikztiminglibrary{nicetabs,counters,advnodes,interval,ifsym} \tikzset{timing/no nice tabs} \tikzset{timing/interval/normal} +\tikzset{timing/nodes/old center} \usetikzlibrary{plotmarks} \makeatother %%%^^A\usepackage[electronic]{ifsym} @@ -101,14 +132,18 @@ \usepackage{microtype}[2005/10/28] \DisableLigatures{encoding = T1, family = tt* }% \newsavebox{\mysb} +\newsavebox{\sba} +\newsavebox{\sbb} \makeatletter %</driver> %<*ydoc> +\iffalse % Restore article settings: \textwidth 345.0pt \marginparwidth 65.0pt \oddsidemargin 62.0pt \evensidemargin 62.0pt\relax +\fi % use hypdoc if you have it, hyperref else \IfFileExists{hypdoc.sty} @@ -125,16 +160,16 @@ \newcommand*{\pkgctanurl}[1]{% CTAN: \url{http://www.ctan.org/pkg/#1}% } -\newcommand*{\pkg}[2][\@tempa]{% +\newcommand*{\pkg}[2][\sndarg]{% \begingroup - \def\@tempa{#2}% + \def\sndarg{#2}% \let\@tempb\empty - \ifx\@tempa#1% + \ifx\sndarg#1% \def\@tempb{}% \else \def\@tempb{Part of the \texttt{#1} package,\ }% \fi - \href{http://www.ctan.org/pkg/#1}{\texttt{\@tempa}}% + \href{http://www.ctan.org/pkg/#1}{\texttt{\sndarg}}% % URL footnote (for print-out) on first appearance: \@ifundefined{seen@package@#2}{% \footnote{\@tempb\pkgctanurl{#1}}% @@ -161,13 +196,21 @@ \item[\pkgnoctan{#2}{#3}#1]\footnotetext{Location: \url{#3}}% } +\newcommand*{\library}[2]{% + \hypertarget{lib:#1}{\section{#2}}% + \label{lib:#1}% +} +\newcommand*{\lib}[1]{% + \hyperlink{lib:#1}{`\texttt{#1}'}% +} + % link \cs to macro definitions \let\ydoc@origmacro\macro \let\ydoc@origendmacro\endmacro \let\ydoc@origStopEventually\StopEventually \let\ydoc@origPrintDescribeMacro\PrintDescribeMacro \RequirePackage{xcolor} -\definecolor{darkred}{rgb}{0.333.0.0,0.0} +\definecolor{darkred}{rgb}{0.333,0.0,0.0} \hypersetup{colorlinks=true,linkcolor=darkred,urlcolor=darkred} \definecolor{macrodesccolor}{rgb}{0.0,0.0,0.8} \definecolor{macroimplcolor}{rgb}{0.0,0.0,0.4} @@ -218,7 +261,7 @@ \def\DescribeEnv{\@ifnextchar*{\DescribeEnvS}{\DescribeEnvN}} \def\DescribeEnvN{% - \bigskip\pagebreak[3]\par\noindent\DescribeEnvS*% + \noindent\bigskip\pagebreak[3]\par\noindent\DescribeEnvS*% } \def\DescribeEnvS*#1#2{% \begingroup @@ -231,11 +274,12 @@ {\def\macrolink{\hyperlink{impl@#1.3}}}% \hypersetup{linkcolor=macrodesccolor}% \hspace*{\macrosep}% - %\raisebox{\baselineskip}[\baselineskip]{\pdfbookmark[3]{#1}{desc@#1}}% + \raisebox{\baselineskip}[\baselineskip]{\pdfbookmark[3]{#1}{desc@#1}}% \css{begin}% \{\macrolink{\macroformat{\textcolor{macrodesccolor}{#1}}}\}% \noindent\mbox{}\macroargformat{#2}\\*\relax \hspace*{\macrosep}% + \hspace*{-\parindent}% \css{end}% \{\macrolink{\macroformat{\textcolor{macrodesccolor}{#1}}}\}% \nopagebreak @@ -511,21 +555,27 @@ } \fi +\RequirePackage{nofloat} %%% Examples %%% \RequirePackage{fancyvrb} \RequirePackage{listings} + \RequirePackage{float} \belowcaptionskip=\abovecaptionskip -\floatstyle{plaintop} -\restylefloat{table} +%\floatstyle{plaintop} +%\restylefloat{table} -\floatstyle{plain} +%\floatstyle{plain} \restylefloat{figure} -\newfloat{example}{tbph}{fle} +\newfloat{example}{tbph}{loe}%{toc} \floatname{example}{Example} +\let\l@example\l@section +%\def\theexample{\thesection.\arabic{example}}% +\let\toclevel@example\toclevel@section + \newwrite\ydoc@exawrite \newread\ydoc@exaread @@ -535,13 +585,16 @@ Example \the\c@example:^^J^^J% \string\documentclass{article}^^J% \string\usepackage{tikz-timing}[\tikztiming@date]^^J% + \string\usepackage[active,tightpage]{preview}^^J% + \string\PreviewEnvironment{tikzpicture}^^J% \string\pagestyle{empty}^^J% \exampleextraheader^^J% \string\begin{document}^^J\@percentchar } \def\ydoc@exafoot{% \@percentchar^^J% - \string\end{document}% + \string\end{document}^^J% + \@percentchar\space vim: ft=tex^^J% } \let\exampleextraheader\empty @@ -578,7 +631,8 @@ \newenvironment{examplecode} {\begingroup\VerbatimOut[gobble=4]{\jobname.exa}} {\endVerbatimOut\endgroup\writeexample - \formatexample} + {\setupexampleboxes\formatexample} + } \newsavebox{\examplecodebox} \newsavebox{\exampleresultbox} @@ -594,16 +648,18 @@ }% } -\def\formatexample{% - \begingroup +\def\setupexampleboxes{% \savebox{\examplecodebox}{\lstinputlisting{\jobname.exa}} \savebox{\exampleresultbox}{\catcode`\%=14\input{\jobname.exa}}% - % +} + +\def\formatexample{% \par\noindent + \parbox{\textwidth}{\noindent \setlength{\@tempdima}{\wd\examplecodebox + \wd\exampleresultbox}% \ifthenelse{\linewidth < \@tempdima}% {% - \centerline{\usebox{\examplecodebox}} \\[\bigskipamount]% + \centerline{\usebox{\examplecodebox}} \\*[\bigskipamount]% \centerline{\usebox{\exampleresultbox}}% }% {% @@ -612,8 +668,7 @@ \minipage[c]{\wd\exampleresultbox}\hbox{\usebox{\exampleresultbox}}\endminipage% \\% }% - \endgroup - \par + }% } \def\tikztiming@embedexample{% @@ -678,7 +733,7 @@ % % \begin{macro}{\tikztimingfullexampletable} % \begin{macrocode} -\def\tikztimingfullexampletable{ +\def\tikztimingfullexampletable{%^^A \begin{tikzpicture}[timing/picture,x=1em,y=1em,font=\sffamily] \tikzset{timing/d/background/.style={fill={gray!25},fill opacity=0.5}}% \let\chars\tikztiming@chars@default @@ -704,23 +759,20 @@ % \path (1.5,-2) node (charnodex) {\strut}; \coordinate (charnodex) at (charnodex.base); - \coordinate (charnodey) at (charnodex.base); + \coordinate (charnodey) at ($ (charnodex.base) + (0,2) $); \def\@tempa{\timing at (charnodey)} - \expandafter\foreach - \expandafter\xchar - \expandafter i\expandafter n\expandafter{\chars} { - \expandafter\foreach - \expandafter\ychar - \expandafter i\expandafter n\expandafter{\chars} { - \draw [xstep={\timingwidth/2.},ystep={\timingheight/2.},timing/grid, - shift={(charnodey)}] - (0,0) grid +(2,1); - \expandafter\@tempa\expandafter{\ychar\xchar}; - \path (charnodey) +(0,-2) node (charnodey) {}; - } - \path (charnodex) ++(+2,0) node (charnodex) {} node (charnodey) {}; + \foreach\xchar in \chars { + \foreach\ychar in \chars { + \path (charnodey) +(0,-2) node (charnodey) {}; + \draw [xstep={\timingwidth/2.},ystep={\timingheight/2.},timing/grid, + shift={(charnodey)}] + (0,0) grid +(2,1); + \expandafter\@tempa\expandafter{\ychar\xchar}; + } + \path (charnodex) ++(+2,0) node (charnodex) {}; + \path (charnodex) ++(0,2) node (charnodey) {}; } - \end{tikzpicture} + \end{tikzpicture}%^^A } % \end{macrocode} % \end{macro} @@ -732,6 +784,14 @@ \makeatletter +\def\scaleto#1#2{% + \begingroup + \sbox{\mysb}{#2}% + \pgfmathparse{(#1) / \wd\mysb}% + \scalebox{\pgfmathresult}{\usebox{\mysb}}% + \endgroup +} + \def\MakeShortVerbQuote{% \def\@shortvrbdef{\qverb}\@MakeShortVerb } @@ -747,7 +807,11 @@ \def\NewIn#1{ - \marginpar{\raisebox{.125ex}{\textcolor{black}{\emph{New in #1}}}}% + \marginpar{\strut\raggedleft\raisebox{.125ex}{\textcolor{black}{\emph{New in #1}}}}% +} + +\def\ExtIn#1{ + \marginpar{\strut\raggedleft\textcolor{black}{\emph{Extended in #1}}}% } \iffalse @@ -783,15 +847,21 @@ \OnlyDescription \listfiles +\DeleteShortVerb{\|} +\def\pipe{|} +\def\Pipe{{\normalfont\normalcolor\pipe}} +\MakeShortVerb{\|} + \begin{document} \DocInput{tikz-timing.dtx} \PrintChanges %\newpage\PrintIndex \end{document} %</driver> +%<*doc> % \fi % -% \CheckSum{5223} +% \CheckSum{5702} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -834,7 +904,41 @@ % pdfkeywords = {tikz-timing, timing diagram, LaTeX} % }% % \fi +% +% \unless\ifprintversion +% \begingroup +% \makeatletter +% \title{{\tikz[baseline=(N.base),timing/picture,timing/z/.style={},% +% timing/unit=1.44*\f@size pt,timing/d/text/.style={},timing/d/background/.style={fill=black!10},timing/inline node/.append style={rectangle,inner sep=0pt,outer sep=0pt}] +% \timing at (0,0) {1L N[shift={(0,0.5)}]{\strut The} .9L 3d{[alias=N]\strut tikz} $.5em/\xunit$Z 5d{\strut timing} 1.75H N[shift={(0,-0.5)}]{Package} 1.75H } ;}} +% \author{Martin Scharrer} +% \date{Version \fileversion\ -- \filedate} +% \thispagestyle{empty} +% \begin{titlepage} +% \sffamily\bfseries +% \parindent=0pt +% \centering +% \vspace*{2cm} +% \scaleto{.75\textwidth}{\Huge\@title} +% \par\vspace*{.75cm} +% \Large A \LaTeX\ Package for Timing Diagrams +% \par\vspace*{1.5cm} +% {\LARGE\@date} +% \par\vspace*{2cm} +% {\LARGE\@author +% \par\smallskip} +% {\Large\href{mailto:martin@scharrer-online.de}{martin@scharrer-online.de} +% \par\vspace*{1.25cm}} +% {\Large +% WWW: \url{http://latex.scharrer-online.de/tikz-timing}\\[.5ex] +% CTAN: \url{http://www.ctan.org/pkg/tikz-timing}\\[1.2ex] +% \par\smallskip} +% \end{titlepage} % \clearpage +% \endgroup +% +% \else +% % \null % \vspace*{-2em} % \begin{center} @@ -850,15 +954,21 @@ % CTAN: \url{http://www.ctan.org/pkg/tikz-timing}\\[1.2ex]} % \end{center} % \vspace{1.2em}% +% \fi % -% ^^A\vfill -% \noindent +% ^^A\vfill \noindent % ^^A\textbf{Note to Advanced Users:} This is a new package which internal % ^^Amacros might still change. Please only rely on the user macros for now. % -% {\let\csd\texttt\tableofcontents} +% \clearpage +% \enlargethispage{\baselineskip} +% {\let\csd +% \texttt\tableofcontents +% \listof{example}{List of Examples} +% } +% \addtocontents{toc}{\vspace*{-1.5em}} % -% \section{Introduction} +% \chapter{Introduction} % This package uses the \pkg[pgf]{tikz} package to produce timing diagrams % inside text or \envv{tikzpicture} environments. Also a tabular-like % environment is provided to produce a larger timing diagram with multiple @@ -870,7 +980,7 @@ % \emph{Logical Low}. So e.g.\ "{HLZXD}" gives `\texttiming{HLZXD}'. % In order to fit (in)to normal text the diagram size (\ie its height, width and line width) % is defined relatively to the currently active font size. The diagram height is about the height of an -% uppercase `X' (+$2\times\frac12$ line width). This way the diagrams +% uppercase "X" (+$2\times\frac12$ line width). This way the diagrams % can also be scaled using font size commands like \cs{small}. % (Example: {\sffamily % \large X\texttiming{LH}X @@ -903,6 +1013,7 @@ % ("H $ 1+\mymacro-\slope $ L "~$\rightarrow$~`\texttiming{H2.5L}') % and much more. % +% \iffalse % \medskip % \DeleteShortVerb{\|} % \centerline{\texttiming[D]{ @@ -912,6 +1023,7 @@ % }} % \MakeShortVerb{\|} % \medskip +% \fi % % \iffalse % The package is build to make it possible to define new characters from scratch @@ -921,7 +1033,7 @@ % \fi % % \iffalse -% \subsection{Similar Packages} +% \section{Similar Packages} % There a some packages which target the same application like the package % presented by this document. % @@ -930,7 +1042,7 @@ % special font which contains graphical representation of the logical levels % high and low at the corresponding letter "H" and "L". The lower case % versions have only half the width of the uppercase ones. Also a transition -% can be added using the `\verb+|+' character which will (sometimes) be added +% can be added using the "|" character which will (sometimes) be added % automatically between |HL| and |LH|. % The diagrams are created using the command |\textifsym|\marg{characters}, % e.g.\ \verb+\textifsym{H|L|h|l|H|L}+ results in @@ -954,7 +1066,8 @@ % \end{description} % \fi % -% \subsection{Changelog} +% \clearpage +% \section{Changelog} % \begingroup % \renewcommand{\changes}[3]{\paragraph{#1 from #2}\begin{itemize}\item #3\end{itemize}} % \newenvironment{Changes}[2]{\paragraph{#1 from #2}\begin{itemize}\let\change\item}{\end{itemize}} @@ -989,22 +1102,22 @@ % \begin{Changes}{v0.7}{2009/12/05} % \change New libraries: % \begin{description} -% \item[|clockarrows|] Library for clock arrows. -% \item[|columntype|] Library providing a timing column type for |tabular|. -% \item[|nicetabs|] Library to format \cs{tikztimingtable} like a |booktab| |tabular|. -% \item[|counters|] Library to defined counter characters which display an incrementing +% \item[\lib{clockarrows}] Library for clock arrows. +% \item[\lib{columntype}] Library providing a timing column type for |tabular|. +% \item[\lib{nicetabs}] Library to format \cs{tikztimingtable} like a |booktab| |tabular|. +% \item[\lib{counters}] Library to defined counter characters which display an incrementing % counter value every time there are used. -% \item[|advnodes|] Library for advanced nodes with multiple anchor points. -% \item[|ifsym|] Library providing the same timing symbols and characters as the |ifsym| package +% \item[\lib{advnodes}] Library for advanced nodes with multiple anchor points. +% \item[\lib{ifsym}] Library providing the same timing symbols and characters as the |ifsym| package % when loaded with the |electronic| option. % \end{description} % \change Additional experimental libraries: % \begin{description} -% \item[|interval|] Library to change color of "ZL", "ZH" etc. transitions to +% \item[\lib{interval}] Library to change color of "ZL", "ZH" etc. transitions to % indicate borders of an interval. -% \item[|beamer|] Library providing some marginal beamer overlay support. +% \item[\lib{beamer}] Library providing some marginal beamer overlay support. % \end{description} -% \change "overlays" library: +% \change \lib{overlays} library: % \begin{itemize} % \item Overlays can now be cascaded, \ie an overlay can be inside another one. % \item The second braces around the second part are now optional. @@ -1017,7 +1130,7 @@ % needs to be written as \verb+[|/utils/exec={..}|]+. Otherwise it is re-executed every time % the drawing path is renewed. % \change Added star version of \cs{tablegrid}. -% \change Added background to "E" character ("either" library). +% \change Added background to "E" character (\lib{either} library). % \change Some fixes for placing of "D{}" texts. % \change Fixed wrong slopes (\eg |lslope| instead of |zslope|) for some transitions. % \change Major changes on internal character definition macros, parser and output routine. @@ -1053,81 +1166,145 @@ % % \endgroup % +% \section{Dependencies} +% \dots +% % \clearpage -% \section{Usage} -% -% \subsection{Timing Characters} -% As mentioned in the introduction section the logic levels are described by so called -% \emph{timing characters}. Actually all of them are letters, but the general term \emph{character} is used here. -% Table~\ref{tab:chars} shows all by default defined logic characters and -% Table~\ref{tab:full} all possible two-character transitions. -% Additional functionality is provided by the \emph{modifiers} shown in +% \chapter{Usage} +% +% \section{Timing Characters} +% The logic levels are described by so called \emph{timing characters}. Actually +% all of them are letters, but the general term \emph{character} is used here. +% Table~\ref{tab:chars} shows all by default defined logic characters and +% Table~\ref{tab:full} all possible two-character transitions. Additional +% functionality is provided by the \emph{modifiers} shown in % Table~\ref{tab:modifiers}. % -% \begin{table} +% \sbox{\sba}{%^^A +% \sffamily % \tikzset{timing/draw grid} -% \sffamily\centering -% \caption{Timing Characters}\label{tab:chars} % \begin{tabular}{clccc} -% \toprule -% Character & Description & Full Width & Half Width & Transition \\ -% & & \small (Uppercase) & \small (Lowercase) & Example -% \\\midrule -% \texttt{H} & High & \texttiming{H} & \texttiming{h} & \texttiming[L]{H} \\ -% \texttt{L} & Low & \texttiming{L} & \texttiming{l} & \texttiming[H]{L} \\ -% \texttt{Z} & High Impedance & \texttiming{Z} & \texttiming{z} & \texttiming[L]{Z} \\ -% \texttt{X} & Undefined / Don't Care & \texttiming{X} & \texttiming{x} & \texttiming[L]{X} \\ -% \texttt{D} & Data / Double & \texttiming{D} & \texttiming{d} & \texttiming[L]{D{A}D} \\ -% \texttt{U} & Unknown Data & \texttiming{U} & \texttiming{u} & \texttiming[D]{U} \\ -% \texttt{T} & Toggle & \texttiming{L} or \texttiming{H} & \texttiming{l} or -% \texttiming{h} & \texttiming{TTTT} \\ -% \texttt{C} & Clock (no slope) & \texttiming{L} or \texttiming{H} & -% \texttiming{l} or \texttiming{h} & \texttiming{CCCC} \\ -% \texttt{M} & Metastable Condition & \texttiming{M} & \texttiming{m} & \texttiming[H]{Ml} \\ +% \toprule +% Character & Description & Diagram & Transition \\ +% & & & Example \\ +% \midrule +% \texttt{H} & High & \texttiming{H} & \texttiming[L]{H} \\ +% \texttt{L} & Low & \texttiming{L} & \texttiming[H]{L} \\ +% \texttt{Z} & High Impedance & \texttiming{Z} & \texttiming[L]{Z} \\ +% \texttt{X} & Undefined / Don't Care & \texttiming{X} & \texttiming[L]{X} \\ +% \texttt{D} & Data / Double & \texttiming{D} & \texttiming[L]{D{A}D} \\ +% \texttt{U} & Unknown Data & \texttiming{U} & \texttiming[D]{U} \\ +% \texttt{T} & Toggle & \texttiming{L} or \texttiming{H} & \texttiming{TTTT} \\ +% \texttt{C} & Clock (no slope) & \texttiming{L} or \texttiming{H} & \texttiming{CCCC} \\ +% \texttt{M} & Metastable Condition & \texttiming{M} & \texttiming[H]{Ml} \\ % \midrule -% \texttt{G} & Glitch (zero width) & \texttiming{G} & \texttiming{g} & \texttiming{HGH} \\ -% \texttt{S} & Space (nothing) & \texttiming{S} & \texttiming{s} & \texttiming{HSL} \\ -% \bottomrule +% \texttt{G} & Glitch (zero width) & \texttiming{G} & \texttiming{HGH} \\ +% \texttt{S} & Space (nothing) & \texttiming{S} & \texttiming{HSL} \\ +% \bottomrule % \end{tabular} -% ^^A\par\bigskip -% ^^A\makebox[\textwidth][c]{\tikztimingfullexampletable} +% }%^^A +% +% \sbox{\sbb}{%^^A +% \tikzset{timing/draw grid} +% \sffamily\small +% \tikztimingfullexampletable +% }%^^A +% +% \ifprintversion +% +% \begin{table} +% \centering +% \caption{Timing Characters}\label{tab:chars} +% \usebox{\sba} % \end{table} % -% \iftrue % \begin{table} -% \tikzset{timing/draw grid} -% \sffamily\small -% \caption{Overview over all transitions.}\label{tab:full} -% \makebox[\textwidth][c]{\tikztimingfullexampletable} +% \caption{Overview over all transitions.} +% \label{tab:full} +% \usebox{\sbb} +% \end{table} +% +% \else +% +% \begin{table} +% \sffamily +% \centering +% \pgfmathparse{max(\wd\sba+\wd\sbb+1em,\textwidth)}%^^A +% \makebox[\textwidth][c]{%^^A +% \begin{minipage}{\wd\sba} +% \caption{Timing Characters} +% \label{tab:chars} +% \usebox{\sba} +% \end{minipage}%^^A +% \hspace{1em}\hfill +% \begin{minipage}{\wd\sbb} +% \caption{Overview over all transitions.} +% \label{tab:full} +% \usebox{\sbb} +% \end{minipage}%^^A +% }%^^A % \end{table} +% % \fi % +% \clearpage % \DeleteShortVerb{\|} -% \begin{table} -% \tikzset{timing/draw grid} -% \let\normalfont\sffamily -% \sffamily\centering -% \caption{Modifiers for Timing Characters}\label{tab:modifiers} -% \makeatletter +% \begingroup^^A{table}[b] +% \tikzset{timing/draw grid} +% \let\normalfont\sffamily +% \sffamily\centering +% \makeatletter +% +% \tablecaption{Modifiers for Timing Characters.} +% \label{tab:modifiers} +% \def\en{\,\textsf{--}\,} +% \let\origtabular\tabular +% \let\endorigtabular\endtabular +% \def\tabular{\begingroup +% \setbox\mysb\hbox\bgroup +% \origtabular}% +% \def\endtabular{\endorigtabular\egroup\makebox[\textwidth][c]{\usebox\mysb} +% \endgroup}% +% \tablefirsthead{% +% \toprule +% \normalfont +% Modifier Syntax & Description \\ +% \midrule +% }% +% \tablehead{% +% \multicolumn{2}{c}% +% {\raisebox{\belowcaptionskip}{\tablename\ \thetable{} -- +% continued from previous page}} \\ +% \toprule +% \normalfont +% Modifier Syntax & Description \\ +% \midrule +% }% +% \tabletail{% +% \bottomrule +% ^^A\multicolumn{2}{r}{Continued on next page}\\ +% } +% \tablelasttail{% +% \bottomrule +% } % \def\Example#1{\def\@tempa{#1}\@onelevel@sanitize\@tempa % \hbox{\emph{E.g.:} `\hbox{\texttt{\@tempa}}' $\to$ \texttiming{#1}}} -% \makebox[\textwidth][c]{% -% \begin{tabularx}{1.25\textwidth}{>{\ttfamily}l>{\raggedright\arraybackslash}X} -% \toprule -% \normalfont -% Modifier Syntax & Description \\ -% & \\\midrule +% \begin{supertabular}{>{\ttfamily}l>{\raggedright\arraybackslash}p{.85\textwidth}} % D\{\}D & Produces transition between two data values. \Example{D{}D} \\ % D\{\meta{Text}\} & Adds \meta{text} into a data signal using a node. % \Example{D{A}D{B}} \\ % D\{[\meta{\scriptsize % \raisebox{-1ex}{\shortstack{TikZ\\Settings}}}]\meta{Text}\} & Adds \meta{text} % using the given node \meta{settings}. \Example{D{[blue]A}} \\ -% \meta{\small integer}\{\meta{\small characters}\} & Repeats the given -% characters \texttt{\meta{int}} times. \Example{5{hl}}\\ % \meta{\small number}\meta{\small character} & Sets width of next signal to % given number. Half of it if character is in lower case. % \Example{2.6H5.2l}\\ +% \meta{\small integer}\{\meta{\small characters}\} & Repeats the given +% characters \texttt{\meta{int}} times. \Example{5{hl}}\\ +% \{ \meta{\small characters} \} & Encloses characters in a local scope. Options inside are only +% local to the scope. This also applies to the effect of `\texttt{;}' and similar modifiers. +% \Example{H {[blue] LH} L}\\ +% \midrule % \meta{\small number}B & Su\underline{b}tracts the given number from the width % of the next character. ``\textit{\texttt{B}ackwards}'' % \Example{H.5BL}\\ @@ -1136,20 +1313,21 @@ % N\oarg{\tiny Settings}\parg{\tiny Name}\marg{\tiny Content} & Adds node at % current position. All three arguments are optional. \Example{H N(a1) L}\\ % \midrule -% {}[\meta{TikZ Settings}] & Executes given TikZ settings during the drawing +% {}[\meta{TikZ Keys}] & Executes given TikZ settings during the drawing % process. This settings will be re-executed when the internal drawing path is renewed which % can cause side-effects. \Example{H[blue]LH} \\ -% {}[|\meta{TikZ Settings}|] & Executes given TikZ settings during the drawing +% {}[|\meta{TikZ Keys}|] & Executes given TikZ settings during the drawing % process like \texttt{[ ]} but does not re-executes them. % {\Example{D{.} [|/utils/exec={\def\m{...}}|] D{.} D{.}}} \\ -% {}[!\meta{TikZ Settings}!] & Executes given TikZ settings during the +% {}[!\meta{TikZ Keys}!] & Executes given TikZ settings during the % \emph{parsing} process. Because this makes only sense for internal settings % the default path is `\texttt{/tikz/timing}', not `\texttt{/tikz}' like in all % other settings macros. \Example{H[!wscale=2.5!]LH} \\ -% {}[[\meta{TikZ Settings}]] & Executes given TikZ settings first during the +% {}[[\meta{TikZ Keys}]] & Executes given TikZ settings first during the % parsing process and again during the drawing process. This is for settings % which are needed for width calculations and again for the drawing code, \eg % the slope values. \Example{H[[timing/slope=.5]]L $\slope$H} \\ +% \midrule % ; & Renews the internal drawing path which ends the scope of all options % given by \texttt{[\,]}. \Example{H;[blue]L;H} \\ % , & Same as `\texttt{;}', but timing specific options (atm.: slopes and line @@ -1165,13 +1343,12 @@ % the input string so it can be used as width for the next character. The macros % \cs{slope}=\cs{lslope}, \cs{dslope}, \cs{zslope} and \cs{wscale} can be used % to access the corresponding values. \Example{D{} $ \dslope $ D{} D} \\ -% \bottomrule -% \end{tabularx}} -% \end{table} +% \end{supertabular} +% \endgroup % \MakeShortVerb{\|} % % \clearpage -% \subsection{Macro for use in Text Mode} +% \section{Macro for use in Text Mode} % \vspace{-\bigskipamount}% % \DescribeMacro{texttiming}{\oarg{initial~character/TikZ % Settings}\marg{characters}} @@ -1220,10 +1397,9 @@ % TikZ styles "timing/before text" and "timing/after text". For backward % compatibility these styles default to the two macros. % +% {\small % (Deprecated) Example: |\let\texttimingbefore\texttiminggrid| adds a grid into the -% background of the \cs{texttiming} diagram. A more \LaTeX-stylish way to do -% this is |\renewcommand*{\textttimingbefore}{\texttiminggrid}|. See below for an up-to-date way -% to achieve this. +% background of the \cs{texttiming} diagram.} % % \DescribeMacro{texttiminggrid}{\hspace{2.5em}\textbf{Deprecated!}} % This macro should only be used inside \cs{texttimingbefore} or @@ -1236,9 +1412,9 @@ % % % \newpage -% \subsection{Macro for use inside TikZ-Pictures} +% \section{Macro for use inside TikZ-Pictures} % -% \DescribeMacro{timing}{\oarg{TikZ Settings}\ ^^A +% \DescribeMacro{timing}{\oarg{TikZ Keys}\ ^^A % at \parg{TikZ Coordinate}\ \{\oarg{initial character}\meta{characters}\};} % This macro does the same as \cs{texttiming} but is designed to be used inside % a \envv{tikzpicture} environment and only there. Like normal TikZ macros @@ -1257,8 +1433,11 @@ % % Example: |\tikz \timing [green] at (1,2) {[L]HLZDZLH};| gives `\tikz \timing % [green] at (1,2) {[L]HLZDZLH};'. -% -% \subsubsection{Timing Shape Anchors}\label{sec:timingshape} +% +% \ifprintversion\else +% \clearpage +% \fi +% \subsection*{Timing Shape Anchors}\label{sec:timingshape} % Every timing diagram line produced by \cs{timing}, which includes the rows in % \env{tikztimingtable}, is also a PGF shape (node) with several anchors. These % are shown in Figure~\ref{fig:shape}. @@ -1282,191 +1461,34 @@ % % \begin{figure} % \centering +% \scaleto{\textwidth}{%^^A % \begin{tikzpicture}[timing,y=1.5cm,x=1.5cm,timing/slope=0] % \timing [y=1.5cm,x=1.5cm,gray,thick] at (0,0) {HLHLHL}; % \node[name=s,shape=tikztiming@shape,anchor=origin] at (0,0) {}; % \foreach \anchor/\placement in -% {north west/above left, north/above, north east/above right, -% west/left, center/right, east/right, -% mid west/right, mid/left, mid east/left, -% base west/left, base/left, base east/above right, -% south west/below left, south/below, south east/below right, -% low start/below right, mid start/below right, high start/above right, -% low mid/above right, high mid/right, -% low end/below left, mid end/below left, high end/above left, -% start/left, end/right, origin/right} +% {north west/above left, north/above, north east/above right, +% west/left, center/right, east/right, +% mid west/right, mid/left, mid east/left, +% base west/left, base/left, base east/above right, +% south west/below left, south/below, south east/below right, +% low start/below right, mid start/below right, high start/above right, +% low mid/above right, high mid/right, +% low end/below left, mid end/below left, high end/above left, +% start/left, end/right, origin/right} % \draw[shift=(s.\anchor)] plot[mark=x] coordinates{(0,0)} % node[\placement] {\tiny\texttt{(s.\anchor)}}; -% \end{tikzpicture} +% \end{tikzpicture}%^^A +% } % \caption[Timing Shape Anchors]{Timing Shape Anchors. The \texttt{start} and % \texttt{end} anchors mark the start and end of the timing % signal.}\label{fig:shape} % \end{figure} % -% \iffalse -% \subsubsection{In-Line Nodes Shape Anchors} -% A default shape for In-Line Nodes/Coordinates ("N" character) is provided -% which is named `\texttt{tikztiming coordinate}'. Like the PGF standard shape -% `\texttt{coordinate}' this shape does not draw anything. However, it provides -% anchors for the logical high, low and middle ("mid") levels, as well as for -% the three slopes |lslope|, |dslope| and |zslope| (full and half values). This -% anchors can be used to access all possible connection points of default -% transitions as shown in Figure~\ref{fig:coordnodeanchors}. This is useful for -% drawing relationship arrows or similar graphics between signals. -% -% Because the node modifier can not look-ahead to the next character it does not -% know which transition will occur. Therefore all anchors are provided for all -% nodes. The user can/must select the suitable anchor(s) for every nodes. -% -% See Example~\ref{exa:inlinenodes} for an demonstration. -% -% \begin{figure} -% \tikzset{% -% timing/slope=.25, -% } -% \def\nx{4} -% \def\ny{-3} -% \begin{tikzpicture}[ -% timing/.append style={x=1cm,y=1cm}, -% timing/picture, -% timing/font=\sffamily\scriptsize, -% ultra thick, -% step=.5, -% help lines/.style={thin,gray,semitransparent} -% ] -% -% \draw [help lines,shift={(\nx,-1*\ny)}] (0,0) grid +(2,1); -% \timing at (\nx,-1*\ny) {S N(x)}; -% \draw [red] (x.low) circle(1pt); -% \draw [yellow] (x.mid) circle(1pt); -% \draw [green] (x.high) circle(1pt); -% \node [left] at (x.high) {(x.high)}; -% \node [left] at (x.mid) {(x.mid)}; -% \node [left] at (x.low) {(x.low)}; -% \node [below=3ex] at (x.low) {\meta{any} \texttt{N(x)} \meta{any}}; -% -% \draw [help lines,shift={(0,0)}] (0,0) grid +(2,1); -% \timing at (0,0) {H N(x) L}; -% \draw [blue] (x) circle(3pt); -% \draw [red] (x.low lslope) circle(1pt); -% \draw [yellow] (x.mid lslope/2) circle(1pt); -% \draw [green] (x.high) circle(1pt); -% \node [above] at (x) {(x)}; -% \node [right] at (x.high) {(x.high)}; -% \node [left] at (x.mid lslope/2) {(x.mid lslope/2)}; -% \node [left] at (x.low lslope) {(x.low lslope)}; -% \node [below=3ex] at (x.low) {\texttt{H N(x) L}}; -% -% \draw [help lines,shift={(\nx,0)}] (0,0) grid (2,1); -% \timing at (\nx,0) {H N(x) D}; -% \draw [blue] (x) circle(3pt); -% \draw [yellow] (x.mid dslope/2) circle(1pt); -% \draw [green] (x.high) circle(1pt); -% \draw [teal] (x.high dslope) circle(1pt); -% \draw [red] (x.low dslope) circle(1pt); -% \node [above left] at (x) {(x)~~~~}; -% \node [above] at (x.high) {(x.high)}; -% \node [left] at (x.mid dslope/2) {(x.mid zslope/2)}; -% \node [below right] at (x.high dslope) {(x.high dslope)}; -% \node [above right] at (x.low dslope) {(x.low dslope)}; -% \node [below=3ex] at (x.low) {\texttt{H N(x) D}}; -% -% \draw [help lines,shift={(2*\nx,0)}] (0,0) grid +(2,1); -% \timing at (2*\nx,0) {H N(x) Z}; -% \draw [blue] (x) circle(3pt); -% \draw [yellow] (x.mid zslope) circle(1pt); -% \draw [green] (x.high) circle(1pt); -% \node [above] at (x) {(x)}; -% \node [right] at (x.high) {(x.high)}; -% \node [left] at (x.mid zslope) {(x.mid zslope)}; -% \node [below=3ex] at (x.low) {\texttt{H N(x) Z}}; -% -% \draw [help lines,shift={(0,\ny)}] (0,0) grid +(2,1); -% \timing at (0,\ny) {L N(x) H}; -% \draw [blue] (x) circle(3pt); -% \draw [green] (x.high lslope) circle(1pt); -% \draw [yellow] (x.mid lslope/2) circle(1pt); -% \draw [red] (x.low) circle(1pt); -% \node [below] at (x) {(x)}; -% \node [left] at (x.high lslope) {(x.high lslope)}; -% \node [left] at (x.mid lslope/2) {(x.mid lslope/2)}; -% \node [right] at (x.low) {(x.low)}; -% \node [below=3ex] at (x.low) {\texttt{L N(x) H}}; -% -% \draw [help lines,shift={(\nx,\ny)}] (0,0) grid +(2,1); -% \timing at (\nx,\ny) {L N(x) D}; -% \draw [blue] (x) circle(3pt); -% \draw [yellow] (x.mid dslope/2) circle(1pt); -% \draw [red] (x.low) circle(1pt); -% \draw [orange] (x.low dslope) circle(1pt); -% \draw [green] (x.high dslope) circle(1pt); -% \node [left] at (x.mid dslope/2) {(x.mid dslope/2)}; -% \node [below left] at (x) {(x)~~~~}; -% \node [below] at (x.low) {(x.low)}; -% \node [above right] at (x.low dslope) {(x.low dslope)}; -% \node [above] at (x.high dslope) {(x.high dslope)}; -% \node [below=3ex] at (x.low) {\texttt{L N(x) D}}; -% -% \draw [help lines,shift={(2*\nx,\ny)}] (0,0) grid +(2,1); -% \timing at (2*\nx,\ny) {L N(x) Z}; -% \draw [blue] (x) circle(3pt); -% \draw [yellow] (x.mid zslope) circle(1pt); -% \draw [red] (x.low) circle(1pt); -% \node [below] at (x) {(x)}; -% \node [left] at (x.mid zslope) {(x.mid zslope)}; -% \node [right] at (x.low) {(x.low)}; -% \node [below=3ex] at (x.low) {\texttt{L N(x) Z}}; -% -% \draw [help lines,shift={(0,2*\ny)}] (0,0) grid +(2,1); -% \timing at (0,2*\ny) {D N(x) H}; -% \draw [blue] (x) circle(3pt); -% \draw [red] (x.low) circle(1pt); -% \draw [yellow] (x.mid dslope/2) circle(1pt); -% \draw [green] (x.high) circle(1pt); -% \draw [teal] (x.high dslope) circle(1pt); -% \node [below] at (x) {(x)}; -% \node [above left,inner xsep=0pt] at (x.high) {(x.high)}; -% \node [above] at (x.high dslope) {~~~~~~~~~(x.high dslope)}; -% \node [left] at (x.mid dslope/2) {(x.mid dslope/2)}; -% \node [right] at (x.low) {(x.low)}; -% \node [below=3ex] at (x.low) {\texttt{D N(x) H}}; -% -% \draw [help lines,shift={(\nx,2*\ny)}] (0,0) grid +(2,1); -% \timing at (\nx,2*\ny) {D N(x) L}; -% \draw [blue] (x) circle(3pt); -% \draw [yellow] (x.mid dslope/2) circle(1pt); -% \draw [red] (x.low) circle(1pt); -% \draw [green] (x.high) circle(1pt); -% \draw [orange] (x.low dslope) circle(1pt); -% \node [below left] at (x) {(x)~~~~}; -% \node [below] at (x.low) {(x.low)}; -% \node [left] at (x.mid dslope/2) {(x.mid dslope/2)}; -% \node [above right] at (x.low dslope) {(x.low dslope)}; -% \node [above] at (x.high) {(x.high)}; -% \node [below=3ex] at (x.low) {\texttt{D N(x) L}}; -% -% \draw [help lines,shift={(2*\nx,2*\ny)}] (0,0) grid +(2,1); -% \timing at (2*\nx,2*\ny) {D N(x) Z}; -% \draw [blue] (x) circle(3pt); -% \draw [yellow] (x.mid dslope/2) circle(1pt); -% \draw [red] (x.low) circle(1pt); -% \draw [green] (x.high) circle(1pt); -% \node [below] at (x) {(x)}; -% \node [left] at (x.mid dslope/2) {(x.mid dslope/2)}; -% \node [right] at (x.high) {(x.high)}; -% \node [right] at (x.low) {(x.low)}; -% \node [below=3ex] at (x.low) {\texttt{D N(x) Z}}; -% -% \end{tikzpicture} -% \caption{Anchors of In-Line Nodes. -% (\texttt{timing/slope=.25})}\label{fig:coordnodeanchors} -% \end{figure} -% \fi % % \clearpage -% \subsection{Table for Timing Diagrams} +% \section{Table for Timing Diagrams} % \DescribeEnv{tikztimingtable}{\oarg{TikZ settings for whole -% table}\\\meta{Signal Name}\ \ \&\ \ \oarg{\small Init.~Char./TikZ Settings for +% table}\\\meta{Signal Name}\ \ \&\ \ \oarg{\small Init.~Char./TikZ Keys for % Row}\ \meta{Characters} \textbackslash\textbackslash\\\dots\\ % \hspace*{-1em}\cs{extracode}\ \% Optional\\\meta{additional code}} % This environment can be used to typeset multi-line timing diagrams. The @@ -1482,7 +1504,7 @@ % names, respectively. Additional \pkg{tikz} drawing code can be insert at the % end of the table using \cs{extracode}. % -% \DescribeMacro{extracode}{\oarg{TikZ Settings}} +% \DescribeMacro{extracode}{\oarg{TikZ Keys}} % This macro is only defined inside a \env{tikztimingtable} environment. In earlier % versions of this package it could only be used after the last table line (\ie after a |\\|). % If used there all code between it and the |\end{tikztimingtable}| will be placed inside the same @@ -1491,8 +1513,8 @@ % The optional \meta{settings} therefore affect all following code until the end of the picture. % % It is also possible to draw something behind the timing diagram by -% using using the \env{background} environment or the PGF background layer: -% |\begin{pgfonlayer}{background}|\ldots|\end{pgfonlayer}|. +% using using the \env{background} environment or the PGF background layer:\\[\smallskipamount] +% |\begin{pgfonlayer}{background}|\ldots|\end{pgfonlayer}| % % \DescribeMacro{endextracode}{} % From\NewIn{v0.7} version 0.7 on it is possible to add further timing rows after an |extracode| section by using @@ -1501,7 +1523,7 @@ % anywhere inside the table, including at the very start before any rows are processed. Early % insertion of extra code is necessary for \eg limiting the bounding box or setting up a clipping path. % -% \DescribeEnv{extracode}{\oarg{TikZ Settings}} +% \DescribeEnv{extracode}{\oarg{TikZ Keys}\\\meta{extra drawing code}} % Instead\NewIn{v0.7} of using \cs{extracode} \dots \cs{endextracode}, which is actual plain\TeX\ syntax, this % \LaTeX\ style environment can be used. Like any environment it creates a \TeX\ group around its % content, but no TikZ |scope| is created to allow drawing code (\eg clipping paths) to affect the @@ -1510,18 +1532,18 @@ % Please note that while \cs{endextracode} is optional if \cs{extracode} is used at the end of the table, % a \cs{begin}\env{extracode} must always be closed by \cs{end}\env{extracode}. % -% \subsubsection{Macros for \cs{extracode} Section} +% \subsection*{Macros for \cs{extracode} Section} % The following macros are only defined inside a \env{tikztimingtable} after the % macro \cs{extracode}. They are useful for drawing additional material. % -% \DescribeMacro{tablegrid}{\meta{*}\oarg{TikZ Settings}} +% \DescribeMacro{tablegrid}{\meta{*}\oarg{TikZ Keys}} % After \css{extracode} this macro draws a grid in the background of the table. % A separate grid is drawn for each row. The normal version draws all grids with % the width of the widest row while the star version draws them with the width % of the corresponding row. Because this macro draws material into the |background| % layer it must not be placed inside a |pgfonlayer| environment itself. % -% \DescribeMacro{fulltablegrid}{\oarg{TikZ Settings}} +% \DescribeMacro{fulltablegrid}{\oarg{TikZ Keys}} % After \css{extracode} this macro draws a big grid over all rows in the % background of the table. % @@ -1542,7 +1564,7 @@ % diagram line in the table. Example: If the longest line would be % "H 2.3L z" than \cs{twidth} would be $1+2.3+0.5=3.8$. % -% \DescribeMacro{horlines}{\oarg{TikZ Settings}\marg{list}} +% \DescribeMacro{horlines}{\oarg{TikZ Keys}\marg{list}} % Draws horizontal lines, optionally with the given \meta{Settings}, at the base % line of the rows given by \meta{list}. The PGF macro % \css{foreach}\footnote{See the \texttt{pgf} manual for more details.} is @@ -1553,43 +1575,47 @@ % If the list is empty the default "1,2,...,\nrows" is used which draws lines % for all rows. % -% \DescribeMacro{vertlines}{\oarg{TikZ Settings}\marg{list}} +% \DescribeMacro{vertlines}{\oarg{TikZ Keys}\marg{list}} % Like \cs{horlines} but draws vertical lines and the listed numbers a relative % to the basic width. % If the list is empty the default "0,1,...,\twidth" is used which draws lines % after every period width. % -% \DescribeMacro{tableheader}{\oarg{TikZ Settings}\marg{Description +% \DescribeMacro{tableheader}{\oarg{TikZ Keys}\marg{Description % Title}\marg{Signal Title}} % This macro adds a table head row on top of the table. The two mandatory % arguments provide the header text for the description and signal columns. % -% \DescribeMacro{tablerules}{\oarg{TikZ Settings}} +% \DescribeMacro{tablerules}{\oarg{TikZ Keys}} % This macro adds top and bottom rules to the table in the same (or at least % very similar) way as the \texttt{booktabs} package is doing it for normal % \texttt{tabular}s. The current bounding box is used to calculate the needed % rule length, which makes this macro position dependent if further code % changes the bounding box. If the \cs{tableheader} macro was used beforehand it -% also draws a thinner horizontal line (like \texttt{booktabs} \cs{midrule}) between the table head and body. +% also draws a thinner horizontal line (like \texttt{booktabs} \cs{midrule}) +% between the table head and body. % -% \DescribeEnv{background}{\oarg{TikZ Settings}\\\meta{drawing commands}} +% \DescribeEnv{background}{\oarg{TikZ Keys}\\\meta{drawing commands}} % This environment can be used to draw material on the |background| layer and is % an abbreviation for:\\[\medskipamount] % | \begin{pgfonlayer}{background}|\\ -% | \begin{scope}|\oarg{TikZ Settings}\\ +% | \begin{scope}|\oarg{TikZ Keys}\\ % | |\meta{drawing commands}\\ % | \end{scope}|\\ % | \end{pgfonlayer}| % -% \subsubsection*{Positions \& Scalings inside the Table} -% \textbf{Note:} The anchors provided by the timing shape -% (Section~\ref{sec:timingshape}) should now be used to position additional -% graphics. +% \subsection*{Scaling the Table} +% The standard "scale" setting of TikZ will not scale all parts of the table correctly, +% \eg the line width and nodes will keep their original size. However there are scaled +% relative to the font size. Alternatively the table can be scaled using the +% \cs{scalebox}\marg{factor}\marg{content} macro from the \pkg{graphicx} package or +% be placed inside a scaled \cs{node} inside another \env{tikzpicture} environment. % +% \subsection*{Positions \& Nodes inside the Table} +% +% \subsubsection*{Coordinates} % The first row starts at $y=0$ and the next rows are each % |-1*\rowdist| lower than the previous one. -% ^^A The very last one can be accessed by the tikz coordinate `\texttt{(last -% ^^A row)}'. % The vertical unit is 1 \textsf{signal height} and the default row distance is % `2' (=$2\times$\textsf{signal height}). This means that a normal table with % three rows goes from $y=+1$ (base line at 0 + 1 \textsf{signal height}) to @@ -1602,9 +1628,121 @@ % scaled using the period width. Example: |HHHh| has a width of 3.5. % The label column starts at $x=-$|\coldist| and the text is right align with % the right border at this position. +% See Figure~\ref{fig:distnodestable} for an illustration. +% +% \subsubsection*{Nodes} +% Each timing line is a timing node (see section~\ref{sec:timingshape}) +% labeled (not fully correctly) as `|row|\meta{number}', where the first row has the number 1 and the last +% one the number provided in \cs{nrows}, but can also accessed using the alias "last row". +% The corresponding labels are normal rectangle nodes named "label0", "label1", \dots, +% `|label|\cs{nrows}'/"last label". +% +% Both groups of `rows' and `labels' are enclosed in a rectangle node called "all rows" and +% "all labels", respectively. These nodes can be used to draw material relative to the rows, +% \eg the macros \cs{tableheader} and \cs{tablerules} are making use of them. +% The headers added by \cs{tableheader} are rectangle nodes names "label header" and "row header" +% and are placed between the x-coordinates of the inner and outer border of "all labels" and "all rows" +% respectively. By default the TikZ settings "pos=0" and "anchor=base east"/"anchor=base west", respectively, +% are applied to place them in the inner border, but this +% can be changed using the styles "timing/table/header" and/or "timing/table/label header"/"timing/table/row header". +% All nodes are shown in Figure~\ref{fig:distnodestable}. +% +% +% \begin{figure} +% \centering +% \scalebox{1.15}{\Huge +% \begin{tikztimingtable}[semitransparent] +% First Row & H L H L H L \\ +% Second Row & H L H L H L \\ +% $\vdots$\hspace*{2em} & 3S N[rectangle,above,inner sep=0pt]{$\vdots$} 3S \\ +% Last Row & H L H L H L \\ +% \begin{extracode} +% \tableheader[draw=black,densely dashed,thin]{Label}{Timing} +% \tablerules +% \useasboundingbox (current bounding box.south west) rectangle (current bounding box.north east); +% \begin{background}[black,densely dashed,thin,opacity=1] +% \normalsize +% \draw (row1.north west) rectangle (row1.south east); +% \draw (row2.north west) rectangle (row2.south east); +% \draw (last row.north west) rectangle (last row.south east); +% \node [right] at (row1.east) {row1}; +% \node [right] at (row2.east) {row2}; +% \node [right] at (last row.east) {row\cs{nrows}}; +% \node [below right] at (last row.east) {last row\large\strut}; +% +% \path let \p1 = (label header.west), \p2 = (row header.east), \p3 = (all labels.west), \p4 = (all rows.east) in +% node [left] at (\x3,\y1) {label header} +% node [right] at (\x4,\y2) {row header} +% ; +% \begin{scope}[solid,semithick,black!80]\tiny +% \draw [|->] let \p1 = (label header.south east), \p2 = (all labels.west) in +% (\x1+.5\pgflinewidth,\y1-2pt) node [below left=-.4ex] {0} +% -- node [below=-.4ex,midway] {pos} (\x2,\y1-2pt) node [below right=-.4ex] {~\rlap{1}} +% ; +% \draw [|->] let \p1 = (row header.south west), \p2 = (all rows.east) in +% (\x1-.5\pgflinewidth,\y1-2pt) node [below right=-.4ex] {0} +% -- node [below=-.4ex,midway] {pos} (\x2,\y1-2pt) node [below left=-.4ex] {\llap{1}\,~} +% ; +% \end{scope} +% +% \draw [dotted,color=green] (all rows.south west) rectangle (all rows.north east); +% \node [below right,green] at (all rows.east) {all rows}; +% +% \draw (label1.north west) rectangle (label1.south east); +% \draw (label2.north west) rectangle (label2.south east); +% \draw (last label.north west) rectangle (last label.south east); +% \path let \p1 = (label1.west), \p2 = (label2.west), \p3 = (last label.west), \p4 = (all labels.west) in +% node [left] at (\x4,\y1) {label1} +% node [left] at (\x4,\y2) {label2} +% node [left] at (\x4,\y3) {label\cs{nrows}} +% node [below left] at (\x4,\y3) {last label\large\strut} +% ; +% +% \draw [dotted,color=green] (all labels.south west) rectangle (all labels.north east); +% \node [below left,green] at (all labels.west) {all labels}; +% +% \begin{scope}[help lines] +% \draw (all rows.north west) -- +(0,3.25); +% \draw (all rows.north east) -- +(0,3.25); +% \draw (all labels.north west) -- +(0,3); +% \draw (all labels.north east) -- +(0,3); +% \end{scope} +% +% \begin{scope}[solid,thick] +% \draw [fill] (0,0) circle (1pt) node [below right=-2pt] {\tiny origin}; +% \draw [>=stealth,->] (-.25,0) -- (.4,0); +% \draw [>=stealth,->] (0,-.25) -- (0,.4); +% \end{scope} +% +% \begin{scope}[dotted,gray] +% \draw (row1.south west) -- (label1.base west); +% \end{scope} +% +% \begin{scope}[solid] +% \draw (row1.north east) -- ++(5em,0) coordinate (O) -- +(5pt,0); +% \draw (row1.south east) -- ++(5em,0) coordinate (A) -- +(5pt,0); +% \draw (row2.south east) -- ++(5em,0) coordinate (B) -- +(5pt,0); +% \draw [<->] (A) -- node[midway,right] {\cs{rowdist}} (B); +% \draw [<->] (O) -- node[midway,right] {\cs{yunit}} (A); +% +% \draw (row1.south east) -- ++(0,1.5) coordinate (A) -- +(0,5pt); +% \draw (row1.south east) ++(-1,1) -- ++(0,0.5) coordinate (B) -- +(0,5pt); +% \draw [<->] (B) -- (A) node[right] {\cs{xunit}}; +% +% \draw (row1.north west) -- ++(0,7em) coordinate (A) -- +(0,5pt); +% \draw let \p1 = (row1.north west), \p2 = (label1.north east) in +% (\x2,\y2) -- (\x2,\y1+7em) coordinate (B) -- +(0,5pt); +% \draw [<->] (B) -- (A) node[right] {\cs{coldist}}; +% \end{scope} +% \end{background} +% \end{extracode} +% \end{tikztimingtable}%^^A +% }%^^A +% \caption{Distances and Nodes inside a \env{tikztimingtable}}\label{fig:distnodestable} +% \end{figure} % % \clearpage -% \subsection{Macros for use inside the Character String} +% \section{Macros for use inside the Character String} % The modifiers "@" and `\texttt{\$}' allow the user to include macros. These % macros are evaluated when the |tikz-timing| parser encounters them in the % input character string, \ie before any diagram element is drawn or any single @@ -1649,7 +1787,7 @@ % Returns the current Z slope. Set by the |timing/dslope| or indirectly by the % |timing/slope| TikZ setting. % -% \subsubsection*{Examples:} +% \subsection*{Examples:} % Changing the slope and using its value to calculate the width of a % character:\\ % |\texttiming{ HLHLHL [[timing/slope=.5]] H $\slope$L }|\\ @@ -1663,7 +1801,7 @@ % {\texttiming{ HL [!wscale=\wscale/3!] 3D{a} Z D Z [!wscale=3*\wscale!] HL }} % % \clearpage -% \subsection{Meta-Characters} +% \section{Meta-Characters} % It is possible to define recurring groups of characters and modifiers as so % called meta-characters. These characters are than expanded to the group % whenever they appear inside the character list. Please note that like for @@ -1686,7 +1824,7 @@ % when normal characters are temporary redefined as meta-characters. However, if % the group only contains spaces the meta-character is practically ignored. % -% \subsubsection*{Meta-Characters with Arguments} +% \subsection*{Meta-Characters with Arguments} % The\NewIn{v0.7} % replacement text of meta-character can now include macro arguments. % This allows the creation of more complex and flexible meta-characters. The @@ -1710,7 +1848,7 @@ % Also the modifier "@" (see Table~\ref{tab:modifiers}) together with the % \cs{setwscale} macro can be used to scale the whole group dependent on the % first argument:\\ -% "{Y}[1]}{ @{\setwscale{#1*\wscale}} Z 2D Z @{\setwscale{\wscale/#1}} }", so +% "{Y}[1]{ @{\setwscale{#1*\wscale}} Z 2D Z @{\setwscale{\wscale/#1}} }", so % "4Y" is equivalent to "4Z 8D 4Z". % % The new `\texttt{\$}' modifier can be used to calculate the width of the group @@ -1787,127 +1925,144 @@ % \texttiming{ HL .2w HLHLH 3w LH 1W LH }} % % \clearpage -% \section{Styles}\label{sec:styles} -% The generated logic signals are drawn using the style mechanism provided by -% \pkg{tikz}, which itself uses |pgfkeys| for this purpose. This styles are defined and can be redefined using -% \css{tikzset}|{|\meta{style name}|/.style=|\meta{value}|,}|. They can also be -% used in all places where \meta{TikZ Settings} is mentioned. Please note that -% path/draw specific settings might not survive the transition to characters -% which have there own color, because these start a new drawing path. For a -% more detailed explanation why this is necessary see the \pkg{tikz} manual. -% However, timing specific settings are saved and restored between internal -% paths. -% -% The package follows the directory structures approach used by TikZ/PGF and -% places all styles and other settings under the ``subdirectory'' "timing" in +% \chapter{TikZ Keys for Styles, Settings and Actions}\label{sec:styles} +% TikZ itself uses the |pgfkeys| package to define and apply drawing styles and settings. +% The same method is also used for |tikz-timing| which +% places all of the keys under the ``subdirectory'' "timing" in % the main ``directory'' `tikz', which is the default when \css{tikzset} is -% used.\\ -% ^^AExample: The slope of the transitions can be changed using the key -% ^^A"timing/slope", which can also written in the absolute form -% ^^A"/tikz/timing/slope". -% -% ^^AThe Table~\ref{tab:styles} lists all styles defined by this package. -% \begin{center}^^A{table}[b] -% \tablecaption{TikZ Styles and Settings provided and used by this Package.} -% \label{tab:styles} -% \def\en{\,\textsf{--}\,} -% \let\origtabular\tabular -% \let\endorigtabular\endtabular -% \def\tabular{\begingroup -% \setbox\mysb\hbox\bgroup -% \origtabular}% -% \def\endtabular{\endorigtabular\egroup\makebox[\textwidth][c]{\usebox\mysb} -% \endgroup}% -% \tablefirsthead{% +% used. +% This keys are simply called \emph{TikZ Keys} throughout this manual and +% can be used in all places where \meta{TikZ Keys} is mentioned, while some only make sense at specific +% places. +% Three types of keys +% are used by this package: styles, settings and actions. +% +% Styles simply define the style in which a certain element is drawn, \eg in which color or line width. +% This styles are defined and can be redefined using +% \css{tikzset}|{|\meta{style name}|/.style=|\meta{value}|}|. However, while some styles +% are initial empty, some hold internal settings and therefore user styles should only be added +% using `|.append style=|\meta{value}'. +% +% Settings are TikZ keys which await an argument and set an internal macro or length. They are +% like \cs{setlength} and \cs{renewcommand}. They should not be redefined by the user. +% +% Action are TikZ keys which perform a drawing or other action on the current element, either directly or +% by en-/disable an internal setting which then in turn triggers the drawing process. Therefore some +% actions can be globally and/or locally but others only make sense if used locally on a single |tikz-timing| +% macro or environment or even a scope inside a \env{tikztimingtable}. +% Action can be very similar to settings but they always execute code instead of only setting/redefining it. +% +% \begingroup +% \def\C{Action} +% \def\S{Style} +% \def\s{Setting} +% \def\en{\,\textsf{--}\,} +% +% \section*{General} +% \begin{tabularx}{\textwidth}{>{\ttfamily}ll>{\raggedright\arraybackslash}X} % \toprule -% \normalfont Style/Setting & Description \\ +% \normalfont TikZ Key & Type & Description \\ % \midrule -% }% -% \tablehead{% -% \multicolumn{2}{c}% -% {\raisebox{\belowcaptionskip}{\tablename\ \thetable{} -- -% continued from previous page}} \\ +% timing & \S & Base settings like signal height and period width.\\ +% timing/font=\meta{font commands} & \s & Sets the normal \texttt{font} key and sets \texttt{x}/\texttt{y} keys to 1.6ex.\\ +% timing/intext & \S & Used for \cs{texttiming}. Depends on \texttt{timing}.\\ +% timing/picture & \S & Usable for own \texttt{tikzpictures} to set timing settings.\\ +% timing/inline node & \S & Used for nodes created by the \texttt{N} character. Defaults to \texttt{coordinate}.\\ +% \midrule +% timing/initchar=\meta{char} & \s & Sets initial character. Only valid as first optional argument in table rows or in \cs{texttiming}.\\ +% \midrule +% timing/metachar=\marg{C}\oarg{\#arg}\marg{G}& \C& Sets meta-character \meta{C} to character group \meta{G}.\\ +% \bottomrule +% \end{tabularx} +% +% \section*{Slopes} +% \begin{tabularx}{\textwidth}{>{\ttfamily}ll>{\raggedright\arraybackslash}X} % \toprule -% \normalfont Style/Setting & Description \\ +% \normalfont TikZ Key & Type & Description \\ % \midrule -% }% -% \tabletail{% +% timing/slope=\meta{0.0\en1.0} & \s & Sets slope for logic transitions. \newline This also sets \texttt{dslope=2*slope}, \texttt{zslope=slope/2}.\\ +% timing/lslope=\meta{0.0\en1.0} & \s & Sets slope for logic transitions only. Default: 0.1\\ +% timing/dslope=\meta{0.0\en1.0} & \s & Sets slope for data transitions. Default: 0.2\\ +% timing/zslope=\meta{0.0\en1.0} & \s & Sets slope for Z transitions. Default: 0.05\\ % \bottomrule -% ^^A\multicolumn{2}{r}{Continued on next page}\\ -% } -% \tablelasttail{% +% \end{tabularx} +% +% \section*{Texttiming} +% \begin{tabularx}{\textwidth}{>{\ttfamily}ll>{\raggedright\arraybackslash}X} +% \toprule +% \normalfont TikZ Key & Type & Description \\ +% \midrule +% timing/outer sep=\meta{dim} & \s & Sets outer separation around \cs{texttiming} macros. \\ +% timing/outer xsep=\meta{dim} & \s & See above. Only X-Coordinate. (Default:~0pt) \\ +% timing/outer ysep=\meta{dim} & \s & See above. Only Y-Coordinate. (Default:~0pt) \\ % \bottomrule -% } -% \begin{supertabular}{>{\ttfamily}l>{\raggedright\arraybackslash}p{.675\textwidth}} -% timing & Base settings like signal height \& period width.\\ -% timing/font & Sets the normal \texttt{font} key and sets -% \texttt{x}/\texttt{y} keys to 1.6ex.\\ -% timing/intext & Used for \cs{texttiming}. Depends on \texttt{timing}.\\ -% timing/picture & Usable for own \texttt{tikzpictures} to set timing -% settings.\\ -% timing/grid & Used for grids. Depends on \texttt{help lines} and \texttt{timing}. \\ -% timing/draw grid & Enables background grids for \cs{timing} macros. \\ -% timing/no grid & Disabled background grids for \cs{timing} macros. \\ -% timing/table & Used for \env{tikztimingtable}. Depends on \texttt{timing}.\\ -% timing/table/grid & Used for table grid. Depends on \texttt{timing/grid}.\\ -% timing/table/lines & Used for \cs{horlines} and \cs{vertlines}. \\ -% timing/table/rules & Used for \cs{tablerules} for top and bottom lines. -% \\ -% timing/table/midrules & Used for \cs{tablerules} between table head and -% body. \\ -% timing/table/header & Used for \cs{tableheader}. \\ -% timing/inline node & Used for nodes created by the \texttt{N} character. -% Defaults to \texttt{coordinate}.\\ +% \end{tabularx} +% +% \section*{Grid} +% \begin{tabularx}{\textwidth}{>{\ttfamily}ll>{\raggedright\arraybackslash}X} +% \toprule +% \normalfont TikZ Key & Type & Description \\ +% \midrule +% timing/grid & \S & Style used for drawing grids. Depends on \texttt{help lines} and \texttt{timing}. \\ +% timing/draw grid & \C & Enables background grids for \cs{timing} macros. \\ +% timing/no grid & \C & Disabled background grids for \cs{timing} macros. \\ +% \bottomrule +% \end{tabularx} +% +% \section*{Table} +% \begin{tabularx}{\textwidth}{>{\ttfamily}ll>{\raggedright\arraybackslash}X} +% \toprule +% \normalfont TikZ Key & Type & Description \\ % \midrule -% timing/outer sep=\meta{dim} & Sets outer separation around \cs{texttiming} -% macros. \\ -% timing/outer xsep=\meta{dim} & See above. Only X-Coordinate. -% (Default:~0pt) \\ -% timing/outer ysep=\meta{dim} & See above. Only Y-Coordinate. -% (Default:~0pt) \\ +% timing/table & \S & Used for \env{tikztimingtable}. Depends on \texttt{timing}.\\ +% timing/table/grid & \S & Used for table grid. Depends on \texttt{timing/grid}.\\ +% timing/table/lines & \S & Used for \cs{horlines} and \cs{vertlines}. \\ +% timing/table/rules & \S & Used for \cs{tablerules} for top and bottom lines. \\ +% timing/table/midrules & \S & Used for \cs{tablerules} between table head and body. \\ +% timing/table/header & \S & Used for \cs{tableheader}. \\ +% timing/table/title header & \S & Used for label header in \cs{tableheader}. \\ +% timing/table/row header & \S & Used for timing row header in \cs{tableheader}. \\ % \midrule -% timing/\meta{lowercase char} & Style for character \meta{char}. Not used -% for `\texttt{H}' and `\texttt{L}'. \\ -% timing/\meta{lc char}/background & Background style for characters `\texttt{D}' -% and `\texttt{U}'. \\ -% timing/\meta{lc char}/text & Text style for character \meta{char}. Only -% defined for `\texttt{D}'. \\ +% timing/rowdist=\meta{distance} & \s & Sets (baseline) distance between rows in a tikztimingtable. Default: 2 (=$2\times$signal height)\\ +% timing/coldist=\meta{distance} & \s & Sets distance between columns in a tikztimingtable. Default: 1 (=$1\times$period width)\\ +% \bottomrule +% \end{tabularx} +% +% \section*{Character Styles} +% \begin{tabularx}{\textwidth}{>{\ttfamily}ll>{\raggedright\arraybackslash}X} +% \toprule +% \normalfont TikZ Key & Type & Description \\ % \midrule -% timing/text format=\meta{macros} & Define macros which are placed before -% the text of `\texttt{D\{text\}}'. The text is enclosed in braces to allow -% the last macro to take it as an argument. A \cs{strut} is a good choice to -% ensure a common baseline.\\ -% timing/initchar=\meta{char} & Sets initial character. Only valid as first -% optional argument in table rows or \cs{texttiming}.\\ -% timing/metachar=\marg{C}\oarg{\#arg}\marg{G} & Sets meta-character -% \meta{C} to character group \meta{G}.\\ -% timing/slope=\meta{0.0\en1.0} & Sets slope for logic transitions. -% \newline This also sets \texttt{dslope=2*slope}, -% \texttt{zslope=slope/2}.\\ -% timing/lslope=\meta{0.0\en1.0} & Sets slope for logic transitions only. -% Default: 0.1\\ -% timing/dslope=\meta{0.0\en1.0} & Sets slope for data transitions. -% Default: 0.2\\ -% timing/zslope=\meta{0.0\en1.0} & Sets slope for Z transitions. Default: -% 0.05\\ +% timing/\meta{lowercase char} & \s & Style for character \meta{char}. Not used for `\texttt{H}' and `\texttt{L}'. \\ +% timing/\meta{lc char}/background & \s & Background style for characters `\texttt{D}' and `\texttt{U}'. \\ +% timing/\meta{lc char}/text & \s & Text style for character \meta{char}. Only defined for `\texttt{D}'. \\ +% \midrule +% timing/text format=\meta{macros} & \s & Define macros which are placed before the text of `\texttt{D\{text\}}'. The text is enclosed in braces to +% allow the last macro to take it as an argument. A \cs{strut} is a good choice to ensure a common baseline.\\ +% \bottomrule +% \end{tabularx} +% +% \section*{Debug} +% Some debug settings for users (first group) and the package developer (last group). +% +% \medskip\noindent +% \begin{tabularx}{\textwidth}{>{\ttfamily}ll>{\raggedright\arraybackslash}X} +% \toprule +% \normalfont TikZ Key & Type & Description \\ % \midrule -% timing/rowdist=\meta{distance} & Sets (baseline) distance between rows in -% a tikztimingtable. Default: 2 (=$2\times$signal height)\\ -% timing/coldist=\meta{distance} & Sets distance between columns in a -% tikztimingtable. Default: 1 (=$1\times$period width)\\ +% timing/debug/nodes & \C & Enables marking of named inline nodes. \\ +% timing/debug/node & \S & Format style for inline node marker label, which itself is a TikZ node. \\ +% timing/debug/markcmd=\meta{code} & \s & TikZ drawing code to draw marker (except label). The code can access the node name as \cs{N}. \\ +% timing/debug/scope & \S & Format for scope of node markers. \\ % \midrule -% timing/debug/nodes & Enables marking of named inline nodes. \\ -% timing/debug/node & Format style for inline node marker label, which itself is a TikZ node. \\ -% timing/debug/markcmd=\meta{code} & TikZ drawing code to draw marker (except label). The code can access the node name as \cs{N}. \\ -% timing/debug/scope & Format for scope of node markers. \\ -% timing/debug/level=\meta{integer} & Sets debug output level. This is only important for developers. \\ -% \end{supertabular} -% ^^A\\[\smallskipamount] -% ^^A\emph{Note:} As a convention all style names are completely in lowercase. -% \end{center}^^A{table} +% timing/debug/level=\meta{integer} & \s & Sets debug output level. This is only important for developers. \\ +% \bottomrule +% \end{tabularx} +% +% \endgroup % % \clearpage -% \section{Libraries for Further Characters} +% \chapter{Libraries for Further Characters} % All default timing characters described in Table~\ref{tab:chars} are always % made available by this package. Further, less-common characters are provided % by libraries which are loaded with the macro @@ -1920,34 +2075,36 @@ % The date is used as a version number like for packages and is identical to the date % of the |tikztiming| package. % -% \subsection{Arrows} +% \clearpage +% \library{arrows}{Arrows} % The library "arrows" enables two characters "A" and "W" which draw % vertical up and down \textit{A}rro\!\textit{W}s. Such arrows are used in % timing diagrams to mark special polarized events, like clock edges of another % signal. % % The width provided with these character is added as whitespace after the -% ``zero-width'' arrow: "A2AA" results in `\,\texttiming{A2AA}'. This space +% ``zero-width'' arrow: "A2AA" results in `\texttiming{A2AA}'. This space % can be avoided by specifying the width to zero: "0A". Like the "C" and % "T" characters the subsequent arrow characters are not combined into one. % % The arrow tips can be changed using the TikZ styles for this characters. See -% section~\ref{sec:styles} for more information. The "A" character should not be used -% together with any other characters except with "S" (space). +% section~\ref{sec:styles} for more information. The "A" and "W" character should +% only be used which each each other, but not together with any other characters +% except with "S" (space). % % \begin{table}[H] % \centering % \caption{Examples for Arrow Characters.}\label{tab:arrows} % \begin{tikztimingexampletable} -% 0A \\ -% AAA \\ -% 3A \\ -% 3{A} \\ -% 3A 3A \\ -% 3a 3a \\ -% AW AW \\ -% 3{AW} \\ -% 3{aw} \\ +% 0A \\ +% AAA \\ +% 3A \\ +% 3{A} \\ +% 3A 3A \\ +% 3a 3a \\ +% AW AW \\ +% 3{AW} \\ +% 3{aw} \\ % 2S 2A 3W A W \\ % \extracode % \tablegrid* @@ -1955,7 +2112,7 @@ % \end{table} % % \clearpage -% \subsection{Either High or Low} +% \library{either}{Either High or Low} % The library "either" enables the "E" character which stands for % `\textit{either high or low}'. This character is designed to be used with the % "H" and "L" characters to display a uncertainty of a transition. @@ -1972,44 +2129,41 @@ % \centering % \caption{Examples for the `\texttt{E}' Character.}\label{tab:either} % \begin{tikztimingexampletable}[timing/e/background/.style={fill=black!20}] -% L E H \\ -% L D H \\ -% H E L \\ -% H D L \\ -% L E E H \\ -% L 3{.25E} H \\ -% H E E L \\ +% L E H \\ +% L D H \\ +% H E L \\ +% H D L \\ +% L E E H \\ +% L 3{.25E} H \\ +% H E E L \\ % L EEE HH EEE L \\ -% l e e h \\ -% h e e l \\ -% H 2E L \\ -% H 2{E} L \\ -% H 5{e} L \\ -% H E E H \\ -% L E E L \\ +% l e e h \\ +% h e e l \\ +% H 2E L \\ +% H 2{E} L \\ +% H 5{e} L \\ +% H E E H \\ +% L E E L \\ % \end{tikztimingexampletable} % \par\medskip % \makebox[\textwidth][c]{% % \begin{tabular}{lc} % \toprule -% Settings (\texttt{timing/e/.cd}) & Resulting Diagram (\texttt{LL EE HH}) -% \\\midrule -% \texttt{.style=\{dotted,gray\}} & -% \texttiming[timing/e/.style={dotted,gray}]{LL EE HH} \\ -% \texttt{background/.style=\{fill=gray\}} & -% \texttiming[timing/e/background/.style={fill=gray}] -% {LL EE HH} \\ +% Settings (\texttt{timing/e/.cd}) & Resulting Diagram (\texttt{LL EE HH}) \\ +% \midrule +% \texttt{.style=\{dotted,gray\}} & \texttiming[timing/e/.style={dotted,gray}]{LL EE HH} \\ +% \texttt{background/.style=\{fill=gray\}} & \texttiming[timing/e/background/.style={fill=gray}]{LL EE HH} \\ % \bottomrule % \end{tabular} % }% % \end{table} % % \clearpage -% \subsection{Overlays} +% \library{overlays}{Overlays} % The library "overlays" enables the "O" character which allows the % overlaying of timing characters, i.e.~different groups of timing characters % are drawn on top of each other. This is not to be confused with `dynamic' overlay -% provided by the presentation class |beamer|. The |tikz-timing| library |beamer| provides +% provided by the presentation class |beamer|. The |tikz-timing| library \lib{beamer} provides % some support for such overlays. % % The "O" character awaits a set of character @@ -2041,26 +2195,47 @@ % \begin{table}[H] % \centering % \caption{Examples for the `\texttt{O}' Overlay Character.}\label{tab:overlays} +% \ifprintversion +% \begin{tikztimingexampletable}[timing/draw grid] +% LLL O{HH}{LL} HHH \\ +% LLL O{HHH}{LL} HHH \\ +% LLL O{;[gray]HH.1H;}{LLH} HH \\ +% LL O{L;[gray]HH.1H;}{LLLH} HH \\ +% DD{} O{zd}{D}d 2D \\ +% ZZ O{Z D Z}{Z 1.1M .9Z} ZZ \\ +% ZZ O{d Z}O{DZ}{dD} ZZ \\ +% ZZ O{dDZ}O{DZ}{dZ} ZZ \\ +% ZZ 3D O{dDZ}{DZ} ZZ \\ +% ZZ 3D O{dDZ}O{DZ}{dZ} ZZ \\ +% ZZ 3D O{3D} DZZ \\ +% Z O{DD} ZDDD O{DDZZ} DZ 2S \\ +% Z O{6D Z}{Z 4D Z} Z \\ +% Z O{8D Z}O{Z 6D Z}{2Z 4D 2Z} Z \\ +% \end{tikztimingexampletable} +% \else % \begin{tikztimingexampletable}[timing/draw grid] -% LLL O{HH}{LL} HHH \\ -% LLL O{HHH}{LL} HHH \\ -% LLL O{;[gray]HH.1H;}{LLH} HH \\ +% LLL O{HH}{LL} HHH \\ +% LLL O{HHH}{LL} HHH \\ +% LLL O{;[gray]HH.1H;}{LLH} HH \\ % LL O{L;[gray]HH.1H;}{LLLH} HH \\ -% DD{} O{zd}{D}d 2D \\ -% ZZ O{Z D Z}{Z 1.1M .9Z} ZZ \\ -% ZZ O{d Z}O{DZ}{dD} ZZ \\ -% ZZ O{dDZ}O{DZ}{dZ} ZZ \\ -% ZZ 3D O{dDZ}{DZ} ZZ \\ -% ZZ 3D O{dDZ}O{DZ}{dZ} ZZ \\ -% ZZ 3D O{3D} DZZ \\ -% Z O{DD} ZDDD O{DDZZ} DZ 2S \\ -% Z O{6D Z}{Z 4D Z} Z \\ -% Z O{8D Z}O{Z 6D Z}{2Z 4D 2Z} Z \\ +% DD{} O{zd}{D}d 2D \\ +% ZZ O{Z D Z}{Z 1.1M .9Z} ZZ \\ +% ZZ O{d Z}O{DZ}{dD} ZZ \\ +% \end{tikztimingexampletable} +% \begin{tikztimingexampletable}[timing/draw grid] +% ZZ O{dDZ}O{DZ}{dZ} ZZ \\ +% ZZ 3D O{dDZ}{DZ} ZZ \\ +% ZZ 3D O{dDZ}O{DZ}{dZ} ZZ \\ +% ZZ 3D O{3D} DZZ \\ +% Z O{DD} ZDDD O{DDZZ} DZ 2S \\ +% Z O{6D Z}{Z 4D Z} Z \\ +% Z O{8D Z}O{Z 6D Z}{2Z 4D 2Z} Z \\ % \end{tikztimingexampletable} +% \fi % \end{table} % % \clearpage -% \subsection{Clock Arrows} +% \library{clockarrows}{Clock Arrows} % The library "clockarrows"\NewIn{v0.7} is changing the "C" clock character to contain % arrows which mark the rising and/or falling clock edge. By default the rising % edges are marked. To simplify the implementation only the transition from a @@ -2080,21 +2255,18 @@ % \makebox[\textwidth][c]{% % \begin{tabularx}{1\textwidth}{>{\ttfamily}l>{\raggedright\arraybackslash}X} % \toprule -% \normalfont Style/Setting & Description \\ -% \midrule -% timing/c/rising arrows & Mark (only) rising edges with arrows.\\ -% timing/c/falling arrows & Mark (only) falling edges with arrows.\\ -% timing/c/dual arrows & Mark both rising and falling edges with arrows.\\ -% timing/c/no arrows & Do not mark any edges with arrows. (Default)\\ -% \midrule -% timing/c/arrow & Style for arrows. Can be modified to change arrow tip -% etc. (Default: \{\})\\ -% timing/c/arrow pos=\meta{0.\!-\!\!-1.} & Position of arrows, i.e.\ its -% tip, on the edge. May needs adjustment if different arrow tip shapes -% are selected. (Default: 0.95)\\ -% timing/c/arrow tip=\meta{name} & Tip shape of arrows. See the PGF manual -% for the list of arrow tips. (Default: `\texttt{to}')\\ -% \bottomrule +% \normalfont TikZ Style & Description \\ +% \midrule +% timing/c/rising arrows & Mark (only) rising edges with arrows.\\ +% timing/c/falling arrows & Mark (only) falling edges with arrows.\\ +% timing/c/dual arrows & Mark both rising and falling edges with arrows.\\ +% timing/c/no arrows & Do not mark any edges with arrows. (Default)\\ +% \midrule +% timing/c/arrow & Style for arrows. Can be modified to change arrow tip etc. (Default: \{\})\\ +% timing/c/arrow pos=\meta{0.\!-\!\!-1.} & Position of arrows, i.e.\ its tip, on the edge. +% May needs adjustment if different arrow tip shapes are selected. (Default: 0.95)\\ +% timing/c/arrow tip=\meta{name} & Tip shape of arrows. See the PGF manual for the list of arrow tips. (Default: `\texttt{to}')\\ +% \bottomrule % \end{tabularx}} % \end{table} % @@ -2102,24 +2274,53 @@ % \caption{Examples for the Clock Arrows.}\label{tab:clockarrows} % \tikzset{timing/c/dual arrows}% % \centering +% \ifprintversion % \begin{tabular}{lc} % \toprule -% Settings (\texttt{timing/c/.cd}) & Resulting Diagram (\texttt{10\{C\}}) -% \\\midrule -% \texttt{rising arrows} & \texttiming[timing/c/rising arrows]{10{C}} \\ -% \texttt{falling arrows}& \texttiming[timing/c/falling arrows]{10{C}} \\ -% \texttt{no arrows} & \texttiming[timing/c/no arrows]{10{C}}\\ -% \texttt{dual arrows} & \texttiming[timing/c/dual arrows]{10{C}}\\ +% Settings (\texttt{timing/c/.cd}) & Resulting Diagram (\texttt{11\{C\}}) \\ % \midrule -% \texttt{arrow pos=.5} & \texttiming[timing/c/arrow pos=.5]{10{C}}\\ -% \texttt{arrow tip=latex} & \texttiming[timing/c/arrow tip=latex]{10{C}}\\ -% \texttt{arrow tip=stealth}& \texttiming[timing/c/arrow tip=stealth]{10{C}}\\ +% \texttt{rising arrows} & \texttiming[timing/c/rising arrows]{10{C}} \\ +% \texttt{falling arrows} & \texttiming[timing/c/falling arrows]{10{C}} \\ +% \texttt{no arrows} & \texttiming[timing/c/no arrows]{10{C}} \\ +% \texttt{dual arrows} & \texttiming[timing/c/dual arrows]{10{C}} \\ +% \midrule +% \texttt{arrow pos=.5} & \texttiming[timing/c/arrow pos=.5]{10{C}} \\ +% \texttt{arrow tip=latex} & \texttiming[timing/c/arrow tip=latex]{10{C}} \\ +% \texttt{arrow tip=stealth} & \texttiming[timing/c/arrow tip=stealth]{10{C}} \\ % \bottomrule % \end{tabular} +% \else +% \begin{minipage}[t]{.49\textwidth} +% \vspace{0pt}\centering +% \begin{tabular}{lc} +% \toprule +% Settings (\texttt{timing/c/.cd}) & Resulting Diagram (\texttt{11\{C\}}) \\ +% \midrule +% \texttt{rising arrows} & \texttiming[timing/c/rising arrows]{10{C}} \\ +% \texttt{falling arrows} & \texttiming[timing/c/falling arrows]{10{C}} \\ +% \texttt{no arrows} & \texttiming[timing/c/no arrows]{10{C}} \\ +% \texttt{dual arrows} & \texttiming[timing/c/dual arrows]{10{C}} \\ +% \bottomrule +% \end{tabular} +% \end{minipage} +% \hfill +% \begin{minipage}[t]{.49\textwidth} +% \vspace{0pt}\centering +% \begin{tabular}{lc} +% \toprule +% Settings (\texttt{timing/c/.cd}) & Resulting Diagram (\texttt{11\{C\}}) \\ +% \midrule +% \texttt{arrow pos=.7} & \texttiming[timing/c/arrow pos=.7]{10{C}} \\ +% \texttt{arrow pos=.4} & \texttiming[timing/c/arrow pos=.4]{10{C}} \\ +% \texttt{arrow tip=latex} & \texttiming[timing/c/arrow tip=latex]{10{C}} \\ +% \texttt{arrow tip=stealth} & \texttiming[timing/c/arrow tip=stealth]{10{C}} \\ +% \bottomrule +% \end{tabular} +% \end{minipage} % \end{table} % % \clearpage -% \subsection{Column Type} +% \library{columntype}{Column Type} % The library "columntype"\NewIn{v0.7} uses the \pkg{array} package to define a new % |tabular| column type for timing characters. The tabular column can then hold % timing characters like the \env{tikztimingtable}. An initial option block @@ -2157,7 +2358,11 @@ % \hspace*{2em}|\usetikzlibrary[type={U}{l}]{columntype}|\\[\smallskipamount] % % \bigskip -% \begin{example} +% \begin{figure} +% \makeatletter +% \let\tikztiming@embedexample\empty +% \let\writeexample\empty +% \makeatother % \centering % \begin{examplecode} % \begin{tabular}{lcT} @@ -2171,10 +2376,10 @@ % \end{tabular} % \end{examplecode} % \caption{Example for use of Timing Column Type.}\label{exa:columntype} -% \end{example} +% \end{figure} % % \clearpage -% \subsection{Nice Timing Tables} +% \library{nicetabs}{Nice Timing Tables} % The library "nicetabs"\NewIn{v0.7} uses the settings of the \pkg{array} and % \pkg{booktabs} packages to improve the layout of \env{tikztimingtables}. The % resulting table matches a \env{tabular}|{rT}| table which uses the above @@ -2233,16 +2438,15 @@ % \end{table} % % \clearpage -% \subsection{Counter Character} -% The library "counters"\NewIn{v0.7} allows the easy definition of meta-characters which +% \library{counters}{Counter Character} +% The library "counters"\NewIn{v0.7}\ExtIn{v0.7a} allows the easy definition +% of meta-characters which % implement up-counters. These characters show the counter value using the % "D{}" character and increment it by one every time they are used. A second % character can be defined to (re-)set the counter to a specific value. The % counter values can be decimal (base-10, default), hexadecimal (base-16) or any -% other base from 2 till 36. By default the lower case version of the counter +% other base from 2 to 36. By default the lower case version of the counter % character is defined to produce the same output only with half the width. -% The style `\texttt{timing/counter/\meta{char}}' (initially empty) is used to -% format the graphic style of this counter.\\ % % Counter characters are defined using the TikZ key % `\texttt{timing/counter/new=}\linebreak[3]\ignorespaces @@ -2250,48 +2454,124 @@ % "timing/new counter". The \meta{settings} are TikZ keys themselves and are % shown by Table~\ref{tab:countersettings}. One or more "new" keys (path % "timing/counter" removed) can be given as library options. +% The counter values are global like normal \LaTeX\ counters. They should be reset +% in every timing diagram line before they are used. +% +% \subsubsection*{Counter Style} +% The styles `\texttt{timing/counter/\meta{char}}' and `\texttt{timing/counter/\meta{char}/text}' +% (both initially empty) are used to format the graphic and text style of this counter, respectively. +% Because the "D{}" character is used internally the above styles need to change the corresponding +% "D" styles. This changes are only local and do not affect further `real' "D" characters. +% +% The settings "fg style", "bg style" and "text style" can be used to quickly define the +% foreground (\ie line), background and text style of the counter. While the "text style" setting +% simple sets the `\texttt{timing/counter/\meta{char}/text}' style, the other two are a shortcut for +% \\*[\smallskipamount] +% | \tikzset{timing/counter/|\meta{char}|/.style={%|\\ +% | timing/d/.style=|\marg{fg style}|,|\\ +% | timing/d/background/.style=|\marg{bg style}|,|\\ +% | }}|\\ +% \par\medskip +% +% \subsubsection*{Additional Macros} +% \DescribeMacro*{tikztimingcounter}{\marg{char}} +% \DescribeMacro*{tikztimingsetcounter}{\marg{char}\marg{pgfmath expression}} +% The value of counter \meta{char} can be read or set using this macros. % % \begin{table} % \caption{Settings for Counter Meta-Characters} % \label{tab:countersettings} -% \begin{tabularx}{\textwidth}{>{\ttfamily}lX} +% \makebox[\textwidth][c]{% +% \begin{tabularx}{1\textwidth}{>{\ttfamily}lX} % \toprule % \multicolumn{1}{l}{Key name} & Description \\ % \midrule % char=\meta{char} & Defines the given \meta{char} to be a counter -% meta-character. If it is a upper case character the lower case character -% will produce the same output but with the half width, as long this is not -% overwritten with the \texttt{half with char} key. \\ -% reset char=\meta{char} & Defines the given \meta{char} to (re-)set the -% counter value to the `width' of the character, \ie the number preceding it. -% The lower case version of \meta{char} is not defined.\\ -% base=\meta{Num 2-36} & Defines the numeric base of the counter. The default -% is 10.\\ +% meta-character. If it is a upper case character the lower case character +% will produce the same output but with the half width, as long this is not +% overwritten with the \texttt{half with char} key. \\ % half width char=\meta{char} & Defines the given \meta{char} to be the half -% width version of the counter value. By default this is the lower case -% version of the counter character given with \texttt{char}. An empty value -% for \meta{char} deactivates the definition of a half width character, which -% is the main application of this key.\\ +% width version of the counter value. By default this is the lower case +% version of the counter character given with \texttt{char}. An empty value +% for \meta{char} deactivates the definition of a half width character.\\ +% reset char=\meta{char} +% & Defines the given \meta{char} to (re-)set the counter value to the `width' +% of the character, \ie the number preceding it. The lower case version of +% the reset \meta{char} is not defined.\\ +% reset type=\small\meta{width\Pipe arg\Pipe both\Pipe Both} +% & Defines the type of the reset character, \ie how the reset value is obtained. +% {\begin{tabular}{>{\ttfamily}ll} +% width & Width is reset value: `\meta{value}\meta{char}', \eg `\texttt{0R}'. +% Value can not be negative.\\ +% arg & Reset value is provided as argument: `\meta{char}\marg{value}', \eg +% `\texttt{R\{-1\}}'.\\ +% both & Uppercase \meta{char} is \texttt{width}-type, lowercase \meta{char} +% is \texttt{arg}-type reset char.\\ +% Both & Lowercase \meta{char} is \texttt{width}-type, uppercase \meta{char} +% is \texttt{arg}-type reset char.\\ +% \end{tabular}} \\ +% base=\meta{Num 2-36} & Defines the numeric base of the counter. If not used the +% base 10 is used.\\ +% \midrule +% increment=\small\meta{pgfmath expression} & +% Sets the increment which is added every time the counter +% character is used. This can be a formula which result is truncated +% to a integer. The current counter value can be referenced as \cs{N}. +% The increment can be negative which causes +% the counter to count down. Default: 1\\ +% max value=\small\meta{pgfmath expression} & Sets the maximum counter value. Default: \emph{not set}\\ +% min value=\small\meta{pgfmath expression} & Sets the minimum counter value. Default: \emph{not set}\\ +% wraps=\meta{true\Pipe false} & +% If set to \texttt{true} the counter wraps around, \ie it counts to the +% minimum value when counting over the maximum value or the other +% way around if \texttt{increment} is negative. +% Initial value: \texttt{false}. Default value: \texttt{true}\\ +% \midrule +% bg style=\meta{TikZ style(s)} & Sets the background style of the counter.\\ +% fg style=\meta{TikZ style(s)} & Sets the foreground (line etc.) style of the counter.\\ +% text style=\meta{TikZ style(s)} & Sets the text style of the counter.\\ +% text format=\meta{\TeX code} & Sets the format code of the counter value. This should be a macro which receives +% the counter value as first argument.\\ % \bottomrule % \end{tabularx} +% }% % \end{table} % -% \subsubsection*{Example:} +% \subsubsection*{Examples:} % \noindent % Counter character "Q" with base 16 (hexadecimal). "R" resets the -% counter:\\*\noindent +% counter. The counter value should be in blue text typer font.\\*\noindent % |\tikzset{timing/new counter={char=Q,base=16,reset char=R}}|\\*\noindent -% The counter value should be in blue text typer font.\\*\noindent -% |\tikzset{timing/counter/Q/.style={font=\ttfamily,blue}}|\\*\noindent +% |\tikzset{timing/counter/Q/text/.style={font=\ttfamily,blue}}|\\*\noindent % |\texttiming{ 3Q 3{Q} R 12{Q} 2R Q qq 0R 3{Q} }|\\*\noindent % gives: {% % \tikzset{timing/counter/new={char=Q,base=16,reset char=R}}% -% \tikzset{timing/counter/Q/.style={font=\ttfamily,blue}}% +% \tikzset{timing/counter/Q/text/.style={font=\ttfamily,blue}}% % \texttiming{ 3Q 3{Q} R 12{Q} 2R Q qq 0R 3{Q} }% % }% % +% \par\bigskip +% \noindent +% \begingroup +% \lstset{basicstyle=\ttfamily\scriptsize} +% \begin{examplecode} +% \scalebox{2}{% +% \begin{tikztimingtable} +% Dec & [timing/counter/new={char=Q,max value=15, wraps,text style={font=\scriptsize}}] 33{Q}d\\ +% Bin & [timing/counter/new={char=Q,max value=15,base=2, digits=4,wraps,text style={font=\tiny,scale=.8}}] 33{Q}d\\ +% Oct & [timing/counter/new={char=Q,max value=15,base=8, digits=3,wraps,text style={font=\tiny}}] 33{Q}d\\ +% Hex & [timing/counter/new={char=Q,max value=15,base=16, wraps,text style={font=\scriptsize}}] 33{Q}d\\ +% \extracode +% \begin{background}[shift={(0.1,0)},help lines] +% \vertlines{} +% \end{background} +% \end{tikztimingtable} +% }% +% \end{examplecode} +% \endgroup +% % \clearpage -% \subsection{Advanced Nodes} +% \library{advnodes}{Advanced Nodes} % The library "advnodes"\NewIn{v0.7} changes the in-line nodes, \ie the "N" character, to provide multiple % transition dependent and independent node anchors shown in Table~\ref{tab:advanchor}. % @@ -2337,7 +2617,7 @@ % \bottomrule % \end{tabularx} % -% \subsubsection*{Examples:} +% \subsection*{Examples:} % "\usetikztiminglibrary[simple]{advnodes}"\ \ loads the library with nodes default to the old "simple" style.\\\noindent % "\usetikztiminglibrary[old center]{advnodes}"\ \ \ loads the library with advanced nodes with have the center at the same % place as the normal simple nodes. This is a good ``compatibility mode'' for existing pre-v0.7 diagrams.\\\noindent @@ -2475,7 +2755,7 @@ % \end{table} % % \clearpage -% \subsection{Compatibility Macros for \texttt{ifsym} package} +% \library{ifsym}{Compatibility Macros for \texttt{ifsym} package} % The library "ifsym"\NewIn{v0.7} provides macros and timing styles to emulate the behaviour of the \pkg{ifsym} package % when loaded with the |electronic| option. The \pkg{ifsym} package was an early inspiration to this package % and this library allows the usage of |ifsym| style timing symbol macros and characters @@ -2491,49 +2771,80 @@ % These select if the macros should be defined using \cs{providecommand}, \cs{newcommand}, \cs{renewcommand} % or not at all. This can be useful if the \pkg{ifsym} package is loaded beforehand. % +% +% \sbox{\sba}{%^^A +% \begin{tabular}{lll} +% \toprule +% Macro & Symbol & Description (trivial) \\ +% \midrule +% \cs{RaisingEdge} & \RaisingEdge & Raising Edge \\ +% \cs{FallingEdge} & \FallingEdge & Falling Edge \\ +% \cs{ShortPulseHigh} & \ShortPulseHigh & Short Pulse High \\ +% \cs{ShortPulseLow} & \ShortPulseLow & Short Pulse Low \\ +% \cs{PulseHigh} & \PulseHigh & Normal Pulse High \\ +% \cs{PulseLow} & \PulseLow & Normal Pulse Low \\ +% \cs{LongPulseHigh} & \LongPulseHigh & Long Pulse High \\ +% \cs{LongPulseLow} & \LongPulseLow & Long Pulse Low \\ +% \bottomrule +% \end{tabular}%^^A +% }%^^A +% ^^A +% \sbox{\sbb}{%^^A +% \begin{tabular}{>{\ttfamily}lll} +% \toprule +% \normalfont +% Character & Symbol & Description \\ +% \midrule +% l, h & \textifsym{l}, \textifsym{h} & Short low or high level signal. \\ +% L, H & \textifsym{L}, \textifsym{H} & Long low or high level signal. \\ +% \pipe & \textifsym{|} & Transition/glitch between L/H or H/L levels. \\ +% m, d & \textifsym{m}, \textifsym{d} & Short middle or double level signal. \\ +% M, D & \textifsym{M}, \textifsym{D} & Long middle or double level signal. \\ +% <, << & \textifsym{<}, \textifsym{<<} & Short or long slope between middle and double level. \\ +% >, >> & \textifsym{>}, \textifsym{>>} & Short or long slope between double and middle level. \\ +% \bottomrule +% \end{tabular} +% }%^^A +% +% \ifprintversion +% % \begin{table} % \centering -% \caption[ifsym style Timing Symbol Macros]{\texttt{ifsym} style Timing Symbol Macros (from \pkg{ifsym} manual)} +% \caption[ifsym style Timing Symbol Macros]{\texttt{ifsym} style Timing Symbol Macros} % \label{tab:ifsymmacros} -% \begin{tabular}{lll} -% \toprule -% Macro & Symbol & Description (trivial) \\ -% \midrule -% \cs{RaisingEdge} & \RaisingEdge & Raising Edge \\ -% \cs{FallingEdge} & \FallingEdge & Falling Edge \\ -% \cs{ShortPulseHigh} & \ShortPulseHigh & Short Pulse High \\ -% \cs{ShortPulseLow} & \ShortPulseLow & Short Pulse Low \\ -% \cs{PulseHigh} & \PulseHigh & Normal Pulse High \\ -% \cs{PulseLow} & \PulseLow & Normal Pulse Low \\ -% \cs{LongPulseHigh} & \LongPulseHigh & Long Pulse High \\ -% \cs{LongPulseLow} & \LongPulseLow & Long Pulse Low \\ -% \bottomrule -% \end{tabular} +% \usebox{\sba}%^^A % \end{table} % % \begin{table} % \centering % \caption[ifsym style Timing Characters]{\texttt{ifsym} style Timing Characters (from \pkg{ifsym} manual)} % \label{tab:ifsym} -% \begin{tabularx}{\textwidth}{llX} -% \toprule -% Character & Symbol & Description \\ -% \midrule -% |l, h| & \textifsym{l}, \textifsym{h} & Short low or high level signal. \\ -% |L, H| & \textifsym{L}, \textifsym{H} & Long low or high level signal. \\ -% \verb+|+ & \textifsym{|} & Transition/glitch between L/H or H/L levels. \\ -% |m, d| & \textifsym{m}, \textifsym{d} & Short middle or double level signal. \\ -% |M, D| & \textifsym{M}, \textifsym{D} & Long middle or double level signal. \\ -% |<, <<| & \textifsym{<}, \textifsym{<<}& Short or long slope between middle and double level. \\ -% |>, >>| & \textifsym{>}, \textifsym{>>}& Short or long slope between double and middle level. \\ -% \bottomrule -% \end{tabularx} +% \usebox{\sba}%^^A % \end{table} % +% \else +% +% \begin{nofloat}{table} +% \makebox[\textwidth][c]{%^^A +% \let\tablecaption\caption +% \begin{minipage}{\wd\sba} +% \tablecaption[ifsym style Timing Symbol Macros]{\texttt{ifsym} style Timing Symbol Macros}%^^A +% \label{tab:ifsymmacros}%^^A +% \usebox{\sba}%^^A +% \end{minipage} +% \hspace{1em}\hfill +% \begin{minipage}{\wd\sbb} +% \tablecaption[ifsym style Timing Characters]{\texttt{ifsym} style Timing Characters (from \texttt{ifsym} manual)}%^^A +% \label{tab:ifsym}%^^A +% \usebox{\sbb}%^^A +% \end{minipage} +% }%^^A +% \end{nofloat} % +% \fi % % \clearpage -% \subsection{Intervals (experimental)} +% \library{interval}{Intervals (experimental)} % \textbf{This library is under development and might change in the future.} % % The library "interval"\NewIn{v0.7} allows the drawing of intervals using the "H", "L", "Z" and "X" logic levels. @@ -2551,7 +2862,7 @@ % \noindent % Examples: % \begingroup -% \tikzset{timing/draw grid}\sffamily +% \tikzset{timing/draw grid,timing/slope=0}\sffamily % \newcommand*\ttt[2][]{\texttiming[timing/interval={#1}]{#2}} % \newcommand*\extab[1]{% % \begin{tabular}{rcc} @@ -2595,7 +2906,7 @@ % \endgroup % % \clearpage -% \subsection{Beamer Overlay Support (experimental)} +% \library{beamer}{Beamer Overlay Support (experimental)} % \textbf{This library is under development and might change in the future.} % % The library "beamer"\NewIn{v0.7} provides (at the moment) marginal support for overlays of the \pkg{beamer} class. @@ -2604,17 +2915,17 @@ % The support is designed for use inside \env{tikztimingtable}. % See the \pkg{beamer} manual for more informations about overlays specifications. % -% \subsubsection*{Usage} +% \subsection*{Usage} % Insert an overlay specification, e.g.~|<|\meta{number}|>|, inside the timing string. It will affect the % rest of the timing characters of the current diagram line. % Unfortunate due to the global nature of overlays it also affects the rest of the table. Therefore all % diagram lines should end with a specification which turns overlays off, i.e. |<*>| or |<0->|. Otherwise % strange results can occur (e.g.~wrong/missing background graphics). % -% \subsubsection*{Example} -% | Timing Table Row & H L <2> Z L H <3> D{last} Z <*> \\ | +% \paragraph*{Example} +% | Timing Table Row & H L <2> Z L H <3> D{last} Z <*> \\ | % -% \subsubsection*{Display Rows Stepwise} +% \subsection*{Display Rows Stepwise} % The rows of a \env{tikztimingtable} can be uncovered row-by-row using the way shown below. The signal names % must be enclosed into a \cs{mbox} because \cs{uncover} needs to be inside horizontal mode. Instead % of \cs{uncover} another beamer overlay command like \cs{only} or \cs{invisible} can be used. To highlight @@ -2630,7 +2941,7 @@ % \end{tikztimingtable} % \end{lstlisting} % -% \subsubsection*{Display Columns Stepwise} +% \subsection*{Display Columns Stepwise} % Different sections (`columns') of timing diagrams in a \env{tikztimingtable} can be uncovered stepwise using the way shown below. % In this example the second section/column will be uncovered in the second slide. The first is always visible. Further sections/columns % can be uncovered in further slides. @@ -2646,7 +2957,7 @@ % \end{tikztimingtable} % \end{lstlisting} % -% \subsubsection*{Overlay Extra Code} +% \subsection*{Overlay Extra Code} % The |beamer| overlay specifications can be used inside the \cs{extracode} section like in a normal \env{tikzpicture} environment. % However, in both cases strange results will occur if the end of the environment is hidden by an overlay specification. Due to this % reason it is recommended to only use overlay commands which affect only an argument, like \cs{only}|<|\meta{\dots}|>|\marg{code}, @@ -2658,18 +2969,16 @@ % % ... % \extracode % % either -% \draw<2> (0,0) -- (2,0); -% \only<3> { ... } +% \draw<2> (0,0) -- (2,0); \only<3> { ... } % % or % \onlayer<2> -% ... % % and then at the very end: % \onlayer % or \onlayer<*> % \end{tikztimingtable} % \end{lstlisting} % % \clearpage -% \section{Examples} +% \chapter{Examples} % This section shows some examples by putting either the full source code or % only the needed characters beside the graphical result. Please note that the % displayed syntax is the one of \cs{timing} where the initial character is @@ -2683,10 +2992,13 @@ % ^^A\emph{Example notation example:} "[c]cccc" means either % ^^A|\timing{[c]cccc};| or |\texttiming[c]{cccc}|. % -% % \DeleteShortVerb{\|} % \begin{exampletable} % \centering +% \makeatletter +% \let\tikztiming@embedexample\empty +% \let\writeexample\empty +% \makeatother % \pgfmathsetbasenumberlength{2} % \newcounter{hexcount} % \addtocounter{hexcount}{+8}% @@ -2695,7 +3007,7 @@ % \hbox{\thehexcount}% % \addtocounter{hexcount}{+1}% % } -% \caption{Initial Characters, Modifiers, TikZ Settings}\label{exa:adv} +% \caption{Initial Characters, Modifiers, TikZ Keys}\label{exa:adv} % \def\somemacro{}% % \def\code{}% % \makebox[\textwidth][c]{% @@ -2746,7 +3058,7 @@ % Signal & z4D{Text}z \\ % \end{tikztimingtable} % \end{examplecode} -% \caption{\env{tikztimingtable} without \cs{extracode}.} +% \caption[tikztimingtable without extracode]{\env{tikztimingtable} without \cs{extracode}.} % \end{example} % % \begin{example} @@ -2763,7 +3075,7 @@ % \end{pgfonlayer} % \end{tikztimingtable} % \end{examplecode} -% \caption{\env{tikztimingtable} with \cs{extracode}.} +% \caption[tikztimingtable with extracode]{\env{tikztimingtable} with \cs{extracode}.} % \end{example} % % \begin{example} @@ -2780,16 +3092,19 @@ % at (0.4,0.7) {HLZHHLHHL}; % \end{tikzpicture} % \end{examplecode} -% \caption{\cs{timing} inside general \envv{tikzpicture}.} +% \caption[timing inside general tikzpicture]{\cs{timing} inside general \envv{tikzpicture}.} % \end{example} % % \begin{example} % \centering +% \def\exampleextraheader{\noexpand\usetikztiminglibrary{advnodes}} % \begin{examplecode} % \Huge -% \begin{tikzpicture}[timing/picture,thick] +% \begin{tikzpicture}[timing/picture,thick, +% timing/nodes/advanced] % \timing at (0,2) {hH N(A) LHLHL}; -% \timing[timing/slope=.25] at (0,0) {HLL N(B) HHLl}; +% \timing[timing/slope=.25] at (0,0) +% {HLL N(B) HHLl}; % \draw [orange,semithick] % (A.mid) ellipse (.2 and .6) % (B.mid) ellipse (.2 and .6); @@ -2804,22 +3119,22 @@ % % \begin{example} % \centering -% \lstset{basicstyle=\footnotesize\ttfamily} +% \lstset{basicstyle=\scriptsize\ttfamily} % \begin{examplecode} % \def\degr{${}^\circ$} % \begin{tikztimingtable} -% Clock 128\,MHz 0\degr & H 2C N(A1) 8{2C} N(A5) 3{2C} G\\ -% Clock 128\,MHz 90\degr & [C] 2{2C} N(A2) 8{2C} N(A6) 2{2C} C\\ -% Clock 128\,MHz 180\degr & C 2{2C} N(A3) 8{2C} N(A7) 2{2C} G\\ -% Clock 128\,MHz 270\degr & 3{2C} N(A4) 8{2C} N(A8) 2C C\\ -% Coarse Pulse & 3L 16H 6L \\ -% Coarse Pulse - Delayed 1 & 4L N(B2) 16H N(B6) 5L \\ -% Coarse Pulse - Delayed 2 & 5L N(B3) 16H N(B7) 4L \\ -% Coarse Pulse - Delayed 3 & 6L 16H 3L \\ -% \\ -% Final Pulse Set & 3L 16H N(B5) 6L \\ -% Final Pulse $\overline{\mbox{Reset}}$ & 6L N(B4) 16H 3L \\ -% Final Pulse & 3L N(B1) 19H N(B8) 3L \\ +% Clock 128\,MHz 0\degr & H 2C N(A1) 8{2C} N(A5) 3{2C} G \\ +% Clock 128\,MHz 90\degr & [C] 2{2C} N(A2) 8{2C} N(A6) 2{2C} C \\ +% Clock 128\,MHz 180\degr & C 2{2C} N(A3) 8{2C} N(A7) 2{2C} G \\ +% Clock 128\,MHz 270\degr & 3{2C} N(A4) 8{2C} N(A8) 2C C \\ +% Coarse Pulse & 3L 16H 6L \\ +% Coarse Pulse - Delayed 1 & 4L N(B2) 16H N(B6) 5L \\ +% Coarse Pulse - Delayed 2 & 5L N(B3) 16H N(B7) 4L \\ +% Coarse Pulse - Delayed 3 & 6L 16H 3L \\ +% \\ +% Final Pulse Set & 3L 16H N(B5) 6L \\ +% Final Pulse $\overline{\mbox{Reset}}$ & 6L N(B4) 16H 3L \\ +% Final Pulse & 3L N(B1) 19H N(B8) 3L \\ % \extracode % \tablerules % \begin{pgfonlayer}{background} @@ -2833,8 +3148,9 @@ % % \begin{example} % \centering -% \lstset{basicstyle=\footnotesize\ttfamily} -% \def\exampleextraheader{\noexpand\usetikztiminglibrary{advnodes}} +% \lstset{basicstyle=\scriptsize\ttfamily} +% \def\exampleextraheader{\noexpand\usetikztiminglibrary{advnodes,either}^^J +% \noexpand\usepackage{amsmath}} % \begin{examplecode} % \def\degr#1{\makebox[2em][r]{#1}\ensuremath{{}^{\circ}}}% % @@ -2867,8 +3183,7 @@ % {\scriptsize D$_\text{M}$ = MSBs of Duty Cycle}; % \begin{background}[timing/picture,line width=.06ex,color=black!60] % \foreach \n in {0,...,5} -% \draw ([shift={(0,0.25)}]A\n.HIGH) -% -- ([shift={(0,-0.25)}]B\n.LOW); +% \draw (A\n.TOP) -- (B\n.BOTTOM); % \end{background} % \end{tikztimingtable}% % \end{examplecode} @@ -2877,29 +3192,38 @@ % % \begin{example} % \centering -% \lstset{basicstyle=\ttfamily\small} +% \lstset{basicstyle=\ttfamily\footnotesize} % \def\texta{}\def\textb{}^^A -% \let\insertoriginalimageforcomparisionifpresent\relax +% \makeatletter % \ifpdf % \IfFileExists{SR_FF_timing_diagram.png}{^^A -% \def\insertoriginalimageforcomparisionifpresent{^^A -% \hspace{0.2\textwidth}\relax\includegraphics[width=28ex,trim=0 10pt 0 -% 0,clip]{SR_FF_timing_diagram.png}^^A -% }^^A -% \def\texta{ (left)}\def\textb{ (right)}^^A -% }{}^^A -% \def\exampleextraheader{% -% \string\let -% \string\insertoriginalimageforcomparisionifpresent\string\relax -% }% +% \def\texta{ (right top)}\def\textb{ (right bottom)}^^A +% \def\formatexample{% +% \begingroup +% \par\noindent +% \centerline{%^^A +% \minipage[c]{\wd\examplecodebox} +% \hbox{\usebox{\examplecodebox}} +% \endminipage% +% \hfill +% \minipage[c]{\wd\exampleresultbox}%^^A +% \hbox to \textwidth{\hss\usebox{\exampleresultbox}}%^^A +% \vspace*{1cm}%^^A +% \hbox to \textwidth{\hss\includegraphics[width=27ex]{SR_FF_timing_diagram.png}}%^^A +% \endminipage% +% } +% \endgroup +% \par +% }%^^A +% }{}%^^A % \fi % \begin{examplecode} -% \definecolor{bgblue}{rgb}{0.41961,0.80784,0.80784} -% \definecolor{bgred}{rgb}{1,0.61569,0.61569} -% \definecolor{fgblue}{rgb}{0,0,0.6} -% \definecolor{fgred}{rgb}{0.6,0,0} +% \definecolor{bgblue}{rgb}{0.41961,0.80784,0.80784}% +% \definecolor{bgred}{rgb}{1,0.61569,0.61569}% +% \definecolor{fgblue}{rgb}{0,0,0.6}% +% \definecolor{fgred}{rgb}{0.6,0,0}% % \begin{tikztimingtable}[timing/slope=0, -% timing/coldist=2pt,xscale=2,yscale=1.1,semithick] +% timing/coldist=2pt,xscale=2.05,yscale=1.1,semithick] % \scriptsize clock & 7{C}\\ % S & .75L h 2.25L H LLl [fgblue]\\ % R & 1.8L .8H 2.2L 1.4H 0.8L [fgblue]\\ @@ -2908,6 +3232,7 @@ % Q & LHHHHLL[fgred]\\ % $\overline{\mbox{Q}}$ & HLLLLHH[fgred]\\ % \extracode +% \makeatletter % \begin{pgfonlayer}{background} % \shade [right color=bgblue,left color=white] % (7,-8.45) rectangle (-2,-4.6); @@ -2924,8 +3249,7 @@ % \node [anchor=south east,inner sep=0pt,fgred] % at (7,-12.8) {\tiny positive edge triggered}; % \end{pgfonlayer} -% \end{tikztimingtable} -% \insertoriginalimageforcomparisionifpresent +% \end{tikztimingtable}% % \end{examplecode} % \caption[SR flip-flop timing diagram]{SR flip-flop timing diagram\texta. % Redrawn from image\textb\\ {\small @@ -2935,33 +3259,34 @@ % % \begin{example} % \centering -% \lstset{basicstyle=\ttfamily\footnotesize} +% \lstset{basicstyle=\ttfamily\scriptsize} % \def\texta{}\def\textb{}^^A % \begin{examplecode} -% \newcounter{countup} -% \newcommand*{\countup}{\addtocounter{countup}{1}\thecountup} -% \newcommand*{\crst}{\setcounter{countup}{0}} -% \begin{tikztimingtable} -% [timing/d/background/.style={fill=white}, -% timing/lslope=0.2] +% \begin{tikztimingtable}[ +% timing/d/background/.style={fill=white}, +% timing/lslope=0.2, +% timing/counter/new={char=Q,reset char=R}, +% ] % CPOL=0 & LL 15{T} LL \\ % CPOL=1 & HH 15{T} HH \\ % & H 17L H \\ % \\ -% \crst Cycle \# & U 8{2D{\countup}} 2U \\ -% \crst MISO & D{z} 8{2D{\countup}} 2D{z} \\ -% \crst MOSI & D{z} 8{2D{\countup}} 2D{z} \\ +% Cycle \# & U R 8{2Q} 2U \\ +% MISO & D{z} R 8{2Q} 2D{z} \\ +% MOSI & D{z} R 8{2Q} 2D{z} \\ % \\ -% \crst Cycle \# & UU 8{2D{\countup}} U \\ -% \crst MISO & D{z}U 8{2D{\countup}} D{z} \\ -% \crst MOSI & D{z}U 8{2D{\countup}} D{z} \\ +% Cycle \# & UU R 8{2Q} U \\ +% MISO & D{z}U R 8{2Q} D{z} \\ +% MOSI & D{z}U R 8{2Q} D{z} \\ % \extracode +% % Add vertical lines in two colors % \begin{pgfonlayer}{background} % \begin{scope}[semitransparent,semithick] % \vertlines[red]{2.1,4.1,...,17.1} % \vertlines[blue]{3.1,5.1,...,17.1} % \end{scope} % \end{pgfonlayer} +% % Add big group labels % \begin{scope} % [font=\sffamily\Large,shift={(-6em,-0.5)},anchor=east] % \node at ( 0, 0) {SCK}; \node at ( 0,-3 ) {SS}; @@ -2977,8 +3302,12 @@ % \clearpage % \StopEventually{} % \clearpage -% \section{Implementation} -% \subsection{Package Header} +% \iffalse +%</doc> +% \fi +% +% \chapter{Implementation} +% \section{Package Header} % \iffalse %<*package> % \fi @@ -2995,7 +3324,7 @@ \fi % \end{macrocode} % -% \subsection{General Definitions} +% \section{General Definitions} % % \begin{macrocode} \def\tikztimingwidth{0.0} @@ -3010,8 +3339,10 @@ \let\tikztiming@back\empty \newlength\tikztiming@xunit \newlength\tikztiming@yunit -\setlength{\tikztiming@xunit}{1.6ex}% -\setlength{\tikztiming@yunit}{1.6ex}% +\def\tikztiming@@xunit{1.6ex}% +\def\tikztiming@@yunit{1.6ex}% +\setlength{\tikztiming@xunit}{\tikztiming@@xunit}% +\setlength{\tikztiming@yunit}{\tikztiming@@yunit}% \def\tikztiming@setnum#1{% \pgfmathparse{#1}% @@ -3037,10 +3368,10 @@ \def\timingheight{1}% % \end{macrocode} -% \subsection{TikZ Style Settings} +% \section{TikZ Style Settings} % \begin{macrocode} \tikzset{% - timing/.style={% + timing/.style={/tikz, line cap=round, line join=round, timing/adjust@xy },% @@ -3050,10 +3381,33 @@ adjust@xy/.style={% /utils/exec={% \tikz@textfont - \setlength{\tikztiming@xunit}{1.6ex}% - \setlength{\tikztiming@yunit}{1.6ex}% + \let\@tempa\fsize + \let\fsize\@tempdima + \fsize=\f@size pt\relax + \pgfmathsetlength{\tikztiming@xunit}{\tikztiming@@xunit}% + \pgfmathsetlength{\tikztiming@yunit}{\tikztiming@@yunit}% + \let\fsize\@tempa + },% + /tikz/x=\tikztiming@xunit, /tikz/y=\tikztiming@yunit, + }, + unit/.style={% + /utils/exec={% + \def\tikztiming@@xunit{#1}% + \let\tikztiming@@yunit\tikztiming@@xunit },% - /tikz/x=1.6ex, /tikz/y=1.6ex, + /tikz/timing/adjust@xy,% + }, + xunit/.style={% + /utils/exec={% + \def\tikztiming@@xunit{#1}% + },% + /tikz/timing/adjust@xy,% + }, + yunit/.style={% + /utils/exec={% + \def\tikztiming@@yunit{#1}% + },% + /tikz/timing/adjust@xy,% }, font/.style={% /tikz/font={#1}, @@ -3086,6 +3440,8 @@ restore/.style={/utils/exec={\expandafter\tikzset\expandafter{\tikztiming@saved@options}}}, option/.style={/utils/exec={\g@addto@macro\tikztiming@saved@options{#1,}},#1}, nooptions/.style={/utils/exec={\gdef\tikztiming@saved@options{}}}, + popoptions/.style={/utils/exec={\tikztiming@popoptions}}, + pushoptions/.style={/utils/exec={\tikztiming@pushoptions}}, name/.style={inner sep=0pt,outer sep=0pt,minimum size=0pt}, text format/.store in=\tikztiming@textformat, @/.style={}, @@ -3143,6 +3499,8 @@ table/rules/.style={line width=0.08em,line cap=butt}, table/midrules/.style={line width=0.05em,line cap=butt}, table/header/.style={timing/name}, + table/label header/.style={}, + table/row header/.style={}, slope/.code={% \tikztimingsetslope{#1}% \tikztimingsetdslope{2*#1}% @@ -3173,7 +3531,7 @@ } % \end{macrocode} % -% \subsection{Text-Mode Macros} +% \section{Text-Mode Macros} % \begin{macro}{\texttimingbefore} % This macro is executed inside the |tikzpicture| environment of \cs{texttiming} % before the timing diagram is drawn. @@ -3191,7 +3549,7 @@ % \end{macro} % % \begin{macro}{\texttiminggrid} -% Draws a background grid with the `timing/grid' setting. Should be used inside +% Draws a background grid with the "timing/grid" setting. Should be used inside % \cs{texttimingbefore}. % \begin{macrocode} \def\texttiminggrid{% @@ -3201,7 +3559,7 @@ % \end{macrocode} % \end{macro} % -% \subsection{User Level Macros} +% \section{User Level Macros} % % \begin{macro}{\texttiming}[2]{Optional initial character}{Timing characters} % This macro now only parses it optional argument to check if it is a initial @@ -3275,8 +3633,8 @@ \useasboundingbox (0,0) rectangle (\tikztimingwidth,\timingheight); \draw (0,0) coordinate (timing@refa) - coordinate [shift={(0,\timingheight)}] (timing@refb) - coordinate [shift={(0,\timingheight/2)}] (timing@ref) + coordinate (timing@ref) at (0,\timingheight/2) + coordinate (timing@refb) at (0,\timingheight) coordinate (timing/start) coordinate (timing/start base) }% @@ -3315,7 +3673,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\tikz@timing@}[1]{Optional TikZ Settings} +% \begin{macro}{\tikz@timing@}[1]{Optional TikZ Keys} % \begin{macrocode} \def\tikz@timing@[#1]{% \@ifnextchar{a}% @@ -3335,7 +3693,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\tikz@timing@at}[1]{Optional TikZ Settings} +% \begin{macro}{\tikz@timing@at}[1]{Optional TikZ Keys} % \begin{macrocode} \def\tikz@timing@at#1at#2(#3){% \tikz@timing@@@{#1}{#2(#3)}% @@ -3343,7 +3701,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\tikz@timing@@}[3]{Optional TikZ Settings}{Potential `+' or +% \begin{macro}{\tikz@timing@@}[3]{Optional TikZ Keys}{Potential `+' or % empty}{Coordinate} % \begin{macrocode} \def\tikz@timing@@#1#2(#3){% @@ -3352,7 +3710,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\tikz@timing@@@}[3]{Optional TikZ Settings}{Coordinate}{Timing +% \begin{macro}{\tikz@timing@@@}[3]{Optional TikZ Keys}{Coordinate}{Timing % Characters} % \begin{macrocode} \def\tikz@timing@@@#1#2#3{% @@ -3383,6 +3741,13 @@ \fi \tikzset{timing/before}% \tikztiming@str;% + \path let \p1 = (timing/end top), \p2 = (timing/end base), + \p3 = (timing/end), \p4 = (timing/start) in + [/utils/exec={% + \xdef\tikztiming@northeast{\noexpand\pgfpoint{.5*\pgf@pt@aa*\x1}{.5*\pgf@pt@bb*\y1}}% + \xdef\tikztiming@startpoint{\noexpand\pgfpoint{\pgf@pt@aa*(\x4-.5*\x1)}{\pgf@pt@bb*(\y4-.5*\y1)}}% + \xdef\tikztiming@endpoint{\noexpand\pgfpoint{\pgf@pt@aa*(\x3-.5*\x1)}{\pgf@pt@bb*(\y3-.5*\y1)}}% + }]; \node [shape=tikztiming@shape,anchor=origin,#1] at (0,0) {}; \tikzset{timing/after}% \end{scope}% @@ -3424,7 +3789,7 @@ % \end{macrocode} % \end{macro} % -% \subsection{Internal Macros} +% \section{Internal Macros} % % \begin{macro}{\tikztiming@trans@} % \begin{macrocode} @@ -3489,7 +3854,7 @@ % \end{macrocode} % \end{macro} % -% \subsection{Add-to-Macro Macros} +% \section{Add-to-Macro Macros} % \begin{macro}{\tikztiming@eaddto}[2]{Macro name}{Tokens to add to macro} % \begin{macrocode} \def\tikztiming@eaddto#1#2{% @@ -3672,7 +4037,7 @@ % \end{macro} % % -% \subsection{Output Routine} +% \section{Output Routine} % % Init buffer macros: % \begin{macrocode} @@ -3775,7 +4140,7 @@ % \end{macro} % % -% \subsection{Macros for Character Definitions} +% \section{Macros for Character Definitions} % % \begin{macro}{\tikztiming@nameedef}[4]{Macro name to be defined (without % prefix)}{Content of macro} @@ -3817,7 +4182,7 @@ % \end{macro} % % -% \subsection{Parser} +% \section{Parser} % % \begin{macro}{\tikztiming@parser@end} % \begin{macrocode} @@ -3828,9 +4193,9 @@ \tikztiming@output@flush \global\let\tikztimingwidth\tikztimingwidth \tikztiming@addtostr{ coordinate (timing/end) - let \p1 = (timing/start base), \p2 = (timing/end) in + let \p1 = (timing/start base), \p2 = (timing/end), \p3 = (0,1) in coordinate (timing/end base) at (\x2,\y1) - coordinate (timing/end top) at (\x2,1+\y1) + coordinate (timing/end top) at (\x2,\y1+\y3) }% \endgroup \tikztiming@endhook% @@ -3860,8 +4225,13 @@ \tikztiming@output{\tikztiming@lastchar}{\tikztiming@currentchar}% \global\let\tikztiming@lastchar\tikztiming@currentchar \@nameuse{tikztiming@aftercode@\tikztiming@currentchar}% - \expandafter - \tikztiming@testfortext + \expandafter\lowercase\expandafter{% + \expandafter\def\expandafter\@tempa + \expandafter{\tikztiming@currentchar}% + }% + \pgfkeysifdefined{/tikz/timing/\@tempa/text/.@cmd}% + {\expandafter\expandafter\expandafter\tikztiming@testfortext}% + {\expandafter\expandafter\expandafter\tikztiming@parser}% \fi } % \end{macrocode} @@ -3882,7 +4252,7 @@ % marker if so. % % This seems outdated because |handletext@| does not flush the output any more. -% \begin{macrocode} +% \begin{macrocode} \def\tikztiming@handletext#1{% \@ifnextchar\relax {\def\tikztiming@output@nextchar{@}\tikztiming@handletext@{#1}}% @@ -3921,39 +4291,32 @@ \expandafter\def\expandafter\@tempa \expandafter{\tikztiming@currentchar}% }% - \pgfkeysifdefined{/tikz/timing/\@tempa/text/.@cmd}% - {% - \edef\@tempa{node [timing/\@tempa/text,}% - \expandafter\tikztiming@output@addcode\expandafter{% - \@tempa - #1] at ($ (timing@dstart) !.5! (timing@dend) $) - {\tikztiming@textformat{#2}} - }% - \ifcase0% - \if @\tikztiming@output@bufchara + \edef\@tempa{node [timing/\@tempa/text,}% + \expandafter\tikztiming@output@addcode\expandafter{% + \@tempa + #1] at ($ (timing@dstart) !.5! (timing@dend) $) + {\tikztiming@textformat{#2}} + }% + \ifcase0% + \if @\tikztiming@output@bufchara + 1% + \else + \ifx\tikztiming@output@bufchara\tikztiming@currentchar 1% - \else - \ifx\tikztiming@output@bufchara\tikztiming@currentchar - 1% - \fi \fi - \relax - \else \fi - \xdef\tikztiming@output@bufcharb{\tikztiming@currentchar @edge@}% - \xdef\tikztiming@lastchar{\tikztiming@currentchar @edge@}% - }{% - \endgroup - \PackageWarning{tikz-timing}{Ignoring text for character - '\tikztiming@currentchar'!}{}{}{}% - }% + \relax + \else + \fi + \xdef\tikztiming@output@bufcharb{\tikztiming@currentchar @edge@}% + \xdef\tikztiming@lastchar{\tikztiming@currentchar @edge@}% \tikztiming@parser } \let\tikztiming@textformat\empty % \end{macrocode} % \end{macro} % -% \subsection{Definition of Modifiers} +% \section{Definition of Modifiers} % % \begin{macro}{\tikztiming@defcode}[1]{Code Character} % \begin{macrocode} @@ -3965,7 +4328,7 @@ % % \begin{macro}{\tikztiming@defcode{@}} % Simply executes given code. The |\relax| is added to have some protection -% against user code manipulating the parser macro. The `@' character can be both +% against user code manipulating the parser macro. The "@" character can be both % a letter (in style files) and a character (in user documents), so it is % defined twice. % \begin{macrocode} @@ -4085,7 +4448,7 @@ % Brackets and a "!" sign "[! !]" are parser options. % Double brackets are both. % -% Brackets and `\verb+| |+' signs `\verb+[| |]+' are only-once in-picture options. +% Brackets and "| |" signs "[| |]" are only-once in-picture options. % \begin{macrocode} \tikztiming@defcode[{%}]{ \@ifnextchar[%] @@ -4144,7 +4507,67 @@ % \end{macro} % % -% \subsubsection{Add-Node Macros} +% \subsection{Local Scopes, Push/Pop Options} +% +% \begin{macro}{\tikztiming@defcode bgroup} +% \begin{macrocode} +\tikztiming@defcode{\bgroup}{% + \tikztiming@output@eaddcode{% + [timing/pushoptions] + \newdraw + }% + \tikztiming@parser +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tikztiming@defcode egroup} +% \begin{macrocode} +\tikztiming@defcode{\egroup}{% + \tikztiming@output@eaddcode{% + [timing/popoptions] + \newdraw + }% + \tikztiming@parser +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tikztiming@popoptions} +% \begin{macrocode} +\def\tikztiming@popoptions{% + \expandafter\tikztiming@popoptions@\tikztiming@optionstack\relax +} +\def\tikztiming@optionstack{{}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tikztiming@popoptions@} +% \begin{macrocode} +\def\tikztiming@popoptions@#1#2\relax{% + \gdef\tikztiming@saved@options{#1}% + \gdef\tikztiming@optionstack{#2}% + \ifx\tikztiming@optionstack\empty + \gdef\tikztiming@optionstack{{}}% + \fi +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\tikztiming@pushoptions} +% \begin{macrocode} +\def\tikztiming@pushoptions{% + \expandafter\expandafter\expandafter\gdef + \expandafter\expandafter\expandafter\tikztiming@optionstack + \expandafter\expandafter\expandafter{% + \expandafter\expandafter\expandafter{\expandafter\tikztiming@saved@options\expandafter}\tikztiming@optionstack}% +} +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Add-Node Macros} % % \begin{macro}{\tikztiming@addnode}[1]{Options} % \begin{macrocode} @@ -4228,7 +4651,7 @@ % \end{macrocode} % \end{macro} % -% \subsubsection{Test for Code (`!' modifier)} +% \subsection{Test for Code (`!' modifier)} % % \begin{macro}{\tikztiming@testforcode} % \begin{macrocode} @@ -4270,7 +4693,7 @@ % \end{macro} % % -% \subsection{Parser Macros: Numbers} +% \section{Parser Macros: Numbers} % % \begin{macro}{\tikztiming@testfornum} % \begin{macrocode} @@ -4401,7 +4824,7 @@ % \end{macrocode} % \end{macro} % -% \subsection{Meta-Characters} +% \section{Meta-Characters} % % \begin{macro}{\tikztimingmetachar}[1]{Meta-character} % Checks if there is an optional argument and calls \cs{tikztiming@metachar} @@ -4433,6 +4856,10 @@ \endcsname\expandafter[#2]{#3}% \fi \fi + \ifnum\tikztiming@debug=-1 + \message{^^J Defined meta-char '#1' as: + \expandafter\meaning\csname tikztiming@metachar@\meaning#1\endcsname ^^J}% + \fi } % \end{macrocode} % \end{macro} @@ -4447,7 +4874,7 @@ % \end{macrocode} % \end{macro} % -% \subsection{Table environment} +% \section{Table environment} % \begin{macrocode} %\usetikzlibrary{backgrounds} \newcounter{tikztimingrows} @@ -4476,10 +4903,11 @@ \def\nrows{\the\c@tikztiming@nrows}% \def\twidth{\tikztiming@maxwidth}% \tikzpicture[timing/table,#1]% - \coordinate (last row) at (0,\rowdist); - \coordinate (label pos) at (-1*{(\coldist)},0); - \coordinate (timing/table/top left) at (0,1); - \coordinate (timing/table/bottom right) at (0,0); + \coordinate (@last row) at (0,\rowdist); + \coordinate (label@header) at (-1*{(\tikztiming@coldist)},1.5*{(\tikztiming@rowdist)}); + \coordinate (diagram@header) at (0,1.5*{(\tikztiming@rowdist)}); + \coordinate (timing@table@bottom right) at (0,0); + \coordinate (timing@table@bottom left) at (-1*{(\tikztiming@coldist)},0); \tikztiming@picinit \tikzset{timing/before table}% \tikztimingtable@checkrow @@ -4492,17 +4920,33 @@ % \end{environment} % % \begin{macro}{\tikztiming@extracode} +% Set "all rows" rectangle node using the auxiliary coordinates. % \begin{macrocode} \def\tikztiming@extracode{% - \path let - \p1 = (timing/table/top left), - \p2 = (timing/table/bottom right) - in - coordinate (timing/table/bottom left) at (\x1,\y2) - coordinate (timing/table/top right) at (\x2,\y1) - coordinate (timing/table/size) at (\x2-\x1,\y1-\y2) - ; - \@ifnextchar[{\tikztiming@oset}{} + \path + let + \p1 = (row1.north west), + \p2 = (timing@table@bottom right), + \p3 = (\pgf@pt@aa * {(\x2-\x1)},\pgf@pt@bb * {(\y1-\y2)}) + in + node [shape=rectangle,anchor=north west, + minimum width=\x3,minimum height=\y3, + inner sep=0pt,outer sep=0pt] + at (\x1,\y1) (all rows) {} + ; + \path + let + \p0 = (-1*{(\tikztiming@coldist)},1), + \p1 = (label1.north east), + \p2 = (timing@table@bottom left), + \p3 = (\pgf@pt@aa * {(\x0-\x2)},\pgf@pt@bb * {(\y1-\y2)}) + in + node [shape=rectangle,anchor=north east, + minimum width=\x3,minimum height=\y3, + inner sep=0pt,outer sep=0pt] + at (\x1,\y1) (all labels) {} + ; + \@ifnextchar[{\tikztiming@oset}{}% } % \end{macrocode} % \end{macro} @@ -4563,7 +5007,7 @@ % \end{macro} % % \begin{macro}{\tikztiming@oset} -% [1]{TikZ Settings} +% [1]{TikZ Keys} % Handle optional TikZ settings. The \cs{tikz@options} must be used % to ensure that the settings apply for the following graphic paths. % \begin{macrocode} @@ -4621,15 +5065,18 @@ % \begin{macrocode} \long\def\tikztimingtable@row@@#1#2{% \addtocounter{tikztiming@nrows}{1}% - \coordinate (last row) at ($ (last row) - (0,\tikztiming@rowdist) $); - \node [anchor=base east,timing/name] (last row text) - at ($ (last row) - (\tikztiming@coldist,0) $) {\ignorespaces #1\unskip}; + \coordinate (@last row) at ($ (@last row) - (0,\tikztiming@rowdist) $); + \node [anchor=base east,timing/name,alias=last label] (label\the\c@tikztiming@nrows) + at ($ (@last row) - (\tikztiming@coldist,0) $) {\ignorespaces #1\unskip\strut}; + \path let \p1 = (timing@table@bottom left), \p2 = (last label.south west) in + coordinate (timing@table@bottom left) at ({min(\x1,\x2)},\y2); + % \@ifnextchar{[}% {\tikztiming@tabletiming}% {\tikztiming@tabletiming[]}% #2\relax - \path let \p1 = (timing/table/bottom right), \p2 = (timing/end base) in - coordinate (timing/table/bottom right) at ({max(\x1,\x2)},\y2); + \path let \p1 = (timing@table@bottom right), \p2 = (timing/end base) in + coordinate (timing@table@bottom right) at ({max(\x1,\x2)},\y2); % \pgfmathparse{max(\tikztiming@maxwidth,\tikztimingwidth)}% \let\tikztiming@maxwidth\pgfmathresult @@ -4649,8 +5096,9 @@ \ifx\tikztiming@lastchar\empty \def\tikztiming@lastchar{@}% \fi - \edef\@tempa{\noexpand\timing[name=row\the\c@tikztiming@nrows,\tikztiming@settings] - at (last row)}% + \edef\@tempa{\noexpand\timing + [name=row\the\c@tikztiming@nrows,alias=last row,% + \expandafter\unexpanded\expandafter{\tikztiming@settings}] at (@last row)}% \expandafter\@tempa\expandafter{\expandafter[\tikztiming@lastchar]#2}; } % \end{macrocode} @@ -4661,9 +5109,8 @@ \newcommand*\tikztiming@fulltablegrid[1][]{% \begin{pgfonlayer}{background} \scope[xstep={\timingwidth/2.},ystep={\timingheight/2.}, - shift={(timing/table/bottom left)},timing/table/grid,#1] - \draw (0,0) grid - ($ (timing/table/top right) - (timing/table/bottom left) $); + shift={(all rows.south west)},timing/table/grid,#1] + \draw (0,0) grid ($ (all rows.north east) - (all rows.south west) $); \endscope \end{pgfonlayer} } @@ -4675,7 +5122,7 @@ \def\tikztiming@tablegrid{% \@ifnextchar{*}% {\tikztiming@tablegrid@{row\row.high end}}% - {\tikztiming@tablegrid@{timing/table/top right}}% + {\tikztiming@tablegrid@{all rows.north east}}% } % \end{macrocode} % \end{macro} @@ -4705,16 +5152,49 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\tikztiming@tableheader}[3]{Optional Settings}{Text -% title}{Diagram title} +% \begin{macro}{\tikztiming@tableheader} +% [3]{Optional Settings}{Text title}{Diagram title} % \begin{macrocode} -\newcommand*\tikztiming@tableheader[3][]{% - \path [timing/table/header,#1] - (-1*{(\tikztiming@coldist)},1.5*{(\tikztiming@rowdist)}) node - [anchor=base east] {\ignorespaces #2\unskip\strut} - (0,1.5*{(\tikztiming@rowdist)}) node - [anchor=base west] {\ignorespaces #3\unskip\strut} - ; +\def\tikztiming@tableheader{% + \@ifnextchar[%] + {\tikztiming@tableheader@}% + {\tikztiming@tableheader@@{}[]}% +} +\def\tikztiming@tableheader@[#1]{% + \@ifnextchar[%] + {\tikztiming@tableheader@@{#1}}% + {\tikztiming@tableheader@@{#1}[]}% +} +\def\tikztiming@tableheader@@#1[#2]#3{% + \@ifnextchar[%] + {\tikztiming@tableheader@@@{#1}{#2}{#3}}% + {\tikztiming@tableheader@@@{#1}{#2}{#3}[]}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tikztiming@tableheader} +% [5]{Optional settings}{Optional label@header Settings}{Label title}{Optional Diagram title settings}{Diagram title} +% \begin{macrocode} +\def\tikztiming@tableheader@@@#1#2#3[#4]#5{% + \path + let + \p1 = (label@header), + \p2 = (all labels.east), + \p3 = (all labels.west) + in + (\x2,\y1) -- node [pos=0,anchor=base east,timing/table/header,timing/table/label header,#1,#2] + (label header) {\ignorespaces #3\unskip\strut} (\x3,\y1) + ; + \path + let + \p4 = (diagram@header), + \p5 = (all rows.west), + \p6 = (all rows.east) + in + (\x5,\y4) -- node [pos=0,anchor=base west,timing/table/header,timing/table/row header,#1,#4] + (row header) {\ignorespaces #5\unskip\strut} (\x6,\y4) + ; \tikztiming@tableheadtrue } \newif\iftikztiming@tablehead @@ -4732,7 +5212,7 @@ let \p1 = (NW), \p2 = (SE), - \p3 = (last row) + \p3 = (@last row) in ($ (\x1-\tabcolsep,\y3) - (0,.5*{(\rowdist)}) $) -- ($ (\x2+\tabcolsep,\y3) - (0,.5*{(\rowdist)}) $) @@ -4763,7 +5243,7 @@ \fi \foreach \row in \list {% \draw [timing/table/lines,#1] let - \p1 = (timing/table/bottom right) + \p1 = (all rows.south east) in ($ (0,\rowdist) - (0,\row * {(\rowdist)}) $) -- +(\x1,0); }% @@ -4781,7 +5261,7 @@ \def\list{0,1,...,\twidth}% \fi \draw [timing/table/lines,#1] let - \p1 = ($ (timing/table/bottom right) - (0,2) $) + \p1 = ($ (all rows.south east) - (0,2) $) in \foreach \clk in \list { (\clk,+1.5) -- +(0,\y1) @@ -4792,27 +5272,12 @@ % \end{macrocode} % \end{macro} % -% \subsection{Shapes} +% \section{Shapes} % \begin{macrocode} \pgfdeclareshape{tikztiming@shape}{% - \savedanchor\northeast{\pgfpointxy{.5*\tikztimingwidth}{.5}}% - \savedanchor\northeastborder{\pgfpointxy{.5*\tikztimingwidth+0.1}{.6}}% - \savedanchor\startpoint{% - \pgfpointanchor{timing/start}{center}% - \@tempdima=\pgf@x - \@tempdimb=\pgf@y - \pgfpointxy{-.5*\tikztimingwidth}{-.5}% - \advance\pgf@x by \@tempdima - \advance\pgf@y by \@tempdimb - }% - \savedanchor\endpoint{% - \pgfpointanchor{timing/end}{center}% - \@tempdima=\pgf@x - \@tempdimb=\pgf@y - \pgfpointxy{-.5*\tikztimingwidth}{-.5}% - \advance\pgf@x by \@tempdima - \advance\pgf@y by \@tempdimb - }% + \savedanchor\northeast{\tikztiming@northeast}% + \savedanchor\startpoint{\tikztiming@startpoint}% + \savedanchor\endpoint{\tikztiming@endpoint}% \anchor{center}{\pgfpointorigin}% \anchor{start}{\startpoint}% \anchor{end}{\endpoint}% @@ -4843,7 +5308,7 @@ \anchorborder{% \@tempdima=\pgf@x \@tempdimb=\pgf@y - \pgfpointborderrectangle{\pgfpoint{\@tempdima}{\@tempdimb}}{\northeastborder}% + \pgfpointborderrectangle{\pgfpoint{\@tempdima}{\@tempdimb}}{\northeast}% }% } % \end{macrocode} @@ -4864,7 +5329,7 @@ % \end{macrocode} % -% \subsection{Other Macros} +% \section{Other Macros} % % \begin{macro}{\tikztiming@iflower}[1]{Character} % \begin{macrocode} @@ -4948,7 +5413,7 @@ \tikztimingsetzslope{0.05}% % \end{macrocode} % -% \subsection{Timing Character Definition Macros} +% \section{Timing Character Definition Macros} % % \begin{macro}{\tikztiminguse}[1]{Character(s)} % \begin{macrocode} @@ -5017,7 +5482,7 @@ % \begin{macro}{\tikztiming@chars}[1]{Comma to gobble} % Initial definition of character list. Will gobble the separation comma in % front of the first character which is added to the list. -% \begin{macrocode} +% \begin{macrocode} \def\tikztiming@chars#1{} % \end{macrocode} % \end{macro} @@ -5087,7 +5552,15 @@ % \end{macrocode} % \end{macro} % -% \subsection{NewDraw Macros} +% \begin{macro}{\tikztiming@setref}[2]{Reference Name}{Shift Offset} +% \begin{macrocode} +\def\tikztiming@setref#1#2{% + coordinate (#1) coordinate (#1) at ([shift={(#2)}]#1) +} +% \end{macrocode} +% \end{macro} +% +% \section{NewDraw Macros} % % \begin{macro}{\tikztiming@newdraw} % \begin{macrocode} @@ -5116,14 +5589,14 @@ % \end{macrocode} % \end{macro} % -% \subsection{Definition of Timing Characters} +% \section{Definition of Timing Characters} % % Pre-define list of timing characters to have it in a sorted fashion. % \begin{macrocode} \def\tikztiming@chars{H,L,Z,X,M,D,U,T,C}% % \end{macrocode} % -% \subsubsection{Character `S'} +% \subsection{Character `S'} % This character is now implemented as modifier to avoid hassle with triple % character transitions. % \begin{macrocode} @@ -5152,7 +5625,7 @@ } % \end{macrocode} % -% \subsubsection{Character `G'} +% \subsection{Character `G'} % \begin{macrocode} \tikztiming@defcode{G}{% \tikztiming@output@addcode{% @@ -5175,7 +5648,7 @@ } % \end{macrocode} % -% \subsubsection{Character `H'} +% \subsection{Character `H'} % \begin{macrocode} \tikztimingchar{H}{++(0,\height)}{-- ++(#1,0)} @@ -5203,7 +5676,7 @@ % \end{macrocode} % -% \subsubsection{Character `L'} +% \subsection{Character `L'} % \begin{macrocode} \tikztimingdef{DL}{ \tikztiming@oldnodecenter@ @@ -5214,7 +5687,7 @@ % \end{macrocode} % -% \subsubsection{Character `'} +% \subsection{Character `'} % \begin{macrocode} \tikztimingchar{L}{++(0,0)}{-- ++(#1,0)} @@ -5327,7 +5800,7 @@ -- (timing@save) ($ (timing@ref) + (#1,0) $) coordinate (timing@ref) - coordinate [shift={(\dslope/2,0)}] (timing@dend) + \tikztiming@setref{timing@dend}{\dslope/2,0} \tikztiming@oldnodecenter{% (0,-\height/2) }% @@ -5375,14 +5848,14 @@ +(0,0) coordinate (timing/start) coordinate (timing@ref) - coordinate [shift={(-\dslope/2,0)}] (timing@dstart) + \tikztiming@setref{timing@dstart}{-\dslope/2,0} +(0,\height/2) -- +(#1,\height/2) +(#1,-\height/2) -- ($ (timing@save) + (0,-\height/2) $) ++(#1,\height/2) coordinate (timing@ref) - coordinate [shift={(\dslope/2,0)}] (timing@dend) + \tikztiming@setref{timing@dend}{\dslope/2,0} \tikztiming@oldnodecenter{% (0,-\height/2) }% @@ -5461,7 +5934,7 @@ -- ($ (timing@save) + (0,-\height/2) $) ($ (timing@ref) + (#1,0) $) coordinate (timing@ref) - coordinate [shift={(\dslope/2,0)}] (timing@dend) + \tikztiming@setref{timing@dend}{\dslope/2,0} \tikztiming@oldnodecenter{% (0,-\height/2) }% @@ -5583,34 +6056,34 @@ } \tikztimingdef{HD@}{% - coordinate [shift={(0,-\height/2)}] (timing@ref) + \tikztiming@setref{timing@ref}{0,-\height/2} -- ++(\dslope/2, -\height/2) \tikztiming@chard@{#1}% } \tikztimingdef{TD@}{% - coordinate [shift={(0,-\height/2 * \value{tikztimingtrans})}] (timing@ref) + \tikztiming@setref{timing@ref}{0,-\height/2 * \value{tikztimingtrans}} -- ++(\dslope/2, -\height/2 * \value{tikztimingtrans}) \tikztiming@chard@{#1}% } \tikztimingdef{TD}{% \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}} - coordinate [shift={(0,\height/2 * \value{tikztimingtrans})}] (timing@ref) + \tikztiming@setref{timing@ref}{0,\height/2 * \value{tikztimingtrans}} -- ++(\dslope/2, \height/2 * \value{tikztimingtrans}) \tikztiming@chard{#1}% } \tikztimingdef{TDD}{% \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}} - coordinate [shift={(0,\height/2 * \value{tikztimingtrans})}] (timing@ref) + \tikztiming@setref{timing@ref}{0,\height/2 * \value{tikztimingtrans}} -- ++(\dslope/2, \height/2 * \value{tikztimingtrans}) \tikztiming@chard@{#1}% } \tikztimingdef{TUD}{% \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}} - coordinate [shift={(0,\height/2 * \value{tikztimingtrans})}] (timing@ref) + \tikztiming@setref{timing@ref}{0,\height/2 * \value{tikztimingtrans}} -- ++(\dslope/2, \height/2 * \value{tikztimingtrans}) \tikztiming@chard{#1}% } @@ -5619,7 +6092,7 @@ \tikztimingcpy{TUU}{TDD} \tikztimingdef{LD@}{% - coordinate [shift={(0,\height/2)}] (timing@ref) + \tikztiming@setref{timing@ref}{0,\height/2} -- ++(\dslope/2, \height/2) \tikztiming@chard@{#1}% } @@ -5651,19 +6124,19 @@ } \tikztimingdef{LD}{ - coordinate [shift={(0,\height/2)}] (timing@ref) + \tikztiming@setref{timing@ref}{0,\height/2} -- ++(\dslope/2, \height/2) \tikztiming@chard{#1}% } \tikztimingdef{LDD}{ - coordinate [shift={(0,\height/2)}] (timing@ref) + \tikztiming@setref{timing@ref}{0,\height/2} -- ++(\dslope/2, \height/2) \tikztiming@chard@{#1} } \tikztimingdef{LDU}{ - coordinate [shift={(0,\height/2)}] (timing@ref) + \tikztiming@setref{timing@ref}{0,\height/2} -- ++(\dslope/2, \height/2) \tikztiming@chard{#1} } @@ -5672,19 +6145,19 @@ \tikztimingcpy{LUU}{LDD} \tikztimingdef{HD}{ - coordinate [shift={(0,-\height/2)}] (timing@ref) + \tikztiming@setref{timing@ref}{0,-\height/2} -- ++(\dslope/2, -\height/2) \tikztiming@chard{#1} } \tikztimingdef{HDD}{ - coordinate [shift={(0,-\height/2)}] (timing@ref) + \tikztiming@setref{timing@ref}{0,-\height/2} -- ++(\dslope/2, -\height/2) \tikztiming@chard@{#1} } \tikztimingdef{HDU}{ - coordinate [shift={(0,-\height/2)}] (timing@ref) + \tikztiming@setref{timing@ref}{0,-\height/2} -- ++(\dslope/2, -\height/2) \tikztiming@chard{#1} } @@ -5693,7 +6166,7 @@ % \end{macrocode} % -% \subsubsection{Character `M'} +% \subsection{Character `M'} % \begin{macrocode} \tikztimingecopy{M}{Z} \tikztimingchar{M}{++(0,\height/2.)}{ @@ -5733,7 +6206,7 @@ % \end{macrocode} % -% \subsubsection{Character `T'} +% \subsection{Character `T'} % \begin{macrocode} \newcounter{tikztimingtrans} \newcounter{tikztimingtranspos} @@ -5811,12 +6284,12 @@ } % \end{macrocode} % -% \subsubsection{Character `C'} +% \subsection{Character `C'} % \begin{macrocode} \tikztimingecopy{C}{T} % \end{macrocode} % -% \subsubsection{Character `U'} +% \subsection{Character `U'} % \begin{macrocode} \tikztimingecopy{U}{D} @@ -5840,13 +6313,13 @@ \tikztimingcpy{{U@edge@}UU}{{D@edge@}DD} \tikztimingdef{H{D@edge@}}{ - coordinate [shift={(0,-\height/2)}] (timing@ref) + \tikztiming@setref{timing@ref}{0,-\height/2} -- ++(\dslope/2, -\height/2) \tikztiming@chard{#1}% } \tikztimingdef{L{D@edge@}}{ - coordinate [shift={(0,\height/2)}] (timing@ref) + \tikztiming@setref{timing@ref}{0,\height/2} -- ++(\dslope/2, \height/2) \tikztiming@chard{#1}% } @@ -5858,7 +6331,7 @@ \tikztimingdef{T{D@edge@}}{ \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}} - coordinate [shift={(0,\height/2 * \value{tikztimingtrans})}] (timing@ref) + \tikztiming@setref{timing@ref}{0,\height/2 * \value{tikztimingtrans}} -- ++(\dslope/2, \height/2 * \value{tikztimingtrans}) \tikztiming@chard{#1}% } @@ -5910,7 +6383,7 @@ % \end{macrocode} % -% \subsubsection{Character `X'} +% \subsection{Character `X'} % \begin{macrocode} \tikztimingecopy{X}{Z} % \end{macrocode} @@ -5921,7 +6394,7 @@ % \end{macrocode} % % \clearpage -% \subsection{Libraries} +% \section{Libraries} % % \begin{macrocode} \newcommand*\usetikztiminglibrary[2][]{% @@ -5962,12 +6435,14 @@ % \iffalse %</package> % \fi -% \subsubsection{Either High or Low} -% Provides character `E'. % +% \section{Libraries} +% +% \subsection{Either High or Low} % \iffalse %<*lib-either> % \fi +% Provides character "E". % \begin{macrocode} \tikztimingchar{E}{ ++(0,0) @@ -6110,11 +6585,11 @@ \tikztimingdef{HEE}{% \newdraw [\style,preaction={\bgstyle}] -- +(#1,0) coordinate (timing@refb) - coordinate [shift={(0,-\height/2)}] (timing@ref) + \tikztiming@setref{timing@ref}{0,-\height/2} -- +($ (#1,-\height) + (\slope,0) $) coordinate (timing@refa) -- +(\slope,-\height) -- +(0,0) - coordinate [shift={(#1,-\height/2)}] (timing@ref) + \tikztiming@setref{timing@ref}{#1,-\height/2} ++($ (#1,-\height) + (\slope,0) $)% \code{\setcounter{tikztimingtranspos}{1}}% \code{\setcounter{tikztimingtrans}{-1}}% @@ -6124,11 +6599,11 @@ \tikztimingdef{LEE}{% \newdraw [\style,preaction={\bgstyle}] -- +(#1,0) coordinate (timing@refa) - coordinate [shift={(0,\height/2)}] (timing@ref) + \tikztiming@setref{timing@ref}{0,\height/2} -- +($ (#1,\height) + (\slope,0) $) coordinate (timing@refb) -- +(\slope,\height) -- +(0,0) - ++(#1,0) coordinate [shift={(0,\height/2)}] (timing@ref) + ++(#1,0) \tikztiming@setref{timing@ref}{0,\height/2} \code{\setcounter{tikztimingtranspos}{0}}% \code{\setcounter{tikztimingtrans}{1}}% \newdraw @@ -6147,7 +6622,7 @@ +($ (#1,0) + (\slope/2 - \slope/2 * \value{tikztimingtrans}, \height - \height/2 * \value{tikztimingtranspos}) $) coordinate (timing@refb) ++(#1,0) - coordinate [shift={(0,-\height/2 * \value{tikztimingtrans})}] (timing@ref) + \tikztiming@setref{timing@ref}{0,-\height/2 * \value{tikztimingtrans}} ++( .5 * \slope + .5 * \value{tikztimingtrans} * \slope, -.5 * \height - .5 * \value{tikztimingtrans} * \height @@ -6631,7 +7106,7 @@ } \tikztimingdef{@EH}{% - coordinate [shift={(0,\height/2)}] (timing/start) + \tikztiming@setref{timing/start}{0,\height/2} \newdraw [\bgstyle] -- +(0,\height) -- +($ (#1,\height) + (\slope,0) $) @@ -6648,7 +7123,7 @@ } \tikztimingdef{@ET}{% - coordinate [shift={(0,\height/2)}] (timing/start) + \tikztiming@setref{timing/start}{0,\height/2} \newdraw [\bgstyle] -- +(0,\height) {[\nstyle] @@ -6678,7 +7153,7 @@ } \tikztimingdef{@EL}{% - coordinate [shift={(0,\height/2)}] (timing/start) + \tikztiming@setref{timing/start}{0,\height/2} \newdraw [\bgstyle] -- +(0,\height) -- +(#1,\height) @@ -6695,7 +7170,7 @@ } \tikztimingdef{@ED}{% - coordinate [shift={(0,\height/2)}] (timing/start) + \tikztiming@setref{timing/start}{0,\height/2} \newdraw [\bgstyle] -- +(0,\height) -- +(#1,\height) @@ -6713,7 +7188,7 @@ } \tikztimingdef{@EZ}{% - coordinate [shift={(0,\height/2)}] (timing/start) + \tikztiming@setref{timing/start}{0,\height/2} \newdraw [\bgstyle] -- +(0,\height) -- +(#1,\height) @@ -6732,7 +7207,7 @@ \tikztimingdef{@EE}{% - coordinate [shift={(0,\height/2)}] (timing/start) + \tikztiming@setref{timing/start}{0,\height/2} \newdraw [\bgstyle] -- +(0,\height) -- +($ (#1,\height) + (\slope,0) $) @@ -6743,7 +7218,8 @@ -- +($ (#1,\height) + (\slope,0) $) coordinate (timing@refb) -- +(#1,0) coordinate (timing@refa) -- +(0,0) - ++(#1,0) coordinate [shift={(0,\height/2)}] (timing@ref) + ++(#1,0) + \tikztiming@setref{timing@ref}{0,\height/2} \code{\setcounter{tikztimingtranspos}{0}}% \code{\setcounter{tikztimingtrans}{1}}% } @@ -6755,9 +7231,8 @@ %</lib-either> % \fi % -% \subsubsection{Clock Arrows} -% -% \iffalse +% \subsection{Clock Arrows} +% \iffalse %<*lib-clockarrows> % \fi % \begin{macrocode} @@ -6828,11 +7303,14 @@ %</lib-clockarrows> % \fi % -% \subsubsection{Arrows} -% +% \subsection{Arrows} % \iffalse %<*lib-arrows> % \fi +% This library is only defining the "A" and "W" basic transitions ("AA", "AW", "WA", "WW"). +% While "W" is simply a copy of "A" with a different style. Both simple draw a line from |low| +% to |high| and than move the position to the right according to the |width| value and back to +% the |low| position. The different arrow directions are done by different styles. % \begin{macrocode} \tikzset{timing/.cd, A/.style={timing/a}, @@ -6854,8 +7332,7 @@ %</lib-arrows> % \fi % -% \subsubsection{Overlays} -% +% \subsection{Overlays} % \iffalse %<*lib-overlays> % \fi @@ -6907,7 +7384,7 @@ % saved and restored. The \cs{tikztiming@overlay@save} macro also includes an % self-assignment to its old version, which implements a stack. The macros must % be global because the overlay string can reopen a new TikZ path. -% \begin{macrocode} +% \begin{macrocode} \def\tikztiming@overlay@begin{ [/utils/exec={% \xdef\tikztiming@overlay@save{% @@ -6944,9 +7421,12 @@ % % \iffalse %</lib-overlays> +% \fi +% +% \subsection{Column Type} +% \iffalse %<*lib-columntype> % \fi -% \subsubsection{Column Type} % The \pkg{array} package is needed to define the column type. % \begin{macrocode} \RequirePackage{array} @@ -7049,10 +7529,12 @@ % % \iffalse %</lib-columntype> -%<*lib-nicetabs> % \fi -% \subsubsection{Nice Timing Tables} % +% \subsection{Nice Timing Tables} +% \iffalse +%<*lib-nicetabs> +% \fi % The dimensions of the following packages are used. % \begin{macrocode} \RequirePackage{array} @@ -7060,20 +7542,20 @@ % \end{macrocode} % -% \begin{macro}{\tikztiming@nicetabs@tableheader}[3]{Optional Settings}{Text -% title}{Diagram title} +% \begin{macro}{\tikztiming@nicetabs@tableheader}[1]{Optional Settings} +% Calculate separator heights and set nodes appropriately, then call +% the normal table header macro. % \begin{macrocode} -\newcommand*\tikztiming@nicetabs@tableheader[3][]{% +\newcommand*\tikztiming@nicetabs@tableheader[1][]{% \path [timing/table/midrules] [/utils/exec=\xdef\@gtempa{\the\pgflinewidth}]; \path [timing/table/header,#1] let \p1 = (0,\belowrulesep + \aboverulesep + \@gtempa + \arraystretch * - {(\ht\strutbox + \extrarowheight)} + \arraystretch\dp\strutbox) in - node [anchor=base west] (tikztiming@header) at (0,\y1) {\ignorespaces - #3\unskip\strut} - node [anchor=base east] at (-1*{(\tikztiming@coldist)},\y1) {\ignorespaces - #2\unskip\strut} - ; - \tikztiming@tableheadtrue + {(\ht\strutbox + \extrarowheight)} + \arraystretch\dp\strutbox) + in + coordinate (diagram@header) at (0,\y1) + coordinate (label@header) at (-1*{(\tikztiming@coldist)},\y1) + ; + \tikztiming@normal@tableheader[#1]% } % \end{macrocode} % \end{macro} @@ -7089,14 +7571,14 @@ let \p1 = (NW), \p2 = (SE), - \p3 = (last row text.base), + \p3 = (last label.base), \p4 = ($ (0,\y3) - (0,\arraystretch\dp\strutbox + \aboverulesep + .5\pgflinewidth) $) in (\x1-\tabcolsep,\y4) -- (\x2+\tabcolsep,\y4) \iftikztiming@tablehead let - \p5 = (tikztiming@header.base), + \p5 = (diagram@header.base), \p6 = ($ (0,\y5) + (0,\arraystretch * {(\ht\strutbox + \extrarowheight )} + \belowrulesep + .5\pgflinewidth) $) in @@ -7162,69 +7644,235 @@ % \end{macrocode} % \iffalse %</lib-nicetabs> -%<*lib-counters> % \fi % -% \subsubsection{Counters} +% \subsection{Counters} +% \iffalse +%<*lib-counters> +% \fi % % \begin{macrocode} +\newif\if@tikztiming@counter@wraps + \tikzset{% timing/new counter/.style={timing/counter/new={#1}}, timing/counter/.cd, new/.code={\tikztiming@counter@new{#1}}, new/.value required, opt/.cd, - char/.estore in=\tikztiming@counter@char, - reset char/.estore in=\tikztiming@counter@resetchar, - base/.estore in=\tikztiming@counter@base, - half width char/.estore in=\tikztiming@counter@hwchar, + char/.initial=, char/.value required, + reset char/.initial=, reset char/.value required, - base/.value required, + reset type/.is choice, + reset type/width/.code={\def\tikztiming@resettype{0}}, + reset type/arg/.code={\def\tikztiming@resettype{1}}, + reset type/both/.code={\def\tikztiming@resettype{2}}, + reset type/Both/.code={\def\tikztiming@resettype{3}}, + half width char/.initial=, half width char/.value required, + base/.initial=10, + base/.value required, + increment/.initial=1, + increment/.value required, + max value/.initial=, + max value/.value required, + min value/.initial=, + min value/.value required, + wraps/.is if=@tikztiming@counter@wraps, + digits/.initial=, + digits/.value required, + fg style/.initial=, + bg style/.initial=, + text style/.initial=, + text format/.initial=, + fg style/.value required, + bg style/.value required, + text style/.value required, + text format/.value required, +} +\def\tikztiming@counter@textformat{}% +% \end{macrocode} +% +% \begin{macro}{\tikztimingcounter}[1]{Counter Character} +% \begin{macrocode} +\def\tikztimingcounter#1{% + \csname tikztiming@counter@#1\endcsname +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tikztimingsetcounter}[2]{Counter Character}{pgfmath expression} +% \begin{macrocode} +\def\tikztimingsetcounter#1#2{% + \begingroup + \pgfmathtruncatemacro\@tempa{#2}% + \expandafter\global\expandafter\let\csname tikztiming@counter@#1\endcsname\@tempa + \endgroup } % \end{macrocode} +% \end{macro} % % \begin{macro}{\tikztiming@counter@new}[1]{Styles} +% Most parts of this macro is enclosed in a group to keep most changes locally. % \begin{macrocode} \def\tikztiming@counter@new#1{% - \let\tikztiming@counter@char\empty - \let\tikztiming@counter@resetchar\empty - \def\tikztiming@counter@base{10}% - \let\tikztiming@counter@hwchar\relax + \begingroup + \def\tikztiming@resettype{0}% +% \end{macrocode} +% The argument is taken as pgf keys relative to the "/tikz/timing/counter/opt" path. +% The counter character is mandatory and an error is raised if it is not defined. +% \begin{macrocode} \pgfqkeys{/tikz/timing/counter/opt}{#1}% - \ifx\tikztiming@counter@char\empty + \tikzset{timing/counter/opt/char/.get=\counterchar}% + \ifx\counterchar\empty \PackageError{tikz-timing-counters}{Counter character must be given using - the 'char' key!}% + the 'char' key!}{}{}{}% + \endgroup \else +% \end{macrocode} +% The counter boundary test code is now assembled in |\@tempb|. +% If the "wraps" option was used the \cs{tikztiming@counter@wrap} macro is used with the +% "min value" and "max value" as (expanded) arguments. +% \begin{macrocode} + \pgfkeys{/tikz/timing/counter/opt/min value/.get=\min}% + \pgfkeys{/tikz/timing/counter/opt/max value/.get=\max}% + \if@tikztiming@counter@wraps + \ifx\min\empty + \def\min{0}% + \fi + \ifx\max\empty + \PackageError{tikz-timing-counters}{The option 'wraps' needs the option 'max value' to be set!}{}{}{}% + \fi + \def\@tempb{% + \noexpand\tikztiming@counter@wrap% + {\expandafter\unexpanded\expandafter{\min}}% + {\expandafter\unexpanded\expandafter{\max}}% + }% + \else +% \end{macrocode} +% Otherwise either the \cs{tikztiming@counter@maxsat}, \cs{tikztiming@counter@minsat} or \cs{tikztiming@counter@minmaxsat} +% macro is used if "max value", "min value" or both are set, respectively. +% \begin{macrocode} + \ifx\min\empty + \ifx\max\empty + \let\@tempb\empty + \else + \def\@tempb{% + \noexpand\tikztiming@counter@maxsat% + {\expandafter\unexpanded\expandafter{\max}}% + }% + \fi + \else + \ifx\max\empty + \def\@tempb{% + \noexpand\tikztiming@counter@minsat% + {\expandafter\unexpanded\expandafter{\min}}% + }% + \else + \def\@tempb{% + \noexpand\tikztiming@counter@minmaxsat% + {\expandafter\unexpanded\expandafter{\min}}% + {\expandafter\unexpanded\expandafter{\max}}% + }% + \fi + \fi + \fi +% \end{macrocode} +% The counter styles are set up. +% \begin{macrocode} + \pgfkeys{/tikz/timing/counter/opt/fg style/.get=\fgstyle}% + \pgfkeys{/tikz/timing/counter/opt/bg style/.get=\bgstyle}% + \pgfkeys{/tikz/timing/counter/opt/text style/.get=\textstyle}% + \pgfkeys{/tikz/timing/counter/opt/text format/.get=\textformat}% +% \end{macrocode} +% Finally the \cs{tikztiming@counter@new@} macro is called with most of the +% settings as expanded arguments. +% \begin{macrocode} + \pgfkeys{/tikz/timing/counter/opt/increment/.get=\increment}% \edef\@tempa{% - \noexpand\tikztiming@counter@new@{\tikztiming@counter@char}{\tikztiming@counter@base}% - {\tikztiming@counter@hwchar}{\tikztiming@counter@resetchar}% + \noexpand\tikztiming@counter@new@ + {\pgfkeysvalueof{/tikz/timing/counter/opt/char}}% + {\pgfkeysvalueof{/tikz/timing/counter/opt/base}}% + {\pgfkeysvalueof{/tikz/timing/counter/opt/half width char}}% + {\pgfkeysvalueof{/tikz/timing/counter/opt/reset char}}% + {\pgfkeysvalueof{/tikz/timing/counter/opt/digits}}% + {\expandafter\unexpanded\expandafter{\increment}}% + {\@tempb}% + {\min}% + {\tikztiming@resettype}% + {\expandafter\unexpanded\expandafter{\fgstyle}}% + {\expandafter\unexpanded\expandafter{\bgstyle}}% + {\expandafter\unexpanded\expandafter{\textstyle}}% + {\expandafter\unexpanded\expandafter{\textformat}}% }% + \expandafter\expandafter\expandafter\endgroup \expandafter\@tempa \fi } % \end{macrocode} % \end{macro} % -% \begin{macro}{\tikztiming@counter@new@}[4]{Character}{Base}{Half Width -% Character}{Reset Character} +% \begin{macro}{\tikztiming@counter@new@}[9]{Character}{Base}{Half Width +% Character}{Reset Character}{Number of Digits}{Increment}{Boundary Code}{Min Value}{Reset Type} % \begin{macrocode} -\def\tikztiming@counter@new@#1#2#3#4{% - \newcounter{tikztiming@counter@#1}% - \tikzset{timing/counter/#1/.append style={}}% - \tikztimingmetachar{#1}[1]{##1D{[timing/counter/#1]\tikztiming@counter@vs{#1}{#2}}}% - \ifx\tikztiming@counter@hwchar\empty\else - \ifx\tikztiming@counter@hwchar\relax +\def\tikztiming@counter@new@#1#2#3#4#5#6#7#8#9{% + \ifx\empty#8\empty + \@namedef{tikztiming@counter@#1}{0}% + \else + \expandafter + \pgfmathtruncatemacro\csname tikztiming@counter@#1\endcsname{#8}% + \fi + \tikztimingmetachar{#1}[1]{ { [timing/counter/#1] ##1D{[timing/counter/#1/text]\tikztiming@counter@vs{#1}{#2}{#5}{#6}{#7}} } }% + \ifx\empty#3\empty \tikztiming@iflower{#1}{}% {\lowercase{\tikztimingmetachar{#1}}[1]% - {##1d{[timing/counter/#1]\tikztiming@counter@vs{#1}{#2}}}}% - \else - \tikztimingmetachar{#3}[1]{##1d{[timing/counter/#1]\tikztiming@counter@vs{#1}{#2}}}% + { { [timing/counter/#1] ##1d{[timing/counter/#1/text]\tikztiming@counter@vs{#1}{#2}{#5}{#6}{#7}}} }% + }% + \else + \tikztimingmetachar{#3}[1]{% + { [timing/counter/#1] ##1d{[timing/counter/#1/text]\tikztiming@counter@vs{#1}{#2}{#5}{#6}{#7}} }% + }% + \fi + \ifx\empty#4\empty\else + \ifcase0#9\relax + \tikztimingmetachar{#4}[1]{[|/utils/exec=\tikztiming@counter@reset{#1}{##1}|]}% + \or + \tikztimingmetachar{#4}[2]{[|/utils/exec=\tikztimingsetcounter{#1}{##2}|]}% + \or + \uppercase{\tikztimingmetachar{#4}}[1]{[|/utils/exec=\tikztiming@counter@reset{#1}{##1}|]}% + \lowercase{\tikztimingmetachar{#4}}[2]{[|/utils/exec=\tikztimingsetcounter{#1}{##2}|]}% + \or + \lowercase{\tikztimingmetachar{#4}}[1]{[|/utils/exec=\tikztiming@counter@reset{#1}{##1}|]}% + \uppercase{\tikztimingmetachar{#4}}[2]{[|/utils/exec=\tikztimingsetcounter{#1}{##2}|]}% \fi \fi - \ifx\tikztiming@counter@resetchar\empty\else - \tikztimingmetachar{#4}[1]{[|/utils/exec=\tikztiming@counter@reset{#1}{##1}|]}% + \tikztiming@counter@new@@{#1}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tikztiming@counter@new@@}[5]{Character}{Foreground Style}{Background Style}{Text Style} +% {Text format} +% The counter styles are set up. +% \begin{macrocode} +\def\tikztiming@counter@new@@#1#2#3#4#5{% + \tikzset{timing/counter/#1/.style={}}% + \ifx\empty#2\empty\else + \tikzset{timing/counter/#1/.append style={% + /tikz/timing/d/.style={#2}% + }}% + \fi + \ifx\empty#3\empty\else + \tikzset{timing/counter/#1/.append style={% + /tikz/timing/d/background/.style={#3}% + }}% + \fi + \tikzset{timing/counter/#1/text/.style={#4}}% + \ifx\empty#5\empty\else + \tikzset{timing/counter/#1/.append style={% + /utils/exec={\def\tikztiming@counter@textformat{#5}}% + }}% \fi } % \end{macrocode} @@ -7235,18 +7883,81 @@ % with \cs{setcounter} to make it global. % \begin{macrocode} \def\tikztiming@counter@reset#1#2{% - \pgfmathsetcounter{tikztiming@counter@#1}{round((#2)/\tikztiming@wscale)}% - \setcounter{tikztiming@counter@#1}{\value{tikztiming@counter@#1}}% + \begingroup + \pgfmathtruncatemacro\@tempa{round((#2)/\tikztiming@wscale)}% + \expandafter\global\expandafter\let\csname tikztiming@counter@#1\endcsname\@tempa + \endgroup +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tikztiming@counter@vs}[5]{Character}{Base}{Number of Digits}{Increment}{Boundary Code} +% Note: \cs{pgfmathdectoBase} is only used for a base different to 10 to allow +% negative number for decimal base. +% \begin{macrocode} +\def\tikztiming@counter@vs#1#2#3#4#5{% + \begingroup + \ifx\empty#3\empty\else + \pgfmathsetbasenumberlength{#3}% + \fi + \ifnum#2=10 + \expandafter\expandafter\expandafter\tikztiming@counter@textformat + \expandafter\expandafter\expandafter{\csname tikztiming@counter@#1\endcsname}% + \else + \pgfmathdectoBase\pgfmathresult{\@nameuse{tikztiming@counter@#1}}{#2}% + \expandafter\tikztiming@counter@textformat\expandafter{\pgfmathresult}% + \fi + \edef\N{\@nameuse{tikztiming@counter@#1}}% + \pgfmathtruncatemacro\N{\N + #4}% + #5% + \expandafter\global\expandafter\let\csname tikztiming@counter@#1\endcsname\N + \endgroup +} +% \end{macrocode} +% \end{macro} +% +% The following macros checks the boundaries of the counter value. The value is stored in the +% macro \cs{N}, the boundaries are provided as arguments. If necessary the value can be +% adjusted by changing \cs{N}. All values are taken as \emph{integers}. +% +% \begin{macro}{\tikztiming@counter@minsat}[1]{Minimum Value} +% \begin{macrocode} +\def\tikztiming@counter@minsat#1{% + \pgfmathtruncatemacro\MIN{#1}% + \ifnum\N<\MIN \let\N\MIN \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tikztiming@counter@maxsat}[1]{Maximum Value} +% \begin{macrocode} +\def\tikztiming@counter@maxsat#1{% + \pgfmathtruncatemacro\MAX{#1}% + \ifnum\N>\MAX \let\N\MAX \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tikztiming@counter@minmaxsat}[2]{Minimum Value}{Maximum Value} +% \begin{macrocode} +\def\tikztiming@counter@minmaxsat#1#2{% + \tikztiming@counter@minsat{#1}% + \tikztiming@counter@maxsat{#2}% } % \end{macrocode} % \end{macro} % -% \begin{macro}{\tikztiming@counter@vs}[2]{Character}{Base} +% \begin{macro}{\tikztiming@counter@wrap}[2]{Minimum Value}{Maximum Value} % \begin{macrocode} -\def\tikztiming@counter@vs#1#2{% - \pgfmathdectoBase\pgfmathresult{\value{tikztiming@counter@#1}}{#2}% - \pgfmathresult - \stepcounter{tikztiming@counter@#1}% +\def\tikztiming@counter@wrap#1#2{% + \pgfmathtruncatemacro\MIN{#1}% + \pgfmathtruncatemacro\MAX{#2}% + \ifnum\N>\MAX + \pgfmathtruncatemacro\N{\MIN + (\N-\MAX-1)}% + \fi + \ifnum\N<\MIN + \pgfmathtruncatemacro\N{\MAX - (\MIN-\N+1)}% + \fi } % \end{macrocode} % \end{macro} @@ -7258,6 +7969,10 @@ % \end{macrocode} % \iffalse %</lib-counters> +% \fi +% +% \subsection{Advanced Nodes} +% \iffalse %<*lib-advnodes> % \fi % \begin{macrocode} @@ -7422,9 +8137,9 @@ \anchor{low2}{\tikztiming@useanchor{low2}}% \anchor{high2}{\tikztiming@useanchor{high2}}% % - \anchorborder{\pgfpointorigin}% + \expandafter\anchorborder\expandafter{\csname pgf@anchor@\shape@name @center\endcsname}% % - \nodeparts{}% no text + \nodeparts{}% } \def\tikztiming@nodes@getoffset{% @@ -7588,7 +8303,7 @@ \else \anchorpoint{originoffset}{-.5\slope}{.5\height}% \anchorpoint{oldcenter}{-.5\slope}{-.5\height}% - \anchorpoint{HIGH}{.5\slope}{.5\height}% + \anchorpoint{HIGH}{-.5\slope}{.5\height}% \anchorpoint{high}{-.5\slope}{.5\height}% \anchorpoint{low}{.5\slope}{-.5\height}% \fi @@ -7658,8 +8373,8 @@ \anchorpoint{oldcenter}{-.5\dslope}{-.5\height}% \anchorpoint{mid}{0pt}{0pt}% \anchorpoint{HIGH}{-.5\dslope}{.5\height}% - \anchorpoint{high}{-.5\dslope}{.5\height}% - \anchorpoint{high2}{.5\dslope}{.5\height}% + \anchorpoint{high}{.5\dslope}{.5\height}% + \anchorpoint{high2}{-.5\dslope}{.5\height}% \anchorpoint{low}{-.5\dslope}{-.5\height}% } @@ -7860,6 +8575,10 @@ % \end{macrocode} % \iffalse %</lib-advnodes> +% \fi +% +% \subsection{Intervals} +% \iffalse %<*lib-interval> % \fi % \begin{macrocode} @@ -7868,14 +8587,14 @@ \let\tikztiming@rinterval\relax \tikztimingdef{LZ}{ - \tikztiming@linterval + \tikztiming@rinterval {\newdraw [\style]} {-- ++(\zslope,+\height/2.)} -- ++($ (#1,0) - (\zslope,0) $) } \tikztimingdef{HZ}{% - \tikztiming@linterval + \tikztiming@rinterval {\newdraw [\style]} {-- ++(\zslope,-\height/2.)} -- ++($ (#1,0) - (\zslope,0) $) @@ -7883,21 +8602,21 @@ \tikztimingdef{TZ}{% \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}} - \tikztiming@linterval + \tikztiming@rinterval {\newdraw [\style]} {-- ++(\zslope,\value{tikztimingtrans}*\height/2.)} -- ++($ (#1,0) - (\zslope,0) $) } \tikztimingdef{ZL}{% - \tikztiming@rinterval + \tikztiming@linterval {\newdraw} {-- ++(\zslope,-\height/2.)} -- ++($ (#1,0) - (\zslope,0) $) } \tikztimingdef{ZH}{% - \tikztiming@rinterval + \tikztiming@linterval {\newdraw} {-- ++(\zslope,\height/2.)} -- ++($ (#1,0) - (\zslope,0) $) @@ -7905,7 +8624,7 @@ \tikztimingdef{ZT}{% \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}} - \tikztiming@rinterval + \tikztiming@linterval {\newdraw [\style]} {-- ++(\zslope,\value{tikztimingtrans}*\height/2.)} -- ++($ (#1,0) - (\zslope,0) $) @@ -7924,9 +8643,9 @@ ro/.style={/tikz/timing/interval/right open}, rc/.style={/tikz/timing/interval/right close}, left close/.code={\let\tikztiming@linterval\tikztiming@onetwo}, - left open/.code={\let\tikztiming@linterval\tikztiming@twoone}, + left open/.code={\let\tikztiming@linterval\tikztiming@twoone}, right open/.code={\let\tikztiming@rinterval\tikztiming@onetwo}, - right close/.code={\let\tikztiming@rinterval\tikztiming@twoone}, + right close/.code={\let\tikztiming@rinterval\tikztiming@twoone}, } \tikzset{ timing/interval/normal/.style={/tikz/timing/interval/left close,/tikz/timing/interval/right open}, @@ -7940,11 +8659,10 @@ % \fi % % \subsection{Beamer Overlay Support} -% Experimental library for marginal beamer overlay support. It will change in future versions. Use at own risk! -% % \iffalse %<*lib-beamer> % \fi +% Experimental library for marginal beamer overlay support. It will change in future versions. Use at own risk! % \begin{macrocode} \PackageWarning{\@currname}{This library is experimental and will change in future versions!}{}{} @@ -7962,8 +8680,7 @@ %</lib-beamer> % \fi % -% \section{Compatibility with \protect\pkg{ifsym} Macros} -% +% \subsection{Compatibility with \protect\pkg{ifsym} Macros} % \iffalse %<*lib-ifsym> % \fi @@ -8075,3 +8792,6 @@ % % \Finale \endinput +% \iffalse +% vim: foldmarker=%<*,%</ foldmethod=marker foldenable foldtext=foldtext() +% \fi |