I'm trying to use the tikz package's foreach
command in a tabular environment. I know that it is not really suited for doing this, but how would I be able to make the following command work (I think, it is obvious what it should do, and I know that there are some difficulties regarding the textbf
command as well):
\newcommand{\myTable}[1]{
\begin{tabular}{p{0.35\textwidth}|p{0.65\textwidth}}
\hline
Headline 1 & Headline 2 \\
\foreach \lhs/\rhs in {#1} {
\textbf{\lhs} & \rhs \\
}
\hline
\end{tabular}
}
MWE:
\documentclass{article}
\usepackage{tikz}
\newcommand{\myTable}[1]{
\begin{tabular}{p{0.35\textwidth}|p{0.65\textwidth}}
\hline
Headline 1 & Headline 2 \\
\foreach \lhs/\rhs in {#1} {
\textbf{\lhs} & \rhs \\
}
\hline
\end{tabular}
}
\begin{document}
\myTable{{Title 1}/{Description 1}, {Title 2}/{Description 2}}
\end{document}