1

I have included libraries amsthm, amsmath, amssymb, mathtools and hyperref and I get an error when I use \left( or \right).

However, it doesn't happen in overleaf, which also includes graphicx, multicol and array.

So, my question is which library contains the \left( command ?

Johannes_B
  • 24,235
  • 10
  • 93
  • 248
Saikat
  • 185
  • 2
    It will be easier to help if you post a minimal code demonstrating what happens. – Bernard Jun 30 '16 at 08:38
  • If you use one or the other, you'll get errors yes, because you always have to have both. If you only need e.g. \left\{, then add \right., the period indicates an invisible/empty delimiter. – Torbjørn T. Jun 30 '16 at 09:22

1 Answers1

4

It is not a library what is causing you trouble.

If you include \left( also a \right) (or a \right., or maybe mathematically senseless, but also \right], \right|, etc. would work) should be included in the same equation line, and vice versa. If you jump a line in, say, align-environment you would get an error.

\begin{align}
X&=\left( \sum  \mbox{something} 
\\
&+\mbox{more stuff} \right)
\end{align}

and

\begin{align}
Y& =\left( \sum  &  \mbox{something} \right)
\end{align}

both give you an error, whereas

\begin{align}
X&=\left( \sum  \mbox{something} \right.
\\
&\left.+\mbox{more stuff} \right)
\end{align}

and

\begin{align}
Y& =\left(  \sum \right. & \left. \vphantom{\sum} \mbox{something} \right)
\end{align}

don't. Alternatively, you can get rid of this problem by using

 \big(, \bigg(, \Big(,...

instead.

c.p.
  • 4,636
  • Yes ! I was doing it in align environment. How can I solve this ? – Saikat Jun 30 '16 at 10:13
  • I need the left and right brackets. Otherwise, it's too small. – Saikat Jun 30 '16 at 10:14
  • 2
    @user230452 See the edit. Otherwise, use \big( or \Big(, which doesn't cause error. – c.p. Jun 30 '16 at 10:18
  • 1
    Might be better to promote the left and right versions of \big and friends. Usually it does not matter, but some times it does and you can see the difference. – daleif Jun 30 '16 at 10:27
  • Other than that, the general rule is avoid \left...\right constructions for the most part. Often they produce undesirable results, or as in this case, does not work. – daleif Jun 30 '16 at 10:28
  • @daleif Ok. I didn't know this. Your method is to write \right. at the end, and \left. at the beginning of every line ? Can you explain exactly you did different ? – Saikat Jun 30 '16 at 12:21
  • Thanks. Both big and Big didn't give me an error. But, big was too small and Big did the job perfectly ! How did you immediately identify the problem and know how to rectify it ? Do you have a lot of experience with LaTeX ? Also, how do you know subtle things like \left \right shouldn't be on the same line ? Is there some rule for this or is it just trial and error ? – Saikat Jun 30 '16 at 12:32
  • @user230452 there is still \bigg – c.p. Jun 30 '16 at 12:33
  • I'm accepting your answer, but what helped me the most was your comment to use Big. Put that in the answer. – Saikat Jun 30 '16 at 12:33
  • @user230452 there is \big, \Big, \bigg and \Bigg with recommended \Xl and \Xr variants. Which sizes to choose depends on the situation and taste. My general rule is: (1) I should be obvious to the user what is being fenced in, but (2) the fences should not be scaled to such an extend they take focus from the equation – daleif Jun 30 '16 at 12:43
  • @daleif What is the reason that \left ... \right constructions don't work across lines ? – Saikat Jun 30 '16 at 12:44
  • @user230452 because it is essentially a very special type of construction, and as with \macro{ .... } you get an error if the } is missing, you can see the \right) part in the same way. – daleif Jun 30 '16 at 12:49
  • Another limitation is what exactly are we scaling for if we have \left( ... \\ ... \right), are we just ignoring the \\? Plus, now the \\ is hidden inside a macro where align has no way of finding it. – daleif Jun 30 '16 at 12:52
  • @daleif Also, tell me one more thing. Does Math mode work inside Intertext ? – Saikat Jun 30 '16 at 13:33
  • @user230452 have you tried? – daleif Jun 30 '16 at 13:35
  • @daleif I tried but I didn't compile it. I noticed the dollar signs weren't coloured like they usually are. So, I just closed Intertext and started again. I don't know if it would have given an error. – Saikat Jun 30 '16 at 13:41
  • \intertext{via $x>0$ we have} works fine, otherwise post a MWE in a new question – daleif Jun 30 '16 at 13:47