3

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!

  • The undefined control sequence is \norm. Do you have any preference for how the norm of something should be denoted? – Mico May 4 at 18:48
  • 1
    Off-topic: Since you're loading the amssymb package, there can be no excuse or justification for loading latexsym as well. Similarly, since you're loading the graphicx package, nothing but a high tolerance for code clutter can justify loading graphics as well. – Mico May 4 at 18:49
  • If the template you're using comes straight from your professor, you may want to suggest to him/her that de-crufting the template that's being inflicted on the students should be made a very high priority. – Mico May 4 at 18:52
  • Okay. Thank you. The only preference I have for how the norm of something is denoted is how it should normally look--something inside what looks like two absolute value bars with a subscript denoting the type of norm. Okay. I'll keep that in mind. What I am working on is literally the second document I've ever written in LaTex. To prevent confusion and to just get us started, my professor gave us all that intro stuff with the packages. I'll let him know. – Matthew Graham May 4 at 19:02
2

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.

  • Weird that norm is not already defined in the package. Maybe it isn't weird, but mathematicians (especially analysts) use them all the time. Thanks for all the help though. I really appreciate it! – Matthew Graham May 4 at 20:50
1

Adding this definition, based on \mathtools (an extension of amsmath) works fine. I defined a \znorm command which stretches to the size of its argument in its starred version. Alternatively, you can fine-tune the size of the norm symbols using an optional argument one of \big, \Big, \bigg, \Bigg.

Unrelated: you don't have yo load graphics if you load graphicx: the latter does it for you. Similarly, needless to load amsmathif you load mathtools.

\documentclass[11pt]{amsart}
\usepackage{amssymb,mathtools,amsthm,enumitem,hyperref}
\usepackage{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}

\DeclarePairedDelimiterXPP\znorm[1]{}\lVert\rVert{_0}{#1}
\DeclareMathOperator{\card}{card}

\begin{document}

\section{Important Definitions and Theorems}

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

\end{document} 

enter image description here

  • @Mico: you're right. I focused on the rest, so I didn't notice it. Thanks! – Bernard May 4 at 19:01
  • Thanks @Bernard! – Matthew Graham May 4 at 19:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.