[Tex/LaTex] Defining absolute value in scrbook

math-mode

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}}

Best Answer

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.

enter image description here

\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}