[Tex/LaTex] Automatically size the brackets by \left and \right

bracketsmath-mode

My tex code

\documentclass[twocolumn]{article}
\usepackage{amsmath, amsfonts, amssymb, textcomp}
\usepackage[T4, OT1]{fontenc}
\usepackage{newunicodechar}
\usepackage{unicode-math}
\usepackage{multirow}
\newunicodechar{ƒ}{{\fontencoding{T4}\fontfamily{cmr}\selectfont\m f}}
\newunicodechar{Ƒ}{{\fontencoding{T4}\fontfamily{cmr}\selectfont\m F}}

\begin{document}

\begin{equation}
\begin{align} 
x\left(a + \left(b-a\right) &\frac{k-1}{N}\right)\\
&= \lambda x y 
\end{align}
\end{equation}

\end{document}

and I get the output

enter image description here

How can you automatically size the brackets with \left and \right?

Best Answer

Assuming that this is the result you wanted to achieve:

enter image description here

this is a MWE to obtain it:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{equation}
\begin{split}
x\biggl(a + (b-a)&\frac{k-1}{N}\biggr)\\
& \lambda x y
\end{split}
\end{equation}

\end{document}

And these are the errors in your MWE:

  1. You cannot put an align environment inside an equation. If you want a single equation just use equation (with no alignment characters & inside). If you want multiple aligned equations use align. But, as in your case, if you want to align stuff inside a single equation, use a split environment inside an equation.
  2. If you want to use \left and \right to "automatically size the brackets" they have to be in the same equation and there should be no & between them. You can use \left. and \right. to match the missing pairs, but in your case this doesn't work well because \left and \right are applied to things with different size. In this case (and probably always) is much better to use fixed size commands like \biggl and \biggr.
Related Question