Tikz 定时错误

Tikz 定时错误

我正在尝试构建 tikz-timing以下代码示例,但出现错误:

Package pgfkeys Error: I do not know the key '/tikz/timing/counter/new'

帮我解决这个问题。谢谢!

    \begin{tikztimingtable}[timing/d/background/.style={fill=white},
 timing/lslope=0.2, 
 timing/counter/new={char=Q,reset char=R},
 ]
    CPOL =0 & LL 15{ T} LL \\
    CPOL =1 & HH 15{ T} HH \\
            & H 17L H \\
    \\
    Cycle \# & U R 8{2 Q} 2U \\
    MISO & D{z} R 8{2 Q} 2D{z} \\
    MOSI & D{z} R 8{2 Q} 2D{z} \\
    \\
    Cycle \# & UU R 8{2 Q} U \\
    MISO & D{z}U R 8{2 Q} D{z} \\
    MOSI & D{z}U R 8{2 Q} D{z} \\
\extracode
 % Add vertical lines in two colors
 \begin{pgfonlayer}{background}
    \begin{scope}[semitransparent,semithick]
        \vertlines[red]{2.1 ,4.1 ,... ,17.1}
        \vertlines[blue]{3.1 ,5.1 ,... ,17.1}
    \end{scope}
 \end{pgfonlayer}
 % Add big group labels
 \begin{scope}[font =\sffamily \Large ,shift={(-6em,-0.5)},anchor=east]
    \node at (0,0){SCK};
    \node at (0,-3){SS};
    \node at (1ex,-9){CPHA=0}; 
    \node at (1ex,-17){CPHA =1};
 \end{scope}
\end{tikztimingtable}%

答案1

拖延了一段时间,用了搜索引擎,我终于找到了例子tikz-timing,它帮助我解决了您的问题。

\documentclass[convert]{standalone}

\usepackage{tikz-timing}
\usetikztiminglibrary[new={char=Q,reset char=R}]{counters}

\begin{document}

\begin{tikztimingtable}
    CPOL =0 & LL 15{ T} LL \\
    CPOL =1 & HH 15{ T} HH \\
            & H 17L H \\
    \\
    Cycle \# & U R 8{2 Q} 2U \\
    MISO & D{z} R 8{2 Q} 2D{z} \\
    MOSI & D{z} R 8{2 Q} 2D{z} \\
    \\
    Cycle \# & UU R 8{2 Q} U \\
    MISO & D{z}U R 8{2 Q} D{z} \\
    MOSI & D{z}U R 8{2 Q} D{z} \\
\end{tikztimingtable}

\end{document}

截屏

实际上,在我看来,您只是没有正确地复制粘贴上述链接中的示例。您上面的示例有\vertlines[red]{2.1 ,4.1 ,... ,17.1},而从上述链接复制的行是\vertlines[red]{2.1,4.1,...,17.1}(注意你的添加空格)。

如果我纠正错误的空格,您的代码就可以正常工作,如下所示。

\documentclass[convert]{standalone}

\usepackage{tikz-timing}
\usetikztiminglibrary[new={char=Q,reset char=R}]{counters}

\begin{document}

\begin{tikztimingtable}
    CPOL =0 & LL 15{ T} LL \\
    CPOL =1 & HH 15{ T} HH \\
            & H 17L H \\
    \\
    Cycle \# & U R 8{2 Q} 2U \\
    MISO & D{z} R 8{2 Q} 2D{z} \\
    MOSI & D{z} R 8{2 Q} 2D{z} \\
    \\
    Cycle \# & UU R 8{2 Q} U \\
    MISO & D{z}U R 8{2 Q} D{z} \\
    MOSI & D{z}U R 8{2 Q} D{z} \\
    \extracode
    % Add vertical lines in two colors
    \begin{pgfonlayer}{background}
        \begin{scope}[semitransparent,semithick]
            \vertlines[red]{2.1,4.1,...,17.1}
            \vertlines[blue]{3.1,5.1,...,17.1}
        \end{scope}
    \end{pgfonlayer}
    % Add big group labels
    \begin{scope}[font =\sffamily \Large ,shift={(-6em,-0.5)},anchor=east]
        \node at (0,0){SCK};
        \node at (0,-3){SS};
        \node at (1ex,-9){CPHA=0}; 
        \node at (1ex,-17){CPHA =1};
        \end{scope}
\end{tikztimingtable}

\end{document}

第二张截图

相关内容