5

How do I left-align selective equation blocks, i.e. not centered ?

I know how to do it for ALL equation blocks in the document setting

\usepackage[fleqn]{amsmath}
\setlength{\mathindent}{0pt}

in the preamble, but I only want to do this for some equation blocks.

\documentclass[pdftex,12pt,a4paper,english,dutch,leqno]{article}
\usepackage[top=1cm,right=1cm,bottom=1cm,left=1.5cm,noheadfoot]{geometry}
\usepackage{babel}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[dvipsnames,table]{xcolor}
\usepackage{color}
\definecolor{vanillegeel}{RGB}{255,240,216}
\usepackage{empheq}

\begin{document}

De raaklijn aan $(x_{0},f(x_{0}))$ wordt algemeen bepaald met :
\begin{empheq}[box={\fboxsep=3pt\colorbox{vanillegeel}}]{align*}
\textnormal{$\begin{cases}z=f(x)\text{ is continu in }x_{0}\text{.}\\
f'(x_{0})=0\text{ : }z=f(x_{0})\text{ is de horizontale raaklijn.}\\
\lim_{x\to x_{0}} f'(x)=\pm\infty\text{ : }x=x_{0}\text{ is de verticale raaklijn.}\\
f'(x_{0})\in\mathbb{R}_{0}\text{ : }z-f(x_{0})=f'(x_{0})\cdot(x-x_{0})\text{ is de raaklijn.\hspace{-12pt}}\end{cases}$}\end{empheq}

\end{document}
  • Place '&' at the beginning of each line inside the empheq environment and do not use the cases environment. This is the easiest way to get what you want. – Daniel F Jul 17 '15 at 16:23
5

Don't use align*.

De raaklijn aan $(x_{0},f(x_{0}))$ wordt algemeen bepaald met:
\begin{flushleft}
\colorbox{vanillegeel}{%
$\displaystyle
\begin{cases}
z=f(x) \text{ is continu in } x_{0}.
\\
f'(x_{0})=0 \text{ : } z=f(x_{0}) \text{ is de horizontale raaklijn.}
\\
\lim_{x\to x_{0}} f'(x)=\pm\infty \text{ : } x=x_{0} \text{ is de verticale raaklijn.}
\\
f'(x_{0})\in\mathbb{R}_{0} \text{ : } z-f(x_{0})=f'(x_{0})\cdot(x-x_{0})
  \text{ is de raaklijn.}
\end{cases}
$\kern-\nulldelimiterspace\kern-2\arraycolsep}
\end{flushleft}

enter image description here

  • What does \kern-\nulldelimiterspace\kern-2\arraycolsep} do in this ? – Petoetje59 Oct 5 '12 at 14:28
  • @Petoetje59 It's a substitute of your \hspace{-12pt} based on document parameters, rather than "calculation by eye". – egreg Oct 5 '12 at 14:45
  • Not allowing you to get the unsung hero badge! ;) +1. – user11232 Oct 5 '12 at 14:48
  • @HarishKumar Darn! – egreg Oct 5 '12 at 14:49
  • How come \begin{align*} doesn't work but flushleft does? – Carlos - the Mongoose - Danger Sep 1 '15 at 8:18

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.