I have to generate a summary of impacts and actions in many enviromental reports. Sometimes there are two or more impacts in the analyses, so I have to create the lines manually in the table. Is there a smarter way to create this table, without define a lot of newcommands?
\documentclass{article}
\usepackage{etoolbox}
\usepackage{nameref}
\begin{document}
\section{Impacts on the Environment}
\subsection{Air quality}
\label{sec:air}
Analysis of air quality.
%conclusion
\newcommand{\ImpactAir}{Wood burning}
\newcommand{\CountermeasureAir}{Sleeve filter installation}
\textbf{Impact}: \ifstrempty{\ImpactAir}{Not applicable.}{\ImpactAir}
\textbf{Countermeasure}: \ifstrempty{\CountermeasureAir}{Not applicable.}{\CountermeasureAir}
\subsection{Water resources}
\label{sec:water}
Analysis of water resources.
%conclusion
\newcommand{\ImpactWater}{}
\newcommand{\CountermeasureWater}{}
\textbf{Impact}: \ifstrempty{\ImpactWater}{Not applicable.}{\ImpactWater}
\textbf{Countermeasure}: \ifstrempty{\CountermeasureWater}{Not applicable.}{\CountermeasureWater}
\subsection{Noise level}
\label{sec:noise}
Analysis of noise level.
%conclusion
\newcommand{\ImpactNoise}{High noise level}
\newcommand{\CountermeasureNoise}{Acoustic engine insulation}
\textbf{Impact}: \ifstrempty{\ImpactNoise}{Not applicable.}{\ImpactNoise}
\textbf{Countermeasure}: \ifstrempty{\CountermeasureNoise}{Not applicable.}{\CountermeasureNoise}\\
\section{Conclusion}
A succinct conclusion. See Table \ref{tab:sumary}.
\begin{table}[htb!]
\centering
\caption{Summary of impacts and countermeasures}
\label{tab:sumary}
\begin{tabular}{lll}
\hline
\textbf{Analyse} & \textbf{Impact} & \textbf{Countermeasure}\\
\hline
\nameref{sec:air} & \ifstrempty{\ImpactAir}{-}{\ImpactAir} & \ifstrempty{\CountermeasureAir}{-}{\CountermeasureAir}\\
\nameref{sec:water} & \ifstrempty{\ImpactWater}{-}{\ImpactWater} & \ifstrempty{\CountermeasureWater}{-}{\CountermeasureWater} \\
\nameref{sec:noise} & \ifstrempty{\ImpactNoise}{-}{\ImpactNoise} & \ifstrempty{\CountermeasureNoise}{-}{\CountermeasureNoise}\\
\hline
\end{tabular}
\end{table}
\end{document}
A little detail, the command \ifstrempty doesn't work like expected. How to expand it?


\ifstrempty: It works on a "string", so it doesn't expect the argument to be a control sequence and returns true because the argument is not empty (yet). Better use\ifdefemptyin this case. – Phelype Oleinik Oct 16 '19 at 20:42