TeXipedia

textbar

Renders a vertical bar character within text mode, commonly used for absolute values or set-builder notation.

Overview

Provides a typographically correct vertical bar specifically designed for text contexts, distinct from mathematical bars.

  • Essential for writing proper absolute value notation in inline text
  • Used in linguistics for phonetic transcriptions
  • Appears in set-builder notation when writing in natural language
  • Preferred over the keyboard character (|) for better spacing and typography
  • Often employed in computer science documentation for command-line syntax

Examples

Specifying absolute value in text mode within a mathematical expression

Themagnitudeisx if x|x0The magnitude is |x| \text{ if } x \text{\textbar} x \geq 0
The magnitude is |x| \text{ if } x \text{\textbar} x \geq 0

Using textbar as a conditional separator in mathematical text

P(A|B)=P(AB)P(B)P(A \text{\textbar} B) = \frac{P(A \cap B)}{P(B)}
P(A \text{\textbar} B) = \frac{P(A \cap B)}{P(B)}

Defining a piecewise function with textbar as delimiter

f(x)={x|x>00|x0f(x) = \begin{cases} x & \text{\textbar} x > 0 \\ 0 & \text{\textbar} x \leq 0 \end{cases}
f(x) = \begin{cases} x & \text{\textbar} x > 0 \\ 0 & \text{\textbar} x \leq 0 \end{cases}