在 tikz 时间图中,我想减小标签的字体大小。当我这样做时,它们不再与图表垂直居中。如何将标签垂直移动到中心?
MWE 如下:
\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\usepackage{tikz-timing}
\begin{document}
\begin{tikztimingtable}[%
timing/dslope=0.1,
timing/.style={x=5ex,y=2.2ex},
x=1ex,
timing/rowdist=3ex,
timing/name/.style={font=\rmfamily}]
\small Data & {[semitransparent]3u} 2D{0} 2D{1} 2D{1} 2D{0} {[semitransparent]2u}\\
\small Clock & {[semitransparent]3u} LHLHLHLH {[semitransparent]2u}\\ \\
\end{tikztimingtable}
\end{document}
我在文档中发现我可能可以使用anchor=mid east,但我不确定将它放在哪里。
感谢您的帮助!
答案1
稍微yshift
增加了一点timing/name
风格。另外,我也会把它移到\small
那里。
\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\usepackage{tikz-timing}
\begin{document}
\begin{tikztimingtable}[%
timing/dslope=0.1,
timing/.style={x=5ex,y=2.2ex},
x=1ex,
timing/rowdist=3ex,
timing/name/.style={font=\rmfamily\small,yshift=2pt}]
Data & {[semitransparent]3u} 2D{0} 2D{1} 2D{1} 2D{0} {[semitransparent]2u}\\
Clock & {[semitransparent]3u} LHLHLHLH {[semitransparent]2u}\\ \\
\end{tikztimingtable}
\end{document}
答案2
在这里,我将文本放在大小相等的\makebox
es 中。\small
可以在 的内部或外部\makebox
,但文本后会产生略有不同的间隙,具体取决于...
为什么 OP 的原始版本会如此表现,这可能是右对齐标签的情况。
\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\usepackage{tikz-timing}
\begin{document}
\begin{tikztimingtable}[%
timing/dslope=0.1,
timing/.style={x=5ex,y=2.2ex},
x=1ex,
timing/rowdist=3ex,
timing/name/.style={font=\rmfamily}]
\makebox[5ex]{\small Data} & {[semitransparent]3u} 2D{0} 2D{1} 2D{1} 2D{0} {[semitransparent]2u}\\
\makebox[5ex]{\small Clock} & {[semitransparent]3u} LHLHLHLH {[semitransparent]2u}\\ \\
\end{tikztimingtable}
\end{document}
上述 MWE 修复了两个单词的水平居中。为了修复垂直对齐,根据后续评论,可以将此结果与以下内容相结合\raisebox
:
\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\usepackage{tikz-timing}
\begin{document}
\begin{tikztimingtable}[%
timing/dslope=0.1,
timing/.style={x=5ex,y=2.2ex},
x=1ex,
timing/rowdist=3ex,
timing/name/.style={font=\rmfamily}]
\raisebox{1.5pt}{\makebox[5ex]{\small Data}} & {[semitransparent]3u} 2D{0} 2D{1} 2D{1} 2D{0} {[semitransparent]2u}\\
\raisebox{1.5pt}{\makebox[5ex]{\small Clock}} & {[semitransparent]3u} LHLHLHLH {[semitransparent]2u}\\ \\
\end{tikztimingtable}
\end{document}