What really happens when you click the "LaTeX" button…
- A new file, named equation.tex,
is created in a unique temporary directory inside /tmp. This file consists of:
- The preamble
- If the "Insert \color..." option is checked, the lines "\usepackage[dvips]{color}" and "\color[rgb]{...}" (where the ellipsis is replaced by the red, green, and blue values for the currently selected color) are appended to the preamble.
- The string "\begin{document}"
- If the "Display" radio button is checked, the string "\["
- If the "Inline" radio button is checked, the string "\("
- The contents of the main text window
- If the "Display" radio button is checked, the string "\]"
- If the "Inline" radio button is checked, the string "\)"
- The string "\end{document}".
- LaTeX is then run on equation.tex,generating
the file equation.dvi (among
others).
- The program dvips is run, converting the DVI file to PostScript.
- The program epstopdf is run, converting the PostScript file to
PDF.
- If all the above occurred without an error, then the PDF file is
displayed in the graphic area.
Why all the above? Because:
- It's the easiest way to create a PDF file that's "shrink-wrapped"
to fit.
- It allows one to use various LaTeX macros that produce PostScript
output.