11

I am using tikzpicture environment, together with \matrix command to draw a diagram. I have two questions:

  1. Can I use different arrow line styles in the same matrix? For instance, the matrix called m, let's say, I want dashed arrow from m-1-2 to m-1-4 and solid arrow from m-3-1 to m-3-3, also I want a solid arrow from m-3-1 to m-1-2.

  2. Can I use different row sizes in one matrix?

  • 2
    Hi mara, Welcome to TeX.sx. I removed the thanks and added some gloss to the question (click on edit to see what I did). Thanks is best expressed in the up voting of answers that help you. In addition, please provide us with a minimal working example so that we can copy, paste, and play with your existing code. – qubyte Mar 5 '12 at 6:31
21

Yes, and yes!

\input tikz
\usetikzlibrary{matrix}
\tikzpicture
  [mymatrix/.style={
    matrix of nodes,
    column sep=2cm,
    row 3/.style={minimum height=3cm}}
  ]
  \matrix[mymatrix] (m) {
    foo & bar & baz \\
    baz & foo & bar \\
    bar & baz & foo \\
  };
  \draw[dashed,->] (m-1-2) -- (m-1-3);
  \draw[->] (m-3-1) -- (m-3-3);
\endtikzpicture
\bye

enter image description here

  • Thank you Morbusg, I have read the answer and it is clear. I could understand that the height between the first and the second rows is the default one. Then, you defined the desired height between row 2 and 3 as minimum height=3cm. Am I right? As for the arrow styles, I need a dashed arrow instead of a dashed line from (m-1-2) -- (m-1-3). Please advice. – Mara Mar 5 '12 at 23:25
  • Plz do not trouble yourself to answer my previous question, I kept trying after I post my question, based on your answer, I found the solution, and I solved my current problem. Thank you. – Mara Mar 5 '12 at 23:51
  • @Mara: I'm sorry: I hadn't read properly the question. I added the arrow to the dashed line. If this answer helped solve the problem, please consider pressing the “Accept answer”-button :-) – morbusg Mar 6 '12 at 6:13
  • @Mara: If you want to define a different row distance for a particular row, you could also use, for example, \\[2cm] at the end of the row (just like in LaTeX). – morbusg Mar 6 '12 at 11:26

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.