# 1.1 LaTeX

## Summary

The LaTeX app can be used to insert LaTeX objects in worksheet cells, graph axes titles, legends and text labels.

We have the online meterials below to help you to learn how to use this app for different cases. In this tutorial, we only illustrate two cases: insert the formula of Gaussian function and a skeletal structure diagram of a molecule.

## Tutorial

1. Start this tutorial with the app LaTeX installed. If you have not installed this app, please click Add Apps button in Apps Gallery to open App Center to search and install the app.
2. Download the sample project fisrtly. Unzip the file and open the project file "LaTeX v2_3 Blog.opj".
3. Open the project, we are going to add the formula of Gaussian function and a skeletal structure diagram of a molecule as below:
4. With the graph window activated, click the app icon of LaTeX to open the LaTeX Equation Editor.
5. Enter the markup below into the top panel, and click Preview button to preview the equation:
y=y0+\frac{A\mathrm{e}^\frac{-4\ln\left(2\right)\left(x-x_c\right)^2}{w^2}}{w\sqrt{\frac{\pi}{4\ln\left(2\right)}}}

 Note: If you want to insert a built-in function or user-defined function stored in Origin, you can click the button to expand the funtion categories and select the function. The equation will be loaded into the top panel, you can click OK button to preview and insert it into the graph.
6. Click OK button to insert this equation into the graph. Next, let's add a skeletal structure diagram with LaTeX app.
7. Click the app icon again, in the opened dialog, enter the markup below into the top panel:
\documentclass{article}
\usepackage{chemfig}
\pagestyle{empty}
\begin{document}
\large
\setchemfig{atom sep=2.25em}
\chemfig[line width=1.1pt]{
CH_3-[:30]-[:90]\chemabove{N}{+}*6(=(-[:-30]=[:30]-[:-30]=[:30]*6(-\charge{[circle]90=:}{N}(-[:-90]-[:-30]CH_3)-*6(=-=-=)--=-))-=-*6(=-=-=)--)
}
\chemfig[line width=1.1pt]{
Cl^{\scriptstyle{-}}
}
\end{document}

 Note: The package chemfig is required in this case, we should include it in the markup. For more details about this package, you can refer to this file. When creating molecules with the LaTeX App, you should expect that it will take some time to render it onto a graph. Both MiKTeX and the App itself mush go through several complex steps which are even more complex with output like this. If this markup can work in TeXworks, but fail in Origin's LaTex app, select Help: Open Folder: Application Data from Origin menu, navigate to the folder: \\ImageCache\textemp, and delete temp files. Restart Origin, and it can work now.
8. Click Preview button to view the diagram.
9. Click OK button to insert this diagram into the graph window.

You are also allowed to resize, move and rotate the LaTeX objects. If you want to modify the equation, you can double-click on the inserted equation to re-open the editor.