-1

I am trying to get the equation below to display a big curly braces with 4 conditional equations but my latex is giving me error 'File not found'.

 \documentclass{article}   
 \usepackage{amsmath}
 \begin{equation}
   H^'(\theta)_{mn}=
   \begin{cases}
    \frac{x_i-x_j}{d_{ij}}, & \text{if \theta_n = x_i}.\\
    \frac{x_j-x_i}{d_{ij}}, & \text{if \theta_n = x_j}.\\
    \frac{y_i-y_j}{d_{ij}}, & \text{if \theta_n = y_i}.\\
    \frac{y_j-y_i}{d_{ij}}, & \text{if \theta_n = y_j}.\\
    0, & \text{otherwise}.
   \end{cases}
\end{equation}
\end{document}
9
  • 1
    What errors you're getting? Also, add a compilable code so people can run it with less effort.
    – CroCo
    Jan 17, 2017 at 15:17
  • I get the error 'File not found'
    – Kola
    Jan 17, 2017 at 15:20
  • 1
    You also have maths inside the \text commands argument. Jan 17, 2017 at 15:26
  • 1
    \text{if \theta_n = y_j} is wrong, it should be \text{if $\theta_n = y_j$} as the equation part needs math mode and \text sends you to text mode.
    – daleif
    Jan 17, 2017 at 15:29
  • 2
    You should get the error ! LaTeX Error: Missing \begin{document}. not file not found. Are you sure you get a file error? Jan 17, 2017 at 15:45

1 Answer 1

5

Multiple errors (e.g., no \begin{document}, H^' and maths inside \text command arguments) and a style issue. Here's one that works fine for me:

\documentclass{article}   
\usepackage{amsmath}
\begin{document}
 \begin{equation}
   H'(\theta)_{mn}=
   \begin{cases}
    (x_i-x_j)/d_{ij}, & \text{if } \theta_n = x_i.\\
    (x_j-x_i)/d_{ij}, & \text{if } \theta_n = x_j.\\
    (y_i-y_j)/d_{ij}, & \text{if } \theta_n = y_i.\\
    (y_j-y_i)/d_{ij}, & \text{if } \theta_n = y_j.\\
    0, & \text{otherwise}.
   \end{cases}
\end{equation}
\end{document}
2
  • 1
    To make a whole code block display as a block, rather than using backtick delimiters, highlight the block and click on the {} icon atop the edit box. Internally, it indents those lines 4 spaces, but what is displayed is the block displayed in code form. I edited your answer to do this. Jan 17, 2017 at 15:50
  • The backticks are useful for displaying a short inline code sentence. Jan 17, 2017 at 15:54

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.