I'm trying to create a new environment with arguments that puts the content inside a multicol like this
\begin{tabular}{p{5em} p{\textwidth-3\columnsep -5em}}\\[-0.5em]
\toprule \addlinespace[1.4ex]
\textbf{NFR-1} & \textbf{Extensibility} \hfill \textbf{P1} \\ \addlinespace
\midrule[\heavyrulewidth] \addlinespace[1.4ex]
\multicolumn{2}{p{\textwidth-2\columnsep}}{Description text} \\ \addlinespace
\midrule \addlinespace
\end{tabular}\\[1em]
When i setup the new environment as in this MWE
\documentclass{article}
\usepackage{booktabs,calc}
\usepackage{hyperref}
\newenvironment{card}[4]{
\hypertarget{#1:#2}{}
\vspace{0.75ex}
\centering
\setlength{\defaultaddspace}{1.2ex}
\begin{tabular}{p{5em} p{\textwidth-3\columnsep -5em}}\\[-0.5em]
\toprule \addlinespace[1.4ex]
\textbf{#1-#2} & \textbf{#3} \hfill \textbf{#4} \\ \addlinespace
\midrule[\heavyrulewidth] \addlinespace[1.4ex]
\multicolumn{2}{p{\textwidth-2\columnsep}}
}{
\\ \addlinespace
\midrule \addlinespace
\end{tabular}\\ [1em]
}
\begin{document}
\begin{card}{NFR}{1}{Extensibility}{P1}
Description text.
\end{card}
\end{document}
I think it doesnt like the splitup of the multicolumn command.
I've already tried \bgroup
and \egroup
but that only produced errors.
What can be done in a situation like this?
calc
.