1

The following will work fine:

\documentclass{article}
\usepackage{longtable}
\begin{document}

\begin{longtable}{p{2cm}|p{3cm}|p{3cm}}
    \caption{Blabla}
    \\
    5,8 &5,3 &3,4 \\
    8,8 &85,3 &1,4 \\

\end{longtable}
\end{document}

However, I want to put the contents of the table in a variable, and as far as I experienced this will not work out of the box:

\documentclass{article}
\usepackage{longtable}
\begin{document}

\newcommand{\tablerows}{
    5,8 &5,3 &3,4 \\
    8,8 &85,3 &1,4 \\
}

\begin{longtable}{p{2cm}|p{3cm}|p{3cm}}
    \caption{Blabla}
    \\
    \tablerows
    8,8 &85,3 &1,4 \\
\end{longtable}
\end{document}

It says "Misplaced alignment tab character &. \tablerows" What am I doing wrong? And if there is a solution - what is the limitation, how many characters / lines can be put in a variable before it get's too big?

konsens
  • 47

0 Answers0