Escape Sequences

Escape sequences and text formats

When applying special formatting to text objects on graphs, worksheets or layout pages, typically you would select the target text with your mouse and click a button on the Format or Style toolbars. When working with text objects using WYSIWYG methods, you typically are not aware of the hidden text formatting commands behind the toolbar buttons -- what we call escape sequences. However, there are places in the Origin interface where these escape sequences are seen and there are times when it is helpful to have a basic understanding of what they are and how they work.

All text labels (those created with the Text tool, the Add Text shortcut menu command, the LabTalk Label command, or any prefixes or suffixes that you type in text boxes) as well as text plotted from a Label column will use these escape sequences, even though, as mentioned, they may not be seen. All escape sequences begin with a backslash "\" character, and are followed by a control character that determines how the affected text is modified. Finally, the text to be modified follows the control character, and is enclosed in parentheses, like this:


Escape Sequences 01.png

When you use the buttons and drop-down lists on the Style and Format toolbars to format text labels, Origin automatically adds these formatting commands to the affected text. These formatting commands, while not visible in the text label itself, can be observed in the text label's Object Properties dialog box (Format: Object Properties).

For example, we could use the Text tool to create a text label that reads "Control," then highlight the text and click the Bold button (Format toolbar). The label as it appears on your graph or worksheet simply reads "Control" but what you see if you open the label's Object Properties dialog box is that your text is now enclosed by a "\b( )" sequence. It is the "\b( )" formatting command that causes the word "Control" to display in bold type. The practical significance of this is that you can explicitly use these special formatting commands to format your text -- in prefix or suffix text boxes, in the Object Properties dialog box, or with the LabTalk Label command when programmatically creating text labels -- in situations where the WYSIWYG text editing methods are not available to you.

Note that some supported escape sequences are interpreted by LabTalk while others are standard C-language escape sequences.

Available text formatting commands

Syntax Description Entering... Results in...

\(ASCII character code)

Displays the specified ASCII symbol.


Available Text Formatting Commands 12.png


Format text as subscript.


Available Text Formatting Commands 3.png


Format text as superscript.


Available Text Formatting Commands 2.png


Supersubscript notation. Format text1 as subscript, text2 as superscript.


Available Text Formatting Commands 4.png


Supersubscript notation. Format text1 and text2as subscript (there are a comma between them), text3 as superscript.


Available Text Formatting Commands 19.png


Display a bar above text.


Available Text Formatting Commands 9.png


Display a short line - a dot - above text.


Available Text Formatting Commands 10.png


Display a tilde above text.


Available Text Formatting Commands 11.png


Format text as bold.


Available Text Formatting Commands 7.png


Displays text in the color located at position number in the Color drop-down lists.


Available Text Formatting Commands 14.png


Displays text using the fontname font. You can abbreviate fontname, as long as you use enough letters for the name to be unique.

\f:Wide Latin(font)

Available Text Formatting Commands 13.png


Format text in Greek symbols.


Available Text Formatting Commands 8.png


Block substitution notation

\h(\l(1) %(?Y))

\l(1) %(?Y)


Format text as italics.


Available Text Formatting Commands 6.png


Change the point size of text. 200 doubles the size, 100 results in no change, etc.


Available Text Formatting Commands 5.png


Render the text (LaTeX markup) as a LaTeX object when inserting LaTeX Equation (for Origin 2023 or ealier version, need to use the 2017 LaTeX App).

\q(\varphi_{\mu, \sigma^{2}}(X))

Available Text Formatting Commands 16.png

\s(literal text)

Strike the text.


Strick text.png


Insert one conditional horizontal space in a string even there are multiple consecutive spaces. This is used when some labels not exist and there will be some(>1) spaces. \sc make one space only.


LName Unit


In multi-line text labels (including graph legends), add extra separation between previous line and next line in the amount of nn, where nn is percent of font height.

