1

How would I format the following such that the text is aligned left rather than centre?

$$|x|\vcentcolon=\Bigg\{\begin{tabular}{cc}$x$ if $x>0$\\$-x$ if $x<0$\end{tabular}$$

2 Answers2

1

Instead of fiddling with the arguments of tabular, just load the amsmath package and use a cases environment.

enter image description here

\documentclass{article}
\usepackage{mathtools} % loads 'amsmath' automatically; provides '\coloneqq` macro
\begin{document}
\[
|x|\coloneqq
\begin{cases}
 x & \text{if $x\ge0$}\\
-x & \text{if $x<0$}
\end{cases}
\]
\end{document} 

Oh, and don't use $$ to start and terminate an unnumbered display math environment in a LaTeX document. See the posting Why is \[ ... \] preferable to $$ ... $$? for a discussion of why \[ ... \] should be used.

Mico
  • 506,678
1

A variant with empheq and alignat:

\documentclass{article}
\usepackage{empheq} % loads mathtools, which extends amsmath and  provides the '\coloneqq` macro

\begin{document}

\begin{empheq}[left = \lvert x\rvert \coloneq q\empheqlbrace]{alignat*=2}
  & x &\quad & \text{if $x\ge0$}\\
  -&x & & \text{if $x<0$}
\end{empheq}

\end{document}  

enter image description here

Bernard
  • 271,350