1

I'm using the \cases format to create the following equation:

enter image description here

by using:

\begin{equation}
\phi(x,y)=\begin{cases}
    
      <0, & \text{for}\  \Omega_1 \text{(Phase 1)} \\ 
      0, & \text{for}\  \Gamma \text{(Interface)} \\ 
      >0, & \text{for}\  \Omega_2 \text{(Phase 2)} 
    
    \end{cases}
 \label{eq.LS function}  
\end{equation}

Overleaf creates the equation but I receive the following error: "Misplaced alignment tab character &"

I have not used the "&" anywhere in the text and it has been used only for equations.

5
  • 2
    Remove the blank lines after \begin{cases} and before \end{cases}.
    – egreg
    Jan 25, 2022 at 16:42
  • @egreg thanks for your reply. Still the same error.
    – BroAli
    Jan 25, 2022 at 16:47
  • 1
    Do you have \usepackage{amsmath} in you document preamble?
    – egreg
    Jan 25, 2022 at 16:50
  • @egreg yes I do
    – BroAli
    Jan 25, 2022 at 16:51
  • 2
    Please, make a small example from \documentclass to \end{document} that reproduce the error. Quite likely, in trying to make it, you'll find the source of the error. If not, we can help.
    – egreg
    Jan 25, 2022 at 16:53

1 Answer 1

0

I created the following minimal working example and tested it successfully on Overleaf. As user egreg already implied, your code does not show a problem so it is difficult to guess what the problem is on your end.

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{equation}
\phi(x,y)=\begin{cases}
      <0, & \text{for}\  \Omega_1 \text{ (Phase 1)} \\ 
      0, & \text{for}\  \Gamma \text{ (Interface)} \\ 
      >0, & \text{for}\  \Omega_2 \text{ (Phase 2)} 
    \end{cases}
\label{eq.LS function}  
\end{equation}

\end{document}

enter image description here

2
  • 1
    Thanks all for your help. Basically, the problem was somewhere else! Some of journals name includes "&", and Overleaf couldn't understand it. Had to replace & with \& in references.
    – BroAli
    Jan 26, 2022 at 11:35
  • @BroAli That's why it is important to provide a complete minimal code example and not just a fragment. Jan 26, 2022 at 14:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .