我正在尝试使用 tikz-timing 进行 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
工作原理。所以我认为我应该改为使用L
0 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}