如何更改刻度标签中的零

如何更改刻度标签中的零

平均能量损失

\documentclass[border=2pt]{standalone}
\usepackage{tikz}
\usepackage{tikz-timing}
\usetikztiminglibrary[dual arrows]{clockarrows}

\makeatletter
\newcommand*{\pmzerodot}{%
\nfss@text{%
\sbox0{$\vcenter{}$}% math axis
\sbox2{0}%
\sbox4{0\/}%
\ooalign{%
  0\cr
  \hidewidth
  \kern\dimexpr\wd4-\wd2\relax % compensate for slanted fonts
  \raise\dimexpr(\ht2-\dp2)/2-\ht0\relax\hbox{%
    \if b\expandafter\@car\f@series\@nil\relax
      \mathversion{bold}%
    \fi
    $\cdot\m@th$%
  }%
  \hidewidth
  \cr
  \vphantom{0}% correct depth of final symbol
}%
}%
}
\makeatother

\begin{document}
\begin{tikztimingtable}[scale=2,
timing/slope=0.1,
timing/rowdist=3ex,
]
\textnormal{\small Clock} &  [black] {h} 47{c} \\ 
\extracode
\begin{pgfonlayer}{background}
\node[anchor=east] at (row1.north west){\tiny +5V};
\node[anchor=east] at (row1.south west){\tiny \pmzerodot};
\vertlines[help lines,red]{0,1,3,5,7,9,11,13,15,17,19,21,23}

\draw [->,>=latex] (0,-\nrows) -- (\twidth+1,-\nrows);
\foreach \n in {0,1,...,\twidth}
\draw (\n,-\nrows+.1) -- +(0,-.2)
node [below,inner sep=2pt] {\scalebox{.75}{ \textit{t}{$_{\n}$}}};

\end{pgfonlayer}
\tablegrid
\end{tikztimingtable}
\end{document}

我想要输出,全部es 就像\pmzerodot。可能吗?我正在等待你的帮助。

在此处输入图片描述

答案1

一些模块化运算:

\documentclass[border=2pt]{standalone}
\usepackage{calc}
\usepackage{tikz}
\usepackage{tikz-timing}
\usetikztiminglibrary[dual arrows]{clockarrows}

\makeatletter
\newcommand*{\pmzerodot}{%
\nfss@text{%
\sbox0{$\vcenter{}$}% math axis
\sbox2{0}%
\sbox4{0\/}%
\ooalign{%
  0\cr
  \hidewidth
  \kern\dimexpr\wd4-\wd2\relax % compensate for slanted fonts
  \raise\dimexpr(\ht2-\dp2)/2-\ht0\relax\hbox{%
    \if b\expandafter\@car\f@series\@nil\relax
      \mathversion{bold}%
    \fi
    $\cdot\m@th$%
  }%
  \hidewidth
  \cr
  \vphantom{0}% correct depth of final symbol
}%
}%
}
\makeatother
\newcommand\ScaledZeroDot{%
  \resizebox{\widthof{$\scriptstyle0$}}{\heightof{$\scriptstyle0$}}{$\pmzerodot$}%
}

\begin{document}
\begin{tikztimingtable}[scale=2,
timing/slope=0.1,
timing/rowdist=3ex,
]
\textnormal{\small Clock} &  [black] {h} 47{c} \\ 
\extracode
\begin{pgfonlayer}{background}
\node[anchor=east] at (row1.north west){\tiny +5V};
\node[anchor=east] at (row1.south west){\tiny \pmzerodot};
\vertlines[help lines,red]{0,1,3,5,7,9,11,13,15,17,19,21,23}

\draw [->,>=latex] (0,-\nrows) -- (\twidth+1,-\nrows);
\foreach \n in {0,1,...,\twidth}
{
\pgfextra{
  \pgfmathsetmacro{\Modulo}{int(mod(\n,10))}%
  \ifnum\n=0\relax
      \gdef\MyNumber{\ScaledZeroDot}
  \else
    \ifnum\Modulo=0\relax
      \gdef\MyNumber{\pgfmathprint{int(div(\n,10))}\ScaledZeroDot}
    \else
      \gdef\MyNumber{\n}
    \fi  
  \fi
}
\draw 
  (\n,-\nrows+.1) -- 
  +(0,-.2)
  node[below,inner sep=2pt] 
  {\scalebox{.75}{ \textit{t}{$_{\MyNumber}$}}};
}
\end{pgfonlayer}
\tablegrid
\end{tikztimingtable}

\end{document}

结果:

在此处输入图片描述

放大的图像显示了其中一个“新”零:

在此处输入图片描述

相关内容