# How to preview LaTeX equation or document in TexMaker?

My code:

 \begin{document}
$$2*x+y$$
\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?

-
What are the errors you get? –  egreg Aug 30 '11 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 '11 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 '11 at 9:21
Please, turn the example code into the actual code you're using. –  egreg Aug 30 '11 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 '11 at 9:36

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}
$$\dot P = K'P+PK'^T + Cov(Kv-Gw)$$
\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.

-
What is amsmath for? How to use it?Should I apt-get install something? –  sam Aug 30 '11 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 '11 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 '12 at 21:29

In LaTeX, the equation environment typesets its entire contents (everything between and ) 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.

-
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 '11 at 8:04