I created two custom environment and a custom command to easily display an overview of modules and classes they contain in tabular format. However, I end up with unwanted indentation for the the first class name in each module. How can I remove this indentation?
Example:
\documentclass[12pt]{article}
\usepackage{multirow}
\usepackage{etoolbox}
% PREAMBLE
%
% ===================== %
% Module overview table %
% ===================== %
\newenvironment{moduleoverview}{%
\begin{tabular}{|c|c|}
\hline
\textbf{Module} &
\textbf{Class}
\\ \hline
}
{%
\end{tabular}
}
\newtoggle{firstmtclass}
\newenvironment{momodule}[2]{%
% First argument: module name
% Second argument: number of classes in module
\multirow{#2}{*}{%
#1
}
&
\toggletrue{firstmtclass}
}
{%
\hline
}
\newcommand{\moclass}[1]{%
% First argument: class name
\iftoggle{firstmtclass}{%
\togglefalse{firstmtclass}
}{%
&
}
#1
\\
}
\begin{document}
\begin{moduleoverview}
\momodule{Module name A}{2}
\moclass{class name 1}
\moclass{class name 2}
\endmomodule
\momodule{Module name B}{3}
\moclass{class name 3}
\moclass{class name 4}
\moclass{class name 5}
\endmomodule
\end{moduleoverview}
\end{document}
Produces: