If we detect a document class which supports the distinction, set the
table of contents as frontmatter and the index as backmatter.
%</mdwtools>
% \end{meta-comment}
%
%</mdwtools>
% \end{meta-comment}
%
%% \CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%% \CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
\def\do##1##2{\addtocontents{##1}{\protect\end{multicols}}}%
\docontents%
\fi%
\def\do##1##2{\addtocontents{##1}{\protect\end{multicols}}}%
\docontents%
\fi%
+ \ifx\backmatter\@@undefined\else\backmatter\fi%
\PrintIndex%
}
% \end{macrocode}
\PrintIndex%
}
% \end{macrocode}
%
% \begin{macrocode}
\begin{document}
%
% \begin{macrocode}
\begin{document}
+ \ifx\frontmatter\@@undefined\else\frontmatter\fi%
\maketitle%
% \end{macrocode}
%
\maketitle%
% \end{macrocode}
%
% Input the main file now.
%
% \begin{macrocode}
% Input the main file now.
%
% \begin{macrocode}
+ \ifx\mainmatter\@@undefined\else\mainmatter\fi%
\DocInput{\@basefile}%
% \end{macrocode}
%
\DocInput{\@basefile}%
% \end{macrocode}
%