LaTeX Improvements in Origin 2017

posted in: Graphing | 4

Introduction

LaTeX fans rejoice! Support for LaTeX has vastly improved in Origin 2017. Previously in Origin 2016, LaTeX support consisted of using the LaTeX App to add LaTeX objects to graphs, primarily as equations. But Origin 2017 now allows for the addition of LaTeX objects to:

  • Worksheet Label Row Cells
  • Graph Axis Titles
  • Graph Legends

In this blog post, I’ll highlight how to add LaTeX objects to all three of those areas. If you wish to see the end result of what will be presented, you can download a sample project here. Note you must be running Origin 2017 and download and install the latest version of the LaTeX App (along with MiKTeX and OAutotrace if not already installed).

 

Worksheet Label Row Cells

The improvement in Origin in 2017 that makes possible to include LaTeX objects in label row cells is a new Origin escape sequence: \q(). This escape sequence tells Origin to render any LaTeX markup between the two parentheses as a LaTeX object at the location of the escape sequence. Take, for example, the following sequence and its result:

example1

To use such a sequence in a label row cell, you need to make sure that Rich Text is not enabled for the cells in that row. This step simply makes it easier to enter the escape sequence and markup. This is how to do that:

turnoffrichtextNext, you can ether type in the sequence or copy and paste it from another source. In the image below, I’ve entered values in the first two Long Name cells:

longname1And when I turn Rich Text back on for the row, The result is:

longname2Let’s move on to the next subject.

 

Graph Axis Titles

In the worksheet illustrated below, I’ve gone ahead and added a few more LaTeX objects to the column Long Names:

longname3When a multi-axis, multi-plot graph is created from these columns, it can be seen that Origin will intelligently pick up on the escape notations used in the column long names and uses them to render the Axis Titles as LaTeX objects:

graph1Alternatively, LaTex objects can be added to axis titles directly in the graph in one of two ways. First the new Object Properties dialog can be opened for the axis title and LaTeX markup can be entered directly using the escape sequence. For example:

titleobjpropsThe other way to add LaTeX objects to axis titles is to use the LaTeX App itself by double-clicking on the axis title to enter in-place edit mode, opening the LaTeX App from the Apps Gallery, entering the LaTeX markup in the dialog, and clicking the OK button:

latexapp1Once again, Let’s move on to the next subject.

 

Graph Legends

Lastly, I will explain how to add LaTeX objects to graph Legends. In much the same manner that LaTeX objects can be used for axis titles, they can be used for legend entries. In the example below, I have entered a few escaped LaTeX markup strings into the Comments column label row cells. When I add the two Legends to the graph, the default Legend Translation Mode picks up on the escaped LaTeX and renders it into the legend. Note how I did not turn on Rich Text in the worksheet cells and yet the Legend still renders the LaTeX!

legend1Also like how one can enter in-place edit mode and use the LaTeX App dialog to place LaTeX objects into axis titles, one can enter in-place edit mode for legend entries and do the same thing. For example:

legend2

Conclusion

I hope that this blog post has helped illustrate the new possibilities for using LaTeX objects in various places in Origin 2017. If you are a LaTeX fan and are not using Origin 2017 yet, consider downloading a demo from our website or contacting us to discuss how you can get the latest version.

Thanks for reading!

4 Responses

  1. Is there any way to change the default font used by LaTeX, perhaps by changing the default statements that are automatically wrapped around the input?
    Also, when attempting to change the font by inserting a complete LaTeX document the created object is very long with a black streak down the middle. Any suggestions?

    • Shirley Tian

      If you want to change the default font, please insert the renewcommand line as below into the document block:

      \documentclass[12pt]{article}
      \renewcommand{\familydefault}{\sfdefault}
      \begin{document}
      Hello \LaTeX
      \end{document}

      More information, you can refer to this public wiki page, https://en.wikibooks.org/wiki/LaTeX/Fonts

      You said “the created object is very long”, then you can use other package to adjust it, such as below:

      \documentclass{article}
      \usepackage[a6paper]{geometry}
      \begin{document}
      0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
      \end{document}

      To learn more about LaTaX page layout, I think you can refer to this public wiki page, https://en.wikibooks.org/wiki/LaTeX/Page_Layout

      For the “black streak down the middle”, would you please share us the LaTeX strings or a screenshot of the APP dialog? Then, we can try to reproduce the problem here.

      You can reach us via emailing to tech@originlab.com too.

      Shirley
      OriginLab Technical Support

  2. Everything works as stated but when I add \q(\psi) to a cell and turn on Rick text, there is a delay as if though the software is chugging away, but the symbol does not show up. BTW ever other feature works as promised.

Leave a Reply