Line Segment in LaTeX (\overline{AB})

AB‾\overline{AB}
LaTeX command
\overline{AB}
Package
No package needed: built into LaTeX
Mode
Math mode only

Where it is used

Bar over AB, the standard notation for the line segment between points A and B.

Geometry texts write \overline{AB} for the segment and plain AB for its length, so \overline{AB} \cong \overline{CD} pairs with AB = CD. The bar stretches over the whole argument, unlike \bar{x}, which is a fixed-width accent for a single letter. Other meanings of \overline include the complex conjugate \overline{z}, the closure of a set \overline{A}, and negation in Boolean algebra, \overline{A \cdot B}. Rays and lines use \overrightarrow{AB} and \overleftrightarrow{AB}, which mark direction or infinite extent.

Minimal compilable example

Paste this into an empty .tex file and compile it with pdfLaTeX, XeLaTeX or LuaLaTeX.

AB‾≅CD‾\overline{AB} \cong \overline{CD}
\documentclass{article}
\begin{document}
Line Segment: $\overline{AB}$

\[ \overline{AB} \cong \overline{CD} \]
\end{document}

Related symbols

All Geometry →

Frequently asked questions

How do I write Line Segment in LaTeX?
Type \overline{AB} in math mode, for example $\overline{AB} \cong \overline{CD}$. It works in plain LaTeX without loading any package.
Which package do I need for \overline{AB}?
None. \overline{AB} is part of standard LaTeX, so it compiles with nothing in the preamble but the document class.
Can I use \overline{AB} in text mode, or only in math mode?
Only in math mode. Outside $...$ LaTeX stops with "Missing $ inserted", so write $\overline{AB}$ in running text.
Math poweredWrite LaTeX using AI

Best AI LaTeX Editor, Overleaf Alternative

Octree helps researchers from 15+ universities write research papers faster using AI

  • Generate beautiful TikZ diagrams using AI
  • Upload image and convert it to LaTeX seamlessly
  • Get instant assistance with writing and formatting research papers