[Tex/LaTex] mathclap: undefined control sequence

alignerrorsmath-mode

In my preamble I have loaded the amsmath and geometry package and many others that I read are useful when using \mathclap. This is my preamble

\documentclass[a4paper,oneside,abstracton]{scrartcl}


\usepackage[utf8]{inputenc}
%\usepackage[latin1]{inputenc}               %Zeichencodierung Text
\usepackage[T1]{fontenc}                     %Schriftsatz Dokument


%%Language settings
\usepackage[english]{babel}                  %ngerman for German
\usepackage{csquotes}                        %[babel,quotes=english]
\usepackage{caption}
\addto\captionsenglish{\renewcommand{\contentsname}{Table of Contents}}
%\renewcommand{\contentsname}{Table of Contents}   % only works when not using babel


%%Math, astro, chemical packages and options
\usepackage{amsmath,amssymb,amsthm,amsfonts,amsbsy,latexsym}
\usepackage{wasysym}                        %astronomical symbols
%\usepackage[version=3]{mhchem}             %Chemie-Package
\providecommand{\e}[1]{\ensuremath{\times 10^{#1}}}

%\usepackage{dsfont}
%\usepackage{enumerate,url}


%%Paper adjustments
\usepackage{graphicx}
\usepackage{epstopdf}                        %if problems with importing .eps graphics
%\usepackage{a4wide}                         %obsolete and replaced by geometry
\usepackage[a4paper,bottom=3.1cm]{geometry}  %also with command \geometry{options}
\usepackage{changepage}
\usepackage{titling}
\usepackage{booktabs}
\usepackage{lscape}
\usepackage{multirow}
\usepackage{threeparttable}
%\usepackage{subfigure}                      %obsolete
\usepackage{subcaption}                      %cannot be used with subfigure
%\usepackage{subfig}
%\addto\captionsngerman{\renewcommand{\figurename}{Fig.}}
\usepackage{afterpage}
\usepackage{textcomp, gensymb}               %textcomp before gensymb gets rid of the warnings "not defining \micro and \perthousand
\usepackage{soul}                            %for customised working with the text 
\usepackage{array}
\setcounter{secnumdepth}{4}                  %sets the section number depth
\setcounter{tocdepth}{4}                     %sets the ToC depth
%\usepackage{verbatim}                       %for multiline comments using\begin or \end
\usepackage{xcolor}                          %colour e.g. parts of equations

%% Control the fonts and formatting used in the table of contents.
%\usepackage[titles]{tocloft}

%% Aesthetic spacing redefined
%\setlength{\cftbeforechapskip}{}
%\setlength{\cftbeforesecskip}{0.5ex}
\setlength{\parindent}{0pt}                  %kein Einrücken von neuen Abschnitten
\usepackage{afterpage}                       %to avoid space before landscape-environment

I still get errors for

\begin{equation*}
\begin{aligned}
...&\stackrel{\mathclap}{\rightarrow}
\end{aligned}
\end{equation*}

First I had only "align" instead of "aligned". Those undefined control sequences vanished, but are replaced by undefined control sequences for this \mathclap (which was already before a non recognised command…I'm wondering why). Unfortunately, my document has too many errors to be displayed with the recent necessary changes that were necessary.

Best Answer

The macro \mathclap is defined in package mathtools:

\usepackage{mathtools}

The macro takes an optional argument for the math style and a mandatory argument for the math stuff, which is put in a zero-width box and centered there. Therefore,

\stackrel{\mathclap}{\rightarrow}

does not make sense, since the mandatory argument for \mathclap is missing.