\l(1) %(1)
\l(2) %(2)
\l(3) %(3)

OH escape line sep increase.png


Format text as underline.


Available Text Formatting Commands 15.png


Treat text as literal text.

This is useful when displaying a path that includes a backslash '\' .

\v (C:\Samples\Programming)

Available Text Formatting Commands 1.png

\ww(literal text)

Wrap literal text entered in the legend object's Properties dialog and left-align it within the "box" allocated for the text portion of the legend.

\ww(Very Large-sized Cities: population between 5 and 10 million)

Legend Wrap Escape Sequence.png

\x(unicode number)

Display the unicode character.


Available Text Formatting Commands 18.png


Displays a full height prime or a full height double prime. To display it as a combining prime/double prime, use superscript like \+(\y(')) or \+(\y(")).


Available Text Formatting Commands 12b.png

A note on entering the backslash "\" character in text labels

When you are creating/editing a text label using the standard WYSIWYG methods, you can directly enter the backslash character into the label. It will not be interpreted as an escape sequence.

So, for instance, to type...

This file is located at C:\MY FILES

...you simply type the text, just as it reads, into the text label.

Note that Origin handles WYSIWYG insertion of the backslash by automatically inserting a second backslash character into your text string in a "behind the scenes" fashion. When in WYSIWYG mode, you see only a single backslash character. However, opening the object's Properties dialog box, will show that a second backslash character (see the picture below) has been added (Do not remove the second backslash character in this dialog box as this will break the text label, as explained below).

Escape Sequences 2.png

Use of the backslash "\" character in the Object Properties dialog box

A backslash character ("\") entered directly into the Object Properties dialog box is interpreted as an escape sequence.

For example, if you type the following in the Object Properties dialog box:

This file is located at C:\MY FILES

Origin displays:

This file is located at C:MY FILES

Note that the backslash doesn't display. If an unsupported option or no parenthesis follows the backslash character, then the backslash character is ignored and does not display. Therefore, if entering or editing text directly in the Object Properties dialog box, you must do one of the following to display the backslash character:

  • Enter a double backslash \\ into the string (example: "This file is located at C:\\MY FILES").
  • Use the \v( ) escape sequence (example: "This file is located at \v(C:\MY FILES)").
  • Place a check mark in the Verbatim box of object Properties, Text tab.
Escape Sequences 025B.png

Using LabTalk...

  1. Enter text in the Object Properties dialog box literally (entering only a single "\" character (see the picture below) -- not the double "\\"), then click OK.
    Escape Sequences 03.png
  2. Open the Command Window and enter the following at the command line:
ObjectName.verbatim=1 <ENTER>
Where ObjectName is the text object Name (as it appears in the Programming tab of Properties).

The backslash character now displays properly in your text label.

Note: The ObjectName.verbatim method is also useful when performing similar actions (inserting file path information via string variables) using the WYSIWYG text editing methods. While the WYSIWYG methods support direct entry of the backslash "\" character, backslashes are not properly handled when they are part of a string (as, for instance, a file path).

For an example of how this is handled in a text object created using WYSIWYG methods, see Substituting Variable Values in Text Labels.

A note concerning escape sequences and graph Themes

Graph Themes allow you to copy the properties of one text object and paste them to another text object. However, there are some properties of text objects which cannot be copied and pasted. If the text object property is created by inserting an escape sequence into the text object, it cannot not be applied to another text object.

To understand which text formatting options cannot be pasted to other text objects, you can begin by creating a text object and selecting it with a single mouse click. Here, you see that some Format and Style toolbar buttons -- Bold, Italic, Underline, etc. -- are not available (the buttons are grayed out), whereas others -- Greek, Increase Font/Decrease Font, Font Color, etc. -- are available.

Escape Sequences 04.png

Those buttons and drop-down lists that are not available when the text object is selected, require an escape sequence to create the format option and it is these format options which are not carried over when copying a format and pasting it to another text object.