2

MWE

\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\usepackage{tikz-timing}
\usetikztiminglibrary{nicetabs}

\newcommand\gtikzset[1]{%
\begingroup%
\globaldefs=1\relax%
\pgfqkeys{/tikz}{#1}%
\endgroup}

\begin{document}
\begin{tikztimingtable}[
scale=2,
timing/rowdist=3ex,
]
\textnormal{}  &   @{\gtikzset{timing/rowdist=1}}\\
\textnormal{RS--232 Signal}  & @{\gtikzset{timing/rowdist=1}}\\
\textnormal{}  & @{\gtikzset{timing/rowdist=1}}\\
\textnormal{}  &  [y=4\yunit][line width=1pt] U L 2H 2L 5{2H} 2L 2L 2H 2{2L} L U \\
\extracode
\begin{pgfonlayer}{background}
%Left
\node[anchor=east] at (row1.north west){\scriptsize +15V};
\node[anchor=east] at (row3.west){\scriptsize --3V};
\node[anchor=east] at (row3.north west){\scriptsize 0V};
\node[anchor=east] at (row2.west){\scriptsize +3V};
\node[anchor=east] at (row4.south west){\scriptsize --15V};
%Right
\node[anchor=west] at (28,1){\scriptsize +15V};
\node[anchor=west] at (28,-0.5){\scriptsize +3V};
\node[anchor=west] at (28,-1){\scriptsize \phantom{+}0V};
\node[anchor=west] at (28,-1.5){\scriptsize --3V};
\node[anchor=west] at (28,-3){\scriptsize --15V};
%Horivontal
\shade[right color=red!60,left color=red!60](28,-0.5) rectangle(0,-1.5);
\shade[right color=green!60,left color=green!60](28,1) rectangle(0,-0.5);
\shade[right color=green!60,left color=green!60](28,-1.5) rectangle(0,-3);
%Vertical
\shade[right color=yellow!60,left color=yellow!60](2,-3) rectangle(1,1);
\shade[right color=yellow!60,left color=yellow!60](26,-3) rectangle(27,1);
\end{pgfonlayer}
\tablegrid
\end{tikztimingtable}
\end{document}

And output, enter image description here.

My problem is (like-3V) all in right voltages definitions flusright. How can I do?

2

Try choosing the same anchor as the left group, then add an x-shift to compensate for this. Note that the unit of length for the shift should be chosen relative to the font size (em, ex, ...) and not fixed units (pt, in, mm, cm, ...).

\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\usepackage{tikz-timing}
\usetikztiminglibrary{nicetabs}

\newcommand\gtikzset[1]{%
\begingroup%
\globaldefs=1\relax%
\pgfqkeys{/tikz}{#1}%
\endgroup}

\begin{document}
\begin{tikztimingtable}[
scale=2,
timing/rowdist=3ex,
]
\textnormal{}  &   @{\gtikzset{timing/rowdist=1}}\\
\textnormal{RS--232 Signal}  & @{\gtikzset{timing/rowdist=1}}\\
\textnormal{}  & @{\gtikzset{timing/rowdist=1}}\\
\textnormal{}  &  [y=4\yunit][line width=1pt] U L 2H 2L 5{2H} 2L 2L 2H 2{2L} L U \\
\extracode
\begin{pgfonlayer}{background}
%Left
\node[anchor=east] at (row1.north west){\scriptsize +15V};
\node[anchor=east] at (row3.west){\scriptsize --3V};
\node[anchor=east] at (row3.north west){\scriptsize 0V};
\node[anchor=east] at (row2.west){\scriptsize +3V};
\node[anchor=east] at (row4.south west){\scriptsize --15V};
%Right
\node[anchor=east,xshift=6ex] at (28,1){\scriptsize +15V};
\node[anchor=east,xshift=6ex] at (28,-0.5){\scriptsize +3V};
\node[anchor=east,xshift=6ex] at (28,-1){\scriptsize \phantom{+}0V};
\node[anchor=east,xshift=6ex] at (28,-1.5){\scriptsize --3V};
\node[anchor=east,xshift=6ex] at (28,-3){\scriptsize --15V};
%Horivontal
\shade[right color=red!60,left color=red!60](28,-0.5) rectangle(0,-1.5);
\shade[right color=green!60,left color=green!60](28,1) rectangle(0,-0.5);
\shade[right color=green!60,left color=green!60](28,-1.5) rectangle(0,-3);
%Vertical
\shade[right color=yellow!60,left color=yellow!60](2,-3) rectangle(1,1);
\shade[right color=yellow!60,left color=yellow!60](26,-3) rectangle(27,1);
\end{pgfonlayer}
\tablegrid
\end{tikztimingtable}
\end{document}

enter image description here

Another option is to leave anchor=west as it is and specify a text width wide enough for all labels and aligned to the right as this:

\node[anchor=west,text width=5ex,align=right] at (28,1){\scriptsize +15V};
\node[anchor=west,text width=5ex,align=right] at (28,-0.5){\scriptsize +3V};
\node[anchor=west,text width=5ex,align=right] at (28,-1){\scriptsize \phantom{+}0V};
\node[anchor=west,text width=5ex,align=right] at (28,-1.5){\scriptsize --3V};
\node[anchor=west,text width=5ex,align=right] at (28,-3){\scriptsize --15V};
  • Perfect, it is working. @AboAmmar. – Özgür Jul 14 '15 at 9:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.