I'm using the tikz-timing
package and would like to apply either snakes
type of styling, or say the double
for double lines to signal lines. Consider the example below:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,chains,matrix,positioning,scopes,snakes,decorations.markings}
\usepackage{tikz-timing}
\usetikztiminglibrary[rising arrows]{clockarrows}
\usetikztiminglibrary{advnodes}
\usepackage[graphics,tightpage,active]{preview}
\PreviewEnvironment{tikzpicture}
\newlength{\imagewidth}
\newlength{\imagescale}
\begin{document}
\begin{tikztimingtable}[timing/nodes/advanced,]
%
% start timing diagram
%
\textcolor{green}{ClockA} & [green] H N(ca01)
C N(ca02) C N(ca03) C N(ca04) C N(ca05) C N(ca06) C N(ca07) C N(ca08) \\ %
\textcolor{orange}{ClockB} & [orange,snake=zigzag,double] L N(cb01)
C N(cb02) C N(cb03) C N(cb04) C N(cb05) C N(cb06) C N(cb07) C N(cb08) \\ %
%
% end timing diagram
%
% there must NOT be an uncommented line before \extracode!
%
\extracode
\tablerules
%\tablegrid
\begin{background}[line width=0.35pt]
\draw[snake=zigzag,double] (ca01) -- (cb01) ;
\end{background}
\end{tikztimingtable}
\end{document}
which results in the following timing diagram:
Obviously, the snakes
and double
work for normal lines, but not for signals.
Is there a possibility to also 'style' the signal diagram lines in this way?
Best Answer
The support for the line decorations is very limited in
tikz-timing
. The reason is that the timing symbols are not drawn as one drawing path but using multiple ones. Therefore the previous style settings are getting lost most of the time a new timing character is used. TheL
andH
characters are different here and are actually drawn in one path.The first style options at the very beginning are global for the whole line, but unfortunately TikZ seems to require to put many of the decoration styles as local option to the actual
\draw
command. Therefore your code doesn't work as expected. A few styles, like theline width
is explicitly copied from one drawing path to the next bytikz-timing
but this doesn't help you with decorations.You can however add certain styles to the style definitions of the timing characters. These are called
/tikz/timing/<char>
and can be modified like shown below. Note that there is not styles forH
andL
characters at the moment. I might change this in the future and maybe also add one style which is used by every character. This should simply things like that.I now made some minor changes to
tikz-timing
to provide atiming/every char
style which is used for every timing character. A second onetiming/every bg
is used for every background (like forU
). TheH
andL
character now also have an own style. However they do not start a new drawing path soHL
combinations will be drawn with the last used style.I have to test this further before I can publish it on CTAN. Feel free to download it from the SVN repository. Simply download the DTX and INS file and then run the INS file through
latex
in order to extract the package files. Do not hesitate to contact me by PM if you find any issue with this version.The new styles can be used like that and should work with decorations: