3

My code:

 \begin{document}
    \begin{equation}
    2*x+y
    \end{equation}
 \end{document}

I found that F2 can compile as LaTeX. Compile result:

 Process started

 Process exited with error(s)

How to fixed and preview it?

5
  • What are the errors you get?
    – egreg
    Aug 30, 2011 at 8:27
  • If I compile by press F2,it doesn't show any error message.Or what the compile way I should take?
    – sam
    Aug 30, 2011 at 9:12
  • I revised the original post by F1 compiling messages.If I press F1,it shows: LaTeX Error: The font size command \normalsize is not defined: there is probably something wrong with the class file.
    – sam
    Aug 30, 2011 at 9:21
  • Please, turn the example code into the actual code you're using.
    – egreg
    Aug 30, 2011 at 9:22
  • At that time,I just post all the code I know,but now I know how to get working~Thank you all~
    – sam
    Aug 30, 2011 at 9:36

2 Answers 2

5

F2 in TeXmaker is a shortcut. What it runs is seen in the 'Tools' menu.

By default it runs 'LaTeX' but for this to compile correctly you would need your equation to be part of a complete, albeit minimal, .tex file. For example,

\documentclass{article}
\begin{document}
\begin{equation}
  \dot P = K'P+PK'^T + Cov(Kv-Gw)
\end{equation}
\end{document}

compiles without errors and should produce a .dvi file.

You may, as usual, wish to add additional packages (e.g. amsmath) or more code to view the snippet as intended.

3
  • What is amsmath for? How to use it?Should I apt-get install something?
    – sam
    Aug 30, 2011 at 9:35
  • To quote from the amsmath package documentation: "The amsmath package is a LaTeX package that provides miscellaneous enhancements for improving the information structure and printed output of documents that contain mathematical formulas."
    – mas
    Aug 30, 2011 at 12:13
  • @sam: normally seen, amsmath should work out of the box. some other packages will need installation of texlive-... packages on your linux-box
    – long tom
    Oct 26, 2012 at 21:29
1

In LaTeX, the equation environment typesets its entire contents (everything between \begin{equation} and \end{equation}) in math mode. Therefore, issuing $...$ is not needed within the environment and causes the error. Therefore, remove the "inner" $'s and it should compile fine.

1
  • I removed it as the post I revised,and press F2. That problem is still the same.How to preview the result?
    – sam
    Aug 30, 2011 at 8:04

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.