I am trying to automatically add a decision summary when writing meeting minutes. For each paragraph of the meeting I use a table to organize the paragraph number, name and content, and I use etoolbox and csdef to keep track of the decisions following this answer. I can not get this to work when using the \motion command within a table. Does anyone know why or how to solve this?
MWE:
\documentclass{article}
\usepackage{etoolbox}
\usepackage{float}
\newcommand{\enter}{\vskip 3mm}
\newcommand{\decision}[1]{\textbf{The board decided}\
\textit{to(1)} #1}
\newcommand{\approve}{approve the motion}
\newcommand{\wrapper}[3]{
\begin{table}[H]
{\renewcommand\arraystretch{1.25}
\begin{tabular}{p{0.5cm} p{4cm} p{10cm}}
#1 & \raggedright{#2} & \raggedright{#3}\
\end{tabular}
}
\end{table}
}
\makeatletter
\newcommand{@showMotion}[1]{%
\showMotion{#1}%
}
\newcommand{\showMotion}[1]{%
\csuse{name #1} motions to(1)\\textit{"\csuse{motion #1}"}\enter
\decision{\csuse{decision #1}}\enter
}%
\newcommand*{\summary}{% Initialize
}
\newcommand{\addToMotions}[1]{%
\g@addto@macro\summary{{#1}}%
}
\newcommand{\motion}[3]{%
\ifcsdef{name #1}{%
\PackageError{\jobname}{Multiple uses of the key: '#1'}{}%
}{%
\csdef{name #2}{#1}%
\csdef{motion #2}{#2}%
\csdef{decision #2}{#3}%
\addToMotions{{@showMotion{#2}}}%
}%
#1 motions to(1)\\textit{"#2"}\enter \decision{#3}\enter
}
\makeatother
\begin{document}
\motion{Test Testersson}{begin testing}{\approve}
\wrapper{§1}{Test}{\motion{Foo bar}{Lorem Ipsum}{\approve}}
\wrapper{§2}{Summary}{\summary{}}
Summary:\\
\summary{}
\end{document}
Which results in:


\globalbefore your\csdefs may be what you are looking for. – Steven B. Segletes Jun 03 '21 at 11:21