1

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?

  • 1
    You must not nest the environments equation and align. Choose one or the other. In this case align is your friend due to the alignment character (&) in your equation. – Thorsten Donig Oct 18 '13 at 15:28
  • 1
    Also if you are using xetex (or luatex) which can use fonts with thousands of characters why use 7bit OT1 encoding and fonts with at most 128 characters?, that is rather a bizarre choice. – David Carlisle Oct 18 '13 at 15:35
  • 2
    -1: In my opinion, this question doesn't show much research effort, and clarification via comments make it seem even worse. – Werner Oct 18 '13 at 15:42
  • 2
    @StevenB.Segletes It is not a good practice anyway to use align for a single equation, IMHO. – karlkoeller Oct 18 '13 at 16:19
  • 2
    Your Minimal Working Example (MWE) should be as minimal as possible. Some part of your MWE can be removed without loss of your intent. – kiss my armpit Oct 18 '13 at 16:23
5

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.
3

It is true that \left and \right must be in the same equation, as @karlkoeller said, and therefore, one can only use commands such as \bigg to resize the brackets manually. However, the code, whose output is perfect, provided by @karlkoeller doesn't match the OP's damand --- automatic. After a few hours' test, I got this:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{equation}
\begin{split}
x\left(a + (b-a)\phantom{\rlap{$\displaystyle\frac{k-1}{N}$}}\right.&\left.\phantom{\rlap{$a + (b-a)$}}\frac{k-1}{N}\right)\\
& \left.\lambda x y\right.
\end{split}
\end{equation}

\end{document}

And its output:

enter image description here

\phantom makes it invisible, and \rlap makes its argument occupy nothing. And this is what the OP was looking for.

My answer, in my opinion, is right, but not great. Although nobody would use it in his/her formal thesis or paper, it's a nice attempt.

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.