18 - 1.6   LaTeX Expressions

LaTeX is a computer language designed for typesetting. The most popular use of LaTeX is math and Greek fonts for technical purposes. Use the LaTeX option of the Text Details dialog (accessed via the LaTeX Box button in the Text Details dialog) to switch between normal and LaTeX text.

tex_text_details.png

The following options are available:

Generate LaTeX - Renders the LaTeX output based on the current text field.

Size - Select a character height unit from the drop-down menu, then enter the size in the associated field. LaTeX size commands are still valid and will resize relative to the Size value:

Points - Specify character height in points. One point is 1/72nd of an inch.

Frame% - Specify character height as a percentage of frame height.

Grid - Specify character height in grid units. (Available only when Position By is set to Grid.)

LaTeX - Switches between regular and LaTeX output in the text field.

X/Y Position - Choose the position of the text element's anchor point (see Anchor button).

Position by - Choose to position the text using the frame or grid coordinate system.

Anchor - Choose how the text is aligned with the anchor point. As new text is added, the text expands away from the anchor point chosen in the Anchor Alignment dialog (See Section 18 - 1.1 “Text Details” for a complete image of the Anchor Alignment dialog).

Macro function - Enter the name of the macro function to be linked to this text object. See Section 18 - 3 “Linking Text and Geometries to Macros” for more information. To run the linked macro function, hold down Control while right-clicking the text object in the workspace. (On Mac, hold down Command while right-clicking.).

A few requirements are needed before LaTeX outputs can be generated. In order to generate LaTeX outputs, see Appendix E: Section  “LaTeX Setup” for more information on how to install recommended LaTeX engines.

LaTeX Examples

Example 1: Mathematical Symbols

LaTeX allows for easy configuration symbol production. The example below shows how to create simple vector and square root symbols:

$$\vec a =\sqrt 2$$

The dollar signs denote the start of an equation. The output is shown below:

tex_output.png

Figure 18-2. Vector a equals square root of 2

Example 2: Mathematical Formula

In LaTeX, syntax is crucial to produce a correct output. Each symbol has its own syntax. The formula for Kirchhoff's current law, for example, is used like so:

Kirchhoff's current law\ldots

\begin{equation}

\sum_{k=1}^{n} I_k = 0 \; .

\end{equation}

Notice in the Figure 18-3 below how the begin and end equations separate the equation from regular text. LaTeX changes paragraph spacing as well as symbols.

TeX_example1.png

Figure 18-3. Kirchhoff's Current Law in LaTeX

note00256.pngTo prevent equation numbering, use the \begin{equation*}...\end{equation*} syntax.

Example 3: How to add summations in inline text versus display style

Note the difference in typsetting style between inline text style and display style equations.

\noindent

This is the inline text style:

$\lim_{n \to \infty} \sum_{k=1}^n \frac{1}{k^2} = \frac{\pi^2}{6}$.

\newline\noindent

And this is display style:

$$lim_{n \to \infty} \sum_{k=1}^n \frac{1}{k^2} = \frac{\pi^2}{6}$$

or

\begin{equation*} \lim_{n \to \infty} \sum_{k=1}^n \frac{1}{k^2} = \frac{\pi^2}{6} \end{equation*}

TeX_example3.png

 

Figure 18-4. Inline text versus display style

Example 4: Sizing and Acscented Phrase

LaTeX allows for easy alphabetical accents. The following example shows the variety of accented phrases that can be accomplished by LaTeX typesetting. The phrase:

\huge ?`D\'onde est\'a el avi\'on? \\

Is easily converted to non-English symbols. In LaTeX, these symbols are converted inline with other text allowing fluid transitions between both.

TeX_example2.png

Figure 18-5. Multi-lingual phrases in LaTeX

Example 5: Color, Sizing, and Text Boxes

LaTeX allows for easy customizability with certain keywords. Some keywords and formatting are dependent on packages that do not come preinstalled with your LaTeX engine. The following example uses the xcolor package to show custom formatting. To initialize xcolor in the preamble, add the following to the end of the preamble in the tecplot_latex.mcr file:

\usepackage{xcolor}

Now your Tecplot 360 EX installation will be ready to use the xcolor package. Use the following phrases as an example for color, size, and text box formatting:

\fcolorbox{red}{gray!20}{\color{red} Colors are fun} but \ldots \\

\emph{\small sometimes they are not ideal} \\

{\color{blue}\framebox{This might be better.} \\

But \colorbox{orange}{whatever you do,} \\

\color{black}don't make a {\huge Big Deal} about it.

This example shows three different text boxes each with different parameters. \fcolorbox allows for a colored frame as well as a background. \framebox has a transparent background and takes the frame color of whichever color is currently being used. \colorbox creates a highlight in the color specified. The output is shown below:

tex_color_output.png

Figure 18-6. LaTeX Color, Sizing, and Text Boxes

Additional Examples

Example 6:

Example of LaTeX color with equations. See Example 5 for information about xcolor package.

$\color{white}\overline{u^\prime v^\prime}$

TeX_example6.png

 

Figure 18-7. Overline LaTeX with color

Example 7:

Example of complex fractions

$\frac{T - T_\infty}{T_f - T_\infty}$

TeX_example7.png

 

Figure 18-8. Complex LaTeX fraction

Example 8:

Example of simple inline equation

\textbf{Normalized Mean Velocity, $\overline{W}/U_\infty$}

TeX_example8.png

 

Figure 18-9. Inline LaTeX Equation

Additional LaTeX Resources

See this page for greek letter and math symbol syntax: https://www.overleaf.com/learn/latex/List_of_Greek_letters_and_math_symbols

For more examples on LaTeX use, syntax, or concepts check Tobias Oetiker's PDF, The Not So Short Introduction to LaTeX.

Many frequently asked questions can also be found on the TeX StackExchange website: https://tex.stackexchange.com/