Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to write a simple single line equation of this kind: a = b + c = d + e + f. However, when I try to add the second identity ( = ), everything on its right side does not appear in the results. Following a piece of code here I used the &= for either the second identity or both the first and the second. Still I am doing something wrong. Here follows the code I am trying to use

\begin{equation}
\hat{{\varphi}_{it} (i_{it}, k_{it})} &= \hat{y_{it}} - \hat{{\beta}_{l}} l_{it} - \hat{{\vartheta}_{1}} X_{it} - \hat{{\vartheta}_{2}} Z_{it} &= \hat{{delta_{0}} + \sum{\sum{{\delta}_{ij} k_{t}^{i} i_{t}^{j}}} - \hat{{\beta}_{l}}l_{it} - \hat{{\vartheta}_{1}} X_{it} - \hat{{\vartheta}_{2}} Z_{it}
\end{equation}

I get the 3 following error messages exactly, attributed to the line after the command \end{equation}:

 Paragraph ended before \mathaccent\/ was complete
 Missing $ inserted
 Display math should end with $$
share|improve this question
1  
Welcome to TeX.sx! Please try to give the minimal working example (MWE) in which your problem occurs. Creating it is the first step in debugging and helps us tremendously in pin-pointing where the issue may lie. In particular it should start with \documentclass and end with \end{document}. –  canaaerus Feb 25 at 11:55
2  
remove the & (equation is not an alignment environment) –  David Carlisle Feb 25 at 12:04
    
ok, sorry and thanks –  Bob Feb 25 at 12:39
    
Suggestion: when you have a long equation to write, do it a little bit at a time and compile each time. Then it will be easier to locate errors. –  Ethan Bolker Feb 25 at 13:10

1 Answer 1

up vote 0 down vote accepted

Is this what you try to obtain? The first approach is a pure/simple math environment, the second is use of array environment, and the third approach is use of align environment. This solution simplifies the code.

Note: There was an extra \hat on the second equation right after = without an ending } and was removed. Also a backslash was missing for delta in the second equation.

enter image description here

\documentclass{article}
\usepackage{amsmath}

\begin{document}

% -- case 1

\begin{equation}
%\begin{array}{lll}
\hat{\varphi}_{it} (i_{it}, k_{it}) =\hat{y}_{it} - \hat{\beta_l} l_{it} - \hat{\vartheta}_1 X_{it} - \hat{\vartheta}_2 Z_{it} \\
= \delta_0+ \sum{\sum{\delta_{ij} k_{t}^{i} i_{t}^{j}}} - \hat{\beta_l} l_{it} - \hat{\vartheta}_{1} X_{it} - \hat{\vartheta}_{2} Z_{it}
%\end{array}
\end{equation}
\vspace{1cm}

% -- case 2

\begin{equation}
\begin{array}{lll}
\hat{\varphi}_{it} (i_{it}, k_{it}) &=\hat{y}_{it} - \hat{\beta_l} l_{it} - \hat{\vartheta}_1 X_{it} - \hat{\vartheta}_2 Z_{it} \\
&= \delta_0+ \sum{\sum{\delta_{ij} k_{t}^{i} i_{t}^{j}}} - \hat{\beta_l} l_{it} - \hat{\vartheta}_{1} X_{it} - \hat{\vartheta}_{2} Z_{it}
\end{array}
\end{equation}
\vspace{1cm}

% --- case 3

\begin{equation}
\begin{aligned}
\hat{\varphi}_{it} (i_{it}, k_{it}) &= \hat{y}_{it} - \hat{\beta_l} l_{it} - \hat{\vartheta}_1 X_{it} - \hat{\vartheta}_2 Z_{it} \\
&= \delta_0+ \sum{\sum{\delta_{ij} k_{t}^{i} i_{t}^{j}}} - \hat{\beta_l} l_{it} - \hat{\vartheta}_{1} X_{it} - \hat{\vartheta}_{2} Z_{it}
\end{aligned}
\end{equation}

\end{document}
share|improve this answer
    
Ok thanks. What am I instead supposed to do if I want to put everything on the same line ? –  Bob Feb 25 at 12:42
    
OK just remove the \\ on the first line and remove the second &. You will get a one line equation. But it may exceed the text width. –  Jesse Feb 25 at 12:44
    
Of course you could remove the array environment in the first case, for example, and all the & out of the equation and still get a one line equation. –  Jesse Feb 25 at 12:48
    
Yes, in equation environment & does not work and shows error. But the \\ (if any) does not work either, all will continue to be typeset. –  Jesse Feb 25 at 13:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.