0

What is wrong with this piece of code in Latex?

$$\begin{displaystyle} 
C =\begin{cases} 
\frac{4}{3}, &(\text{for color singlet configuration}) \\
 -\frac{1}{6}, &(\text{for color octet configuration}) 
\end{cases} 
\end{displaystyle}$$

The compiler shows this error:

enter image description here

How should I correct this?

  • 1
    you have omitted the amsmath package (most likely) but what is the intention of \begin{displaystyle} here \displaystyle isn't needed and is never intended as an environment) – David Carlisle Jul 15 '17 at 10:08
  • 1
    Works fine for me in a MWE. Are you loading amsmath? Btw: You shouldn't use $$\begin{displaystyle}, use \[ instead. – Ulrike Fischer Jul 15 '17 at 10:08
3

You get this error from

\documentclass{article}

%\usepackage{amsmath}

\begin{document}

$$\begin{displaystyle} 
C =\begin{cases} 
\frac{4}{3}, &(\text{for color singlet configuration}) \\
 -\frac{1}{6}, &(\text{for color octet configuration}) 
\end{cases} 
\end{displaystyle}$$
\end{document}

But the markup should be

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\[
C =\begin{cases} 
\frac{4}{3}, &(\text{for color singlet configuration}) \\
 -\frac{1}{6}, &(\text{for color octet configuration}) 
\end{cases} 
\]
\end{document}
  • 3
    I would probably add a \phantom{-} before the first \frac. – Ulrike Fischer Jul 15 '17 at 10:14
  • 1
    Writing \hfill before the first \frac works too. :-) – Mico Jul 15 '17 at 10:22

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.