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:
- I want to be able to display a multi-line (two line) text label inside the
LandHlogic 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}) - I want to be able to show a discontinuity in the time axis; the example shows the following variants:
- Based on
Dcharacter (with Low and High parallel lines; capital letter nameBorV) or based onZcharacter (line in middle; lowercase letter nameborv) - Uses ellipsis (
..., that is,\cdots;Borb) or uses "a curvy widget" (here$\iint$) as separator characters (Vorvmetacharacter 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)
- (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,
- Based on
... and here is an overview of the problems:
- Only
Dcan accept text characters/labels 'inside' itself - this is, however, not really a problem, because in the metacharacter macro, I can first draw aDwith 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 anLorHsymbol... but, then:Dcannot accept paragraphed content (with linebreaks) - so I have to "cheat" with TeX primitives (\raise/\lower\hboxand\kern) to simulate two lines; as a result these text lines inside are not center-aligned
- I have to apply the same TeX primitive (
\raise/\lower\hboxand\kern) approach, to be able to align the "time-discontinuity" symbol to the Low and High lines of theD-derived logic symbols (BandV); 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)- I cannot visually "interrupt" the
Dlines (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
- For the
Zderived 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\extracodesection - 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
\colorboxcase, 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
- I cannot visually "interrupt" the
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,
Cheers!
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
\documentclass{minimal}
% minimal doesn't have \scriptsize, \tiny:
% see also http://wiki.lyx.org/FAQ/ChangeFontUsingLatex ;
% copied from IEEEtran.cls (for 12 pt doc)
\makeatletter
\def\ttiny{\@setfontsize{\ttiny}{4}{5pt}}
%
\def\tiny{\@setfontsize{\tiny}{6}{7pt}}
\def\scriptsize{\@setfontsize{\scriptsize}{8}{9pt}}
\def\footnotesize{\@setfontsize{\footnotesize}{9}{10.5pt}}
\def\small{\@setfontsize{\small}{10}{12pt}}
%
\def\normalsize{\@setfontsize{\normalsize}{12}{13.92pt}}%
%
\def\large{\@setfontsize{\large}{14}{17pt}}
\def\Large{\@setfontsize{\Large}{17}{20pt}}
\def\LARGE{\@setfontsize{\LARGE}{20}{24pt}}
\def\huge{\@setfontsize{\huge}{22}{26pt}}
\def\Huge{\@setfontsize{\Huge}{24}{28pt}}
% \let\tthtext\tikztiming@handletext % ! Undefined control sequence.
% \def\tthtext{\tikztiming@handletext} % ! Improper alphabetic constant.
\makeatother
\usepackage{tikz}
% \usetikzlibrary{arrows,chains,matrix,positioning,scopes,snakes,decorations.markings} % Package tikz Warning: Snakes have been superseded by decorations.
\usetikzlibrary{arrows,chains,matrix,positioning,scopes,decorations}
\usepackage{tikz-timing}
\usetikztiminglibrary[rising arrows]{clockarrows}
\usetikztiminglibrary{advnodes}
\usetikztiminglibrary{overlays}
\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):
\let\mainsize\Large
\makeatletter
{\mainsize\global\let\myfontsize\f@size}
\makeatother
\newlength{\myfontsizelen}
\setlength{\myfontsizelen}{\myfontsize pt}
\setlength{\belowrulesep}{0.4\myfontsizelen} % ok, but not with ex/em anymore?
\usepackage{amsmath}
\usepackage[graphics,tightpage,active]{preview}
\PreviewEnvironment{tikzpicture}
\newlength{\imagewidth}
\newlength{\imagescale}
\usepackage{type1cm} % to avoid "LaTeX Font Warning: Font shape `OML/cmm/m/it' in size <2> not available"; tlmgr install type1cm
\usepackage{helvet}
\begin{document}
% 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!
\begin{tikztimingtable}[%
timing/nodes/advanced,
timing/dslope=0.1,
timing/name/.style={font=\sffamily\scriptsize},
timing/d/text/.style={font=\sffamily\ttiny},
]
%
% 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!
%
\extracode
% foreground:
\tablerules
\tablegrid
\node[%
rectangle,inner sep=0pt,align=center,draw=none,fill=white%
] at (b) {%x
\normalsize $\cdots$%
};
\node[%
rectangle,inner sep=0pt,align=center,draw=none,fill=white%
] at (v) {%x
\tiny $\iint$%
};
% background:
\begin{pgfonlayer}{background}
\end{pgfonlayer}
\end{tikztimingtable}
\end{document}

standaloneclass instead of usingpreview. It saves you some extra lines. – Martin Scharrer Dec 06 '11 at 10:05