Metric Tensor in LaTeX (g_{ij})

gijg_{ij}
LaTeX command
g_{ij}
Package
No package needed: built into LaTeX
Mode
Math mode only

Where it is used

Components of the metric tensor, the symmetric positive-definite form that defines lengths and angles on a manifold.

The line element is written ds^2 = g_{ij}\, dx^i dx^j with summation implied, and the length of a curve is \int \sqrt{g_{ij}\dot x^i \dot x^j}\, dt. In relativity the metric is Lorentzian and indexed g_{\mu\nu}, for example the Minkowski metric \eta_{\mu\nu}. Its determinant appears in the volume form \sqrt{\det g}\, dx^1 \cdots dx^n, often abbreviated \sqrt{g}. Add thin spaces with \, between the metric and the differentials so ds^2 = g_{ij}\,dx^i\,dx^j does not crowd. In matrix form it is often written (g_{ij}) or simply g.

Minimal compilable example

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

ds2=gij dxi dxjds^2 = g_{ij}\, dx^i\, dx^j
\documentclass{article}
\begin{document}
Metric Tensor: $g_{ij}$

\[ ds^2 = g_{ij}\, dx^i\, dx^j \]
\end{document}

Related symbols

All 微分幾何 →

Frequently asked questions

How do I write Metric Tensor in LaTeX?
Type g_{ij} in math mode, for example $ds^2 = g_{ij}\, dx^i\, dx^j$. It works in plain LaTeX without loading any package.
Which package do I need for g_{ij}?
None. g_{ij} is part of standard LaTeX, so it compiles with nothing in the preamble but the document class.
Can I use g_{ij} in text mode, or only in math mode?
Only in math mode. Outside $...$ LaTeX stops with "Missing $ inserted", so write $g_{ij}$ in running text.
Math poweredAIでLaTeXを書く

最高のAI LaTeXエディタ、Overleaf代替

Octreeは15以上の大学の研究者がAIを使って論文をより速く書くのを支援

  • AIで美しいTikZダイアグラムを生成
  • 画像をアップロードしてシームレスにLaTeXに変換
  • 論文の執筆とフォーマットに即座にサポートを取得