# Question

Once I re-size the text of my timing labels, the midpoint of the label seems to shift as indicated by the arrows from the code/image below. It aligns to the bottom of the text instead of the middle. Is there a way to center the tikz-timing label vertically? Related question: LaTeX tikz-timing - adjust fontsize independently for each row label

\vspace does not seem like a good option

# Code

    \documentclass[border=4pt]{standalone}
\usepackage{tikz-timing}
\newcommand{\arr}[1]{#1 $\Longrightarrow$}
%
\begin{document}
\begin{tikztimingtable}
\arr                              & 4D{normal} \\
\arr{\tiny\color{red}}            & 4D{tiny} \\
\arr{\scriptsize\color{orange}}   & 4D{script} \\
\arr{\footnotesize\color{yellow}} & 4D{footnote} \\
\arr{\small\color{green}}         & 4D{small} \\
\arr{\normalsize\color{blue}}     & 4D{normal} \\
\arr{\large\color{purple}}        & 4D{large} \\
\extracode
\tablegrid
\end{tikztimingtable}
\end{document}


# Why would you want to move a label around?

When using tikz-timing along with PGF syntax you might get yourself into a tight-spot where you want to move around tikz-timing labels (which are by default anchored to the bottom of the bounding box).

In the example below, vertical lines, nodes, and line labels are automatically expanded using a \foreach loop all relatively referenced to make expanding the timing diagram easier. In addition, I am taking advantage of the tikz-timing macros inside of my "analog" waveforms as well; see analog_sig1 where I wanted to illustrate an unknown analog output.

I would want to move the "critical_point" label up a little so that I could align to the staggered t0...t15 line labels/nodes.

Problem Illustration

Below is an example waveform I put together with "debug" grids, markings, and vertical lines.

Solution

    {\tiny\color{blue}\raisebox{1mm}{critical\_point$\Longrightarrow$}} &


-
The label and the timing diagram are placed intensional on the same baseline. If you like to vertically center the text you need to raise it, either using TikZ settings or a macro like \raisebox or \adjustbox. –  Martin Scharrer Mar 26 '13 at 16:59
Thank you, this worked for me. The reason that I need to offset the text is because I am actually plotting mixed-signal waveforms. Part of my diagram is pure tikz-timing and the other part is an "analog" signal using PGF syntax. I will add a example waveform to illustrate why I needed to move my label around. –  Daniel King Mar 26 '13 at 23:17
@MartinScharrer I added some example diagrams to illustrate why I wanted to be able to move the label around. Appreciate your support. –  Daniel King Mar 27 '13 at 2:16

## 1 Answer

As you only want to change the label of one row I added a timing/name <row>/.try style to the timing/name style. The .try handler makes it possible to not having to define a timing/name <row> style for every possible <row>.

I have used these name <row> styles twice:

1. The timing/name 1 style sets up the label node so that the baseline is on the same height as the middle of the distance of a D slope.

The .6pt has been found empirical and covers the additional height introduced by the actual D lines.

1. The timing/name 2 style makes use of the append after command key to actually draw that arrow with TikZ.

## Code

\documentclass[border=4pt,convert={true,density=600}]{standalone}
\usepackage{tikz-timing}
\usetikzlibrary{arrows}
\newcommand{\arr}[1]{#1 $\Longrightarrow$}
\makeatletter
\tikzset{timing/name/.append style={timing/name \the\c@tikztiming@nrows/.try}}
\makeatother
\begin{document}
\begin{tikztimingtable}[
timing/name 1/.append style={
anchor=east,
yshift=\timingdslope cm/2+.6pt,
minimum height=\timingdslope cm,
},
timing/name 2/.append style={
anchor=east,
yshift=\timingdslope cm/2+.6pt,
minimum height=\timingdslope cm,
font=\tiny,
append after command={
\pgfextra
\pgfsetinnerlinewidth{.7pt}
\pgfsetbuttcap
\draw [line width=1.3pt,implies-] (\tikzlastnode.east) -- ++(-.25cm,0);
\endpgfextra
}
}
]
\arr                              & 4D{normal} \\
critical\_point\hspace{.3cm}       & 4D{normal} \\
\extracode
\tablegrid
\end{tikztimingtable}
\end{document}


-