[Tex/LaTex] Undefined Control Sequence for the 0-norm

amsmatherrorsmath-modeundefined

I'm new to latex and am using some stuff from a document my professor sent out.

I'm trying to define something in a paper I'm writing. Here is what I have:

\documentclass[11pt]{amsart}
\usepackage{amssymb,latexsym,amsmath,amsthm,enumitem,hyperref}
\usepackage{graphics,graphicx,multicol,tikz,pgfplots,tkz- 
euclide,relsize,framed}
\usetikzlibrary{calc}
\tikzset{fontscale/.style = {font=\relsize{#1}}}

\setlength{\topmargin}{-0.750in}
\setlength{\textheight}{9.5in}
\setlength{\textwidth}{6.5in}
\setlength{\oddsidemargin}{0in}
\setlength{\evensidemargin}{0in}
\allowdisplaybreaks
\renewcommand{\labelenumi}{(\alph{enumi})}
\renewcommand{\labelenumii}{\roman{enumii}.}
\setlength\arraycolsep{2pt}

\begin{document}

\section{Important Definitions and Theorems}

\subsection{Definition [Sparsity]}
The \emph{sparsity} of $x \in \mathbb{R}^n$ is defined by 
\begin{equation}
\norm{x}_{0} = card{k \in {1, 2, . . . , n} : x_k \neq 0}
\end{equation}

\end{document}

However, when I run this I get an Undefined Control Sequence error and I'm not sure what that means or how to fix it, hence I have come for your merciful help. Thanks!

Best Answer

The command \norm is not defined by default. A common way to define it is to use mathtools and \DeclarPairedDelimiter, so that \norm can be called

\norm{x}
\norm[\big]{x}
\norm[\Big]{x}
\norm[\bigg]{x}
\norm[\Bigg]{x}
\norm*{x}

where the calls with the optional argument manually set the size of the delimiter; the *-form uses automatically extensible delimiter (to be used sparingly).

\documentclass[11pt]{amsart}

% load here other needed packages
\usepackage{amssymb,mathtools}

% set up for the document
\setlength{\textheight}{9.5in}
\setlength{\textwidth}{6.5in}
\calclayout % <--- this is the proper way in amsart

% personal commands
\DeclarePairedDelimiter{\norm}{\lVert}{\rVert}
\DeclareMathOperator{\card}{card}

% theorem like environments
\newtheorem{theorem}{Theorem}[section]
\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}

\begin{document}

\section{Important Definitions and Theorems}

\begin{definition}[Sparsity]
The \emph{sparsity} of $x \in \mathbb{R}^n$ is defined by 
\begin{equation}
\norm{x}_{0} = \card\bigl\{k \in \{1, 2, \dots, n\} : x_k \neq 0\bigr\}
\end{equation}
\end{definition}

\end{document}

enter image description here

  • Instead of abusing \subsection I defined proper environments for theorems and definition (add the others you need).

  • I also defined an operator name for the cardinality.

  • The braces for delimiting the set definition should be \{ and \}.

  • Because of the nested sets, I used \big for the outer braces (it's optional).

  • ... should be \dots.

  • Instead of guessing at the appropriate values for the page parameters, just set the desired text height and width, then issue \calclayout (a command proper of amsart) to set the others.