Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Why 360 is not vertically aligned with Angle ?

I changed text width but it's not better ...

enter image description here

\documentclass[tikz,margin=3pt]{standalone}

\pgfkeys{/tikz/.cd,
    BLS/.store in=\BLS,
    BLS=1.1*\baselineskip
    }

    \tikzset{%
        TDPnode/.style={outer sep=0pt,inner sep=1pt,
                        minimum height=\BLS,draw,text depth=1.5pt},
        TDPetq/.style={TDPnode,anchor=north east,
            minimum width=3em + 10pt,fill=gray!40},
        TDPcas/.style={TDPnode,anchor=west,minimum width=3em},
        TDPfle/.style={>=stealth,semithick}
    }

\begin{document}
\begin{tikzpicture}
    \node[TDPetq] (B0) at (0,0) {Angle ()} ;
    \node[TDPcas,anchor=west] (B1) at (B0.east) {360} ;

\end{tikzpicture}
\end{document}
share|improve this question
1  
You also need some text height in TDPnode. –  Ignasi Apr 29 at 7:37
2  
As an alternative to Ignasi's answer, add a \strut to the the '360' node; this will insert a zero-width box to make it the same height as the parentheses. –  ChrisS Apr 29 at 7:39
    
@Ignasi write anwser ;-) thanks. –  Tarass Apr 29 at 9:01
    
@ChrisS Good idea. write answer, thanks. –  Tarass Apr 29 at 9:04

1 Answer 1

up vote 1 down vote accepted

If you want all nodes aligned by their baseline, all of them need to have same text depth and text height.

\documentclass[tikz,margin=3pt]{standalone}

\pgfkeys{/tikz/.cd,
    BLS/.store in=\BLS,
    BLS=1.1*\baselineskip
    }

    \tikzset{%
        TDPnode/.style={outer sep=0pt,inner sep=1pt,
                        minimum height=\BLS,draw, text depth=2pt, text height=8pt},
        TDPetq/.style={TDPnode,anchor=north east,
            minimum width=3em + 10pt,fill=gray!40},
        TDPcas/.style={TDPnode,anchor=west,minimum width=3em},
        TDPfle/.style={>=stealth,semithick}
    }

\begin{document}
\begin{tikzpicture}
    \node[TDPetq] (B0) at (0,0) {Angle ()} ;
    \node[TDPcas,anchor=west] (B1) at (B0.east) {360} ;

    \draw[red] (B0.base)--(B1.base);
    \draw[blue] (B0.base-|B0.west)--(B0.base-|B1.east);
\end{tikzpicture}
\end{document}

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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