# Defining absolute value in scrbook

Why does this not work in scrbook:

$\left | x \right |=\left\{\begin{matrix} x, if x\geq 0 \\ -x, if x<0 \end{matrix}\right.$

(I wrote it in writeLaTeX.)

if I use the amsmath then bring up a message:

"(no line number in this file):

LaTeX Error: Command \ iiint already defined.

Or name \ end ... illegal, see p.192 of the manual.

See the LaTeX manual or LaTeX Companion for explanation. Type H for immediate help. ...

l.507 ... {\ iiint} {\ DOTSI \ protect \ MultiIntegral {3}}

Your command was ignored. Type I to replace it with another command, or to continue without it."

The codes I've used:

\documentclass[oneside]{scrbook}
\usepackage{etoolbox}
\usepackage{helvet}
\usepackage[bahasa]{babel}
\usepackage{calc}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage[utf8]{inputenc}
\usepackage{chngcntr}
\usepackage{graphicx}
\usepackage{enumerate}
\usepackage[inline,shortlabels]{enumitem}
\usepackage{pifont}
\usepackage{wasysym}
\usepackage{sectsty}
\usepackage{amssymb}
\usepackage{array}
\usepackage{venndiagram}
\usepackage{tcolorbox}
\usepackage{comment}
\specialcomment{solusi}{\begin{tcolorbox}}{\end{tcolorbox}}
• What doesn't work, exactly? You need \usepackage{amsmath} by the way. – Torbjørn T. Nov 7 '13 at 12:58
• plus those entries in the matrix is text, so it is better to write x & \text{if $x\geq 0$} and -x & \text{if $x<0$} for the second line. – daleif Nov 7 '13 at 13:01
• \documentclass[oneside]{scrbook} \usepackage{etoolbox} \usepackage{helvet} \usepackage[bahasa]{babel} \usepackage{calc} \usepackage[usenames,dvipsnames]{xcolor} \usepackage[utf8]{inputenc} \usepackage{chngcntr} \usepackage{graphicx} \usepackage{enumerate} \usepackage[inline,shortlabels]{enumitem} \usepackage{pifont} \usepackage{wasysym} \usepackage{sectsty} \usepackage{amssymb} \usepackage{array} \usepackage{venndiagram} \usepackage{tcolorbox} \usepackage{comment} \specialcomment{solusi}{\begin{tcolorbox}}{\end{tcolorbox}} – kalakay Nov 7 '13 at 13:07
• Please update your question instead. Comments are not meant for massive amounts of code. Besides that code is not a full minimal example. Please post something can we can copy and compile as is, such that we do not have to add or guess anything. – daleif Nov 7 '13 at 13:14

You're missing a backslash character, \, between \left and {.

However, rather than just adding the missing backslash character, you may want to rewrite the entire expression to make use of the cases environment to obtain an overall better format.

\documentclass{scrbook}
\usepackage{amsmath}
\begin{document}
Original form, with backslash inserted after second \texttt{\textbackslash left}:
$\left| x \right|= \left\{ \begin{matrix} x, if x\geq 0\\ -x, if x<0 \end{matrix} \right.$

\bigskip
Modified form, using \texttt{cases} environment:
$\left | x \right | = \begin{cases} \hfill x & \text{if x\geq 0}\\ -x & \text{if x<0} \end{cases}$
\end{document}
• Nice trick with the \hfill. I've never thought of that in such a case. I didn't realize it would work in this context. – A.Ellett Nov 7 '13 at 13:22
• Please note, I wrote it in writeLaTeX, if I use the amsmath then bring up a message: (no line number in this file): LaTeX Error: C ommand \ iiint already defined. Or name \ end ... illegal, see p.192 of the manual. See the LaTeX manual or LaTeX Companion for explanation. <return> Type H for immediate help. ... l.507 ... {\ iiint} {\ DOTSI \ protect \ MultiIntegral {3}} Your command was ignored. Type I <command> <return> to replace it with another command, or <return> to continue without it. – kalakay Nov 7 '13 at 13:24
• @A.Ellett - Thanks. It works because the left-hand column of a cases environment is centered, by default, by placing \hfil at either end of the material. The \hfill instruction to the left of x serves to overpower the implicit \hfil that follows the x, and the cell ends up being typeset flush-right. :-) – Mico Nov 7 '13 at 13:26
• @kalakay - I'm afraid I'm not familiar with writeLaTeX. Are there maybe other math-related packages you're loading? Have you tried deleting all .aux files and recompiling your document. – Mico Nov 7 '13 at 13:31
• @kalakay if you are still having problems please edit your question (not comments) to have a complete document (as Mico did in this answer then people have a chance of explaining any error. – David Carlisle Nov 7 '13 at 14:02