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.

I am using a TikZ matrix to make a diagram where the entries in a row vary considerably in size:

\documentclass{article}

\usepackage{tikz,amsmath}
\usetikzlibrary{matrix}

\begin{document}

\newcommand{\RandomDots}{%
    \begin{tikzpicture}
        \foreach \x in {0.1, 0.3,...,1}
            \foreach \y in {0.1, 0.3,...,1}
            {
                \pgfmathrandominteger{\r}{1}{5}
                \fill (\x,\y) circle [radius=\r/5 pt];
            }
    \end{tikzpicture}
}

\begin{tikzpicture}[%
    feature box/.style = {rectangle, draw, anchor=center},
    ]

    \matrix [
        matrix of math nodes,
        column sep = 1cm,
        row sep = 0.1cm
    ]
    {
        |(a)| a & \node [feature box] (f1) {\RandomDots}; \\
        |(b)| b & \node [feature box] (f2) {\RandomDots}; \\
    };

    \draw [->] (a) -- (f1);
    \draw [->] (b) -- (f2);
\end{tikzpicture}
\end{document}

The resulting image looks like this:

enter image description here

However, I would like the connections to be horizontal/the box from \RandomDots to be vertically aligned with the letters in the first column.

Does anyone know of a way to do this?

share|improve this question
1  
Adding nodes={anchor=east} (or west) to your matrix can help in this specific case. –  percusse Jun 6 '12 at 14:04

1 Answer 1

up vote 4 down vote accepted

try

\draw [->] (a) -- (f1.west|-a);

\draw [->] (b) -- (f2.west|-b);
share|improve this answer
    
Thanks a lot! I didn't realize that connection from Karl's example :-) –  Robert Jun 6 '12 at 22:06

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.