2

I'm trying to do RZ with tikz-timing, like in the following picture.

RZ example

For that I tried using the high impedance timing character Z, like in this MWE :

\documentclass{article}

\usepackage{tikz-timing}

\begin{document}

\begin{center}
    \begin{tikztimingtable}[timing/slope=0, scale=2]
        Horloge      & 8{hl} \\
        01001110     & LHLLHHHL \\
        NRZ          & LHLLHHHL \\
        RZ           & 0.25Z lzh 2{zl} 3{zh} zl 0.25Z \\
      \extracode
        \makeatletter
        \begin{pgfonlayer}{background}
          \vertlines[help lines, blue]{}
          \horlines[blue]{}
          \foreach [count=\x] \b in {0,1,0,0,1,1,1,0} {
            \node [below,font=\sffamily\bfseries\tiny,inner ysep=2pt] at (\x-.5,-1.5) {\b};
          }
        \end{pgfonlayer}
      \end{tikztimingtable}
\end{center}

\end{document}

But it gives this result, where

  • The horline is not centered at Z
  • Z has a blue color

Result

According to the documentation, the blue color is perfectly normal, as that's how Z works. So I think that I should instead use L as 0 V. Therefore, is there a way to have a negative amplitude with tikz-timing ?

2

A simple, though somewhat nasty, trick would be to shift the labels and the horizontal lines:

\documentclass{standalone}

\usepackage{tikz-timing}

\begin{document}

\begin{tikztimingtable}[timing/slope=0, scale=2, timing/draw grid, timing/name/.append style={yshift=3.5}, timing/z/.style={black}]
    Horloge      & 8{hl} \\
    01001110     & LHLLHHHL \\
    NRZ          & LHLLHHHL \\
    RZ           & 0.25Z lzh 2{zl} 3{zh} zl 0.25Z \\
    \extracode
    \makeatletter
    \begin{pgfonlayer}{background}
        \vertlines[help lines, blue]{}
        \horlines[blue, yshift=3.5]{}
        \foreach [count=\x] \b in {0,1,0,0,1,1,1,0} {
            \node [below,font=\sffamily\bfseries\tiny,inner ysep=2pt] at (\x-.5,-1.5) {\b};
        }
    \end{pgfonlayer}
\end{tikztimingtable}

\end{document}

enter image description here

Edit: Added code to change z color.

  • Found a way to change the color of Z. I will add it to your solution and will accept it, as it is the one that is nearest to what I was searching for. Thanks. – D. LaRocque Oct 19 at 1:22
  • 1
    Great. I just re-uploaded a new picture that fits your edit. – Jasper Habicht Oct 19 at 8:17
2

Shift horline.

\horlines[blue,yshift=1.25mm]{}

Set colors for required levels.

\tikzset{
timing/z/.style={color=red},
timing/l/.style={color=red},
timing/h/.style={color=red}
}

enter image description here

\documentclass{article}
\usepackage{tikz-timing}
\tikzset{
timing/z/.style={color=red},
timing/l/.style={color=red},
timing/h/.style={color=red},
timing/slope=0,
timing/name/.append style={yshift=1.25mm}
}

\begin{document}
\begin{center}
    \begin{tikztimingtable}[scale=2]
        Horloge      & 8{hl} \\
        01001110     & LHLLHHHL \\
        NRZ          & LHLLHHHL \\
        RZ           & 0.25Z lzh 2{zl} 3{zh} zl 0.25Z \\
      \extracode
        \makeatletter
        \begin{pgfonlayer}{background}
          \vertlines[help lines, blue]{}
          \horlines[blue,yshift=1.25mm]{}
          \foreach [count=\x] \b in {0,1,0,0,1,1,1,0} {
            \node [below,font=\sffamily\bfseries\tiny,inner ysep=2pt] at (\x-.5,-1.5) {\b};
          }
        \end{pgfonlayer}
      \end{tikztimingtable}
\end{center}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.