tikz-timing 上的负振幅信号(返回零点)

tikz-timing 上的负振幅信号(返回零点)

我正在尝试使用 tikz-timing 进行 RZ,如下图所示。

RZ 示例

为此,我尝试使用高阻抗定时字符Z,就像在这个 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}

但它给出了这样的结果,

  • horline居中于Z
  • Z有蓝色

结果

根据文档,蓝色完全正常,因为这就是Z工作原理。所以我认为我应该改为使用L0 V。因此,有没有办法让 产生负振幅tikz-timing

答案1

一个简单但有点棘手的技巧是移动标签和水平线:

\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}

在此处输入图片描述

编辑:添加了改变z颜色的代码。

答案2

转移horline

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

设置所需级别的颜色。

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

在此处输入图片描述

\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}

相关内容