[Tex/LaTex] Error: undefined control sequence

formattingmath-mode

I have a minor error in the below code, although it gets compiled without error, but it complains with:

Error: undefined control sequence

I want to get

child(V)={ u ∈ N(v) | d(root,u)=d(root,v)+1 }

as output

Here is the code:

\documentclass[runningheads,a4paper]{llncs}

\usepackage{amssymb}
\setcounter{tocdepth}{2}
\usepackage{graphicx}
\usepackage[latin1]{inputenc}
\usepackage[english]{babel}
\usepackage{url}

\usepackage{float}
\usepackage{booktabs}
\usepackage{multirow}% http://ctan.org/pkg/multirow
\usepackage{hhline}% http://ctan.org/pkg/hhline

\usepackage{mathtools}

\usepackage{amsmath}
\usepackage[english]{babel}
\usepackage{booktabs,array}

\setcounter{secnumdepth}{5}
\begin{document}

$$\child(V)=\{ u \in N(v) | d(root,u)=d(root,v)+1  \}$$


\end{document}

Best Answer

You should declare \child as a math operator, but also use \mathrm for root Never use math italic for words, it separates the letters to make it look like a product of variables. Also use \[ never $$ in LaTeX.

\documentclass[runningheads,a4paper]{article}

\usepackage{amssymb}
\setcounter{tocdepth}{2}
\usepackage{graphicx}
\usepackage[latin1]{inputenc}
\usepackage[english]{babel}
\usepackage{url}

\usepackage{float}
\usepackage{booktabs}
\usepackage{multirow}% http://ctan.org/pkg/multirow
\usepackage{hhline}% http://ctan.org/pkg/hhline

\usepackage{mathtools}

\usepackage{amsmath}
\usepackage[english]{babel}
\usepackage{booktabs,array}

\setcounter{secnumdepth}{5}
\DeclareMathOperator\child{child}
\begin{document}

\[
\child(V)=\{ u \in N(v) | d(\mathrm{root},u)=d(\mathrm{root},v)+1  \}
\]


\end{document}
Related Question