0

I am playing with Tikz matrices and would like to use the foreach statement to "expand a matrix". More precisely, I wonder if I can use a foreach statement such as:

\n in {Alice (the genious), Bob, Smith, Gordon}{ code }

together with the tikz matrix environment in order to achieve and end result that looks like

enter image description here

The manual code to achieve the above output is:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{matrix}

\begin{document}

\begin{tikzpicture}
\tikzstyle{every node}=[anchor=west]

\matrix[matrix of nodes]
{
    ID nr                   & Status    & Volume    \\
    1.2345                  & Blue      & 2.2       \\
    Creator                 & Last touch& Date      \\
    {Alice (the genious)}   & Jason     & 20190129  \\
    {Bob}                   &           &           \\
    {Smith}                 &           &           \\
    {Gordon}                &           &           \\
    {Theme:}                &           &           \\
    {Let's use tikz }       &           &           \\
};
\end{tikzpicture}
\end{document}

Thanks!

  • @tjoflong It is very vague/unclear on what you want to achieve per se. Could not grasp it from your question. Would you explain us better? – Raaja Jan 29 at 11:57
  • I have updated the question. Hopefully it is now clear what I want to do. – tjoflong Jan 29 at 14:23
  • Yes, you can create the rows with a \foreach loop, but it is not absolutely straightforward. See this answer and the many linked posts for how that works. I would like to argue that in this case it may not be worth the effort. – user121799 Jan 29 at 14:43
  • Thanks for the response — that looks like hard work! I managed to achieve the wanted result by a little cheating... I made a few tikz matrices and used "matrix anchor" to align them correctly. One of the matrices was made using a foreach statement as pointed out here. – tjoflong Jan 29 at 21:02

Your Answer

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

Browse other questions tagged or ask your own question.