Note:Origin 2023b includes built-in LaTeX support so LaTeX App and MiKTeX installations are no longer required.
Introduction
Starting with Origin 2016 SR2, the LaTeX App has undergone considerable improvement. If you’ve already been using the App, make sure update your Origin to the latest version and then choose Tools: App Center menu and select Updates tab to update to this newer version. You only need to download and install the newer version of the App; there is no need to reinstall either MiKTeX or OAutotrace.
Note: If you haven’t used the LaTeX App before, please read Introducing the LaTeX App. It discusses the steps necessary to install the App the first time along with basic App usage.
So what’s new? First, the App handles the temporary files it creates better. But this isn’t so interesting. What’s interesting is that you can now enter complete LaTeX documents if you wish and not just equation markup as mentioned in Introducing the LaTeX App. In this blog post, I’ll show you two things you can do with the new version of the App that you couldn’t do before:
- Change the font of an equation.
- Add a skeletal structure diagram of a molecule to a graph.
Here is a graph showing this thing:

It is the UV-Vis spectrum of the linear conjugated dye 1,1′-Diethyl-2,2′-carbocyanine chloride (pinacyanol chloride). The peaks are fitted with the Gaussian fitting function. I added the formula for the Gaussian function Origin uses to the graph along with a skeletal structure of the molecule.. Keep reading to find out how I did it. To download the files associated with this post click here. Note: the *.tex file in the zipped folder can be opened in Notepad or another plain text editor. While you can view the OPJU in Origin, you will need OriginPro to rerun or edit the fitting operation.
Note: If you have previously installed the earlier version 1.2, you need to first uninstall it and shut down Origin. Then go to a folder under your user name, C:\Users\<User Name>\AppData\Local\OriginLab\93\TMP\textemp\, and delete the temporary files in that folder. Then install the new version of the App.
Change the Equation Font
By default LaTeX and the LaTeX App use Computer Modern as the font for equations. However, because the new version of the App allows you to enter a complete LaTeX document, you can include additional packages such as the mathptmx package. That package lets you use Times New Roman as the equation font. Here is the markup to enter into the LaTeX App:
\documentclass{article} \usepackage{amsmath} \usepackage{mathptmx} \pagestyle{empty} \begin{document} \begin{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)}}} \end{equation*} \end{document}
When you click the OK button in the App dialog, the typesetting engine MiKTeX may prompt you to download one or more packages. You should allow it to do so! While MiKTeX is downloading the packages, the App will pause. If for some reason the App reports an error, simply close it, reopen it, and try again. Sometimes it takes longer than anticipated for MiKTeX to download and install packages.
Add a Skeletal Structure Diagram to a Graph
Just like how we can use a complete LaTeX document to change the equation font, we can create a skeletal structure diagram of a molecule using the LaTeX App. The chemfig package is specifically designed to do this. I won’t get into the markup that chemfig uses but here is an excellent and detailed introduction. This time MiKTeX will likely have to install quite a few packages, so there may be considerable delay while it does so. This should only happen the first time you run the LaTeX App using the chemfig package. Here is the markup to enter into the App:
\documentclass{article} \usepackage{mathptmx} \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(=-=-=)--) } \quad \chemfig[line width=1.1pt]{ Cl^{\scriptstyle{-}} } \end{document}
Note: 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.
Conclusion
So you can see that the improvement to Origin’s LaTeX App opens the door to much more than just adding generic equations to graphs. You can customize fonts and do many other things not possible with the earlier version of the App.
Thanks for reading!
Hello, Chris.
I wasn’t sure if you were still following this thread. The latest version (2023b) includes built-in LaTeX support, but it seems to make it impossible to enter complete LaTeX documents, and therefore it is impossible to change math fonts and insert chemical structure diagrams. I don’t know if I haven’t explored the correct usage of the new version of the software yet, or if it’s just not possible to achieve the personalized LaTeX effects mentioned above.
Hello,
This is Snow of OriginLab.
Do you mean the complete LaTeX doc works with our old App but not with the built-in one?
Do you mind share some of problematic LaTeX doc so we can check?
Thanks, Snow
Hi Chris,
Is there a way to set the axis font also in latex font?
Hi,
In the column for the Y data, set the Long Name to be \q(e=mc^2) where e=mc^2 is the LaTeX. That is, put the LaTeX into the \q() escape sequence. Then turn on Rich Text for the Long Name row.
Sorry for not being clear, I intended to ask for converting the tick labels as well into latex fonts. Thanks, for your reply.