This is (more-less) two (or more) questions in one - however related; so I'll try to cover all in one post. I have a specific timing diagram layout in mind, and I'm almost there:


The complete code for that example can be found below. In brief, this is what I want to achieve:

  1. I want to be able to display a multi-line (two line) text label inside the L and H logic characters/symbols: the first line is the value of the signal (0 or 1) - the second line is some sort of an indexing label (which could be plainly numeric '1', or alphanumeric 'a1' - passed as an argument, e.g. h{a1})
  2. I want to be able to show a discontinuity in the time axis; the example shows the following variants:
    1. Based on D character (with Low and High parallel lines; capital letter name B or V) or based on Z character (line in middle; lowercase letter name b or v)
    2. Uses ellipsis (..., that is, \cdots; B or b) or uses "a curvy widget" (here $\iint$) as separator characters (V or v metacharacter macros)
      • (sort of) off topic: I believe ellipsis is an appropriate character/symbol for "discontinuity" in time diagrams, as it also means "omission"; this with the "curvy widget" is something I have from back in the (high school) days (last century). Does anyone know a name for this sort of a "curvy widget" symbol, used in the graphical/diagram sense for discontinuity/skip/omission? I used a double integral symbol, $\iint$, simply because I couldn't find anything more appropriate; I simply need two parallel 'S'-like shapes, but I don't like the clef-like "dot serifs" (how are these called in typography?) that the integral sign has; closest I could find is the Unicode symbol U+2240 '' for wreath product - however, I'd need the 'wreath' symbol rotated 180 degrees so its oriented rightly (to the right)


... and here is an overview of the problems:

  1. Only D can accept text characters/labels 'inside' itself - this is, however, not really a problem, because in the metacharacter macro, I can first draw a D with thin dashed lines (which also helps me visually - so those dashed lines in the image are on purpose) and the text label, then 'restart' the macro drawing, and draw an L or H symbol... but, then:
    1. D cannot accept paragraphed content (with linebreaks) - so I have to "cheat" with TeX primitives (\raise/\lower \hbox and \kern) to simulate two lines; as a result these text lines inside are not center-aligned
  2. I have to apply the same TeX primitive (\raise/\lower \hbox and \kern) approach, to be able to align the "time-discontinuity" symbol to the Low and High lines of the D-derived logic symbols (B and V); as the alignment is done "by hand", again these symbols are not properly center aligned (in respect to the entire width of the logic symbol)
    1. I cannot visually "interrupt" the D lines (if I try to "break" in code, I'll get a D transition, which I do not want) - so I have to use \colorbox{white}{...} to specify a white background; but then, this background "spills over" the grid, which again I do not want - I'd simply want a white "interruption" of the same height as the line
      • I'd also like the signal lines to touch exactly the "curvy widget" symbols
    2. For the Z derived symbols - I cannot "write" text labels "in" them, so I have to specify a "named node" (N(b), N(v)); and then draw a TikZ text node aligned to these "named nodes" in the \extracode section - however, I don't want this, because I do not want to manually keep track of 'named node' references, depending on how many time discontinuities I want to show in any number of given signals
      • the ellpsis is not properly centered in this case either
      • the white background of the TikZ nodes is not as broad as in the \colorbox case, but I'd still like to make it as high as the signal line strokewidth only
      • Also here, I'd like the signal line to touch the "curvy widget" symbol


So, basically, those are the problems I have. I'm aware that there may not be a simple answer to these problems - however, the thing is that I (sort of) "hacked" my way through to getting this image; so, I was hoping maybe there is a more proper way of doing this, where the above problems are already handled - which I may have missed...

Many thanks in advance for any answers,


The code:

% sigdisc_tikz.tex
% pdflatex sigdisc_tikz.tex                                   # to obtain sigdisc_tikz.pdf
% convert -density 300x sigdisc_tikz.pdf sigdisc_tikz.png   # to obtain sigdisc_tikz.png

% \documentclass[border=0]{standalone} % incorrectly crops image - use minimal + preview

% minimal doesn't have \scriptsize, \tiny:
% see also http://wiki.lyx.org/FAQ/ChangeFontUsingLatex ;
% copied from IEEEtran.cls (for 12 pt doc)

% \let\tthtext\tikztiming@handletext % ! Undefined control sequence.
% \def\tthtext{\tikztiming@handletext} % ! Improper alphabetic constant.

% \usetikzlibrary{arrows,chains,matrix,positioning,scopes,snakes,decorations.markings} % Package tikz Warning: Snakes have been superseded by decorations.
\usetikztiminglibrary[rising arrows]{clockarrows}

\usetikztiminglibrary{nicetabs} % a bit strange with \Huge; use belowrulesep to adjust
% \typeout{\the\abovetopsep} % no - belowrulesep
% \typeout{\the\belowrulesep} % yes
%% \belowrulesep=10pt % ok; but not anymore? Not with ex (1ex)?!
%% \setlength{\belowrulesep}{10ex} % ok, but not with ex/em anymore?
% use current font size in \f@size (note, it's in pt, but "without the unit"); works only for normalsize
% for others, use a new def (let):
\setlength{\myfontsizelen}{\myfontsize pt}

\setlength{\belowrulesep}{0.4\myfontsizelen} % ok, but not with ex/em anymore?


\usepackage{type1cm} % to avoid "LaTeX Font Warning: Font shape `OML/cmm/m/it' in size <2> not available"; tlmgr install type1cm


% have a D with bleak color to allow text;
% then restart, and in overlay, draw a H
% \tikztimingmetachar{h}{H; O{$1$}} % nothing happens
% \tikztimingmetachar{h}{ [gray] D{1}; [black] O{H} } % all is gray
% \tikztimingmetachar{h}{ [[timing/.style={dotted,gray}]] D{1}; [black] O{H} } % all is black
% \tikztimingmetachar{h}{ [timing/.style={dotted,gray}] D{1}; [black] O{H} } % all is black
% \tikztimingmetachar{h}{ ; [dotted,gray] D{1}; [black] O{H} ; } % late?
% NOTE: `before` - O{background} - foreground - `after`
% \tikztimingmetachar{h}{ ; O{ [dotted,gray] D{1} } [solid,black] H ; } % ok
% \tikztimingmetachar{h}{ O{ [dotted,gray] D{1} } [solid,black] H  } % not ok
% \tikztimingmetachar{h}{ O{ [dotted,gray] D{1} } [solid,black] H ; } % not ok
% \tikztimingmtachar{h}{ ; O{ [dotted,gray] D{1} } [solid,black] H } % ok
% \tikztimingmetachar{h}{ ; O{ [dotted,black!10] D{1} } [solid,black] H } % ok
% \tikztimingmetachar{h}{ ; O{ [dotted,black!10,line width=1pt] D{[black]1} } [solid,black] H } % line width don't reset; default def: line width=0.15ex
% \tikztimingmetachar{h}{ ; O{ [dotted,black!10,line width=1pt] D{[black]1} } ; H } % line width, solid, black restored with the `;` before `H`

% these were OK:
% \tikztimingmetachar{h}{ ; O{ [dotted,black!40,line width=0.07ex,timing/dslope=0] D{[black]$1$} } ; H }
% \tikztimingmetachar{l}{ ; O{ [dotted,black!40,line width=0.07ex,timing/dslope=0] D{[black]$0$} } ; L }

% \linebreak inside D char has no effect;
% cannot have parbox, minipage inside D char: "Runaway argument? Paragraph ended before \tikztiming@metachar was complete."
% \parbox, \node next to D: "! Improper alphabetic constant."
% \vspace inside D passes, but no effect
% \lower1.1em\hbox{\kern-0.5em{b}} works (tex approach, as in \LaTeX logo)
% '\hbox to' does not really work there; \parbox neither ("! A <box> was supposed to be here.")
% note: #1 is always width of metacharacter
% also used: A, W, E, Q, I

% comments (code must be otherwise in one line!):
% \tikztimingmetachar{h}[2]{
%   ; % RESTART
%   O{                % start overlay
%   [dotted,black!40,line width=0.07ex,timing/dslope=0] % overlay options
%     D{                    % start D; `inside` text:
%       [black]             % option for D `inside` text
%       \parbox{2em}{       % start parbox, 2em width
%         \centering        % make stuff inside parbox centered (refers to first line)
%         $1$               % write out the value (text character) "1" in math mode
%         \lower1.1em\hbox{ % now \lower, and start a hbox
%           \kern-1.0em{    % pull the lowered content left a bit (so its almost centered with first line
%             (#2)          % write out string "(arg)"
%           }             % close \kern
%         }
%       }
%     }                 % close (insides of) D
%   }                 % close overlay
%   ; % RESTART
%   H % draw H logic character
% }

\tikztimingmetachar{h}[2]{ ; O{ [dotted,black!40,line width=0.07ex,timing/dslope=0] D{ [black] \parbox{2em}{\centering$\mathbf1$\lower1.1em\hbox{\kern-1.0em{(#2)}}}} } ; H }

\tikztimingmetachar{l}[2]{ ; O{ [dotted,black!40,line width=0.07ex,timing/dslope=0] D{ [black] \parbox{2em}{\centering$\mathbf0$\lower1.1em\hbox{\kern-1.0em{(#2)}}}} } ; L }

% "The new ‘$’ modifier can be used to calculate the width of the group characters:"
% use phantom to give an 'anchor' to \lower
% \raisebox: "! Improper alphabetic constant."
% debug with fbox:
% \tikztimingmetachar{B}[1]{ [black!40] $#1$D{\phantom{X}{\raise1.8em\hbox{\kern-1em\fbox{$\cdots$}}}{\lower1.8em\hbox{\kern-3.5em\fbox{$\cdots$}}} }  }
% with white background - colorbox
% first semicolon prevents "leak" of B's gray to the previous (say, h or l) character
% note - [red] is placed there, to show there's no effect on the color of the dots (in other position, it is simply rendered as text)
% B - based on D (...)
\tikztimingmetachar{B}[1]{ ; [black!40]$#1$D{ [red] \phantom{X}{\raise1.8em\hbox{\kern-1.3em\colorbox{white}{$\cdots$}}}{\lower1.8em\hbox{\kern-3.4em\colorbox{white}{$\cdots$}}} } }

% b - based on Z (...)
% for Z, color spec needs to be *after* the characters, to change stroke color!
% N(b) named node is to add a \node with the \cdots afterwards
\tikztimingmetachar{b}[1]{ ; $#1/2$Z[black!40] N(b) $#1/2$Z[black!40] }

% V - based on D (≀≀ / ∬ )
\tikztimingmetachar{V}[1]{ ; [black!40]$#1$D{ [red] \phantom{X}{\raise1.8em\hbox{\kern-1.3em\colorbox{white}{$\iint$}}}{\lower1.8em\hbox{\kern-3.4em\colorbox{white}{$\iint$}}} } }

% v - based on Z (≀≀ / ∬ )
\tikztimingmetachar{v}[1]{ ; $#1/2$Z[black!40] N(v) $#1/2$Z[black!40] }

%% --------------------------------

\mainsize % this one to make timing symbols (as default font) big!

  % start timing diagram
  \textcolor{black}{Sig1} & [black]
    Z H l{a1} l{2} h{3} 3B h{$N_{a}$} Z \\ %
  \textcolor{black}{Sig2} & [black]
    Z H h{1}  h{2} l{3} 3b l{$N_{b}$} Z \\ %
  \textcolor{black}{Sig3} & [black]
    Z H l{a1} l{2} h{3} 3V h{$N_{a}$} Z \\ %
  \textcolor{black}{Sig4} & [black]
    Z H h{1}  h{2} l{3} 3v l{$N_{b}$} Z \\ %
  % end timing diagram
  % there must NOT be an uncommented line before \extracode!
  % foreground:
    rectangle,inner sep=0pt,align=center,draw=none,fill=white%
  ] at (b) {%x
    \normalsize $\cdots$%
    rectangle,inner sep=0pt,align=center,draw=none,fill=white%
  ] at (v) {%x
    \tiny $\iint$%
  % background:

  • 1
    Looking an your code, you might benefit from the standalone class instead of using preview. It saves you some extra lines. Dec 6, 2011 at 10:05

1 Answer 1


You can use stacked material inside D by simply using \shortstack{$\mathbf0$\\a1}. There is no need to use TeX lower-level primitives for that.

Also the node character N also takes a content if used with { } and also options using [ ], i.e. N[<options>]{<content>}, so you can place text into the timing diagram directly, without extracode. By default nodes are set using the coordinate shape, you need to use the rectangle option to allow for a visible content.

I personally use dotted or dashed lines (something like ;[dashed] <chars>;) to draw discontinuities.

BTW, allowing text content for other characters as well is on my long-term TODO list.

Here a way you can implement such a diagram using dotted lines and direct node content. I'm moving the node position manually to get the correct vertical position.


\usetikztiminglibrary{nicetabs} % a bit strange with \Huge; use belowrulesep to adjust

\usepackage{type1cm} % to avoid "LaTeX Font Warning: Font shape `OML/cmm/m/it' in size <2> not available"; tlmgr install type1cm

    grayz/.style={timing/z/.append style={gray}},
    timing/metachar={{K}[2]{#1l !{++(0,+.5\yunit)} N[rectangle,scale=.3]{\shortstack{$\mathbf 0$\\(#2)}} !{++(0,-.5\yunit)} #1l}},
    timing/metachar={{J}[2]{#1h !{++(0,-.5\yunit)} N[rectangle,scale=.3]{\shortstack{$\mathbf 1$\\(#2)}} !{++(0,+.5\yunit)} #1h}},
  Sig1 & Z H K{a1} K{2} J{3} ;[gray] D;[dotted,gray] D;[gray] D; J{$N_a$} Z \\
  Sig2 & Z H J{1} J{1} K{3} ;[grayz] Z;[dotted,grayz] Z;[grayz] Z; K{$N_b$} Z \\
  % foreground:


  • Many thanks for the answer, @Martin Scharrer - and sorry it took forever to accept the answer (IRL took over)... Cheers!
    – sdaau
    Feb 3, 2012 at 7:11
  • Is there anyway to insert some text in D without having a transition? something like: Sig1 & Z H K{a1} K{2} J{3} ;[gray] D{text};[dotted,gray] D;[gray] D; J{$N_a$} Z that generate the above figure. In practice using D{text} causes an unwanted transition.
    – M.Reza
    Jun 15, 2014 at 18:05
  • @M.Reza: You can do this using the overlays library (\usetikztiminglibrary{overlays}): ...;[gray] O{D{text}}D;[dotted,gray] D;.... This overlays a D{text} with a open right end and a normal D. Jun 16, 2014 at 18:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .