Documentation/Math & Equations/How to Write Tensor and Index Notation in LaTeX
Math & Equations

How to Write Tensor and Index Notation in LaTeX

Tensor notation with its system of upper (contravariant) and lower (covariant) indices is essential in general relativity, continuum mechanics, and differential geometry. LaTeX handles this well with superscripts and subscripts, but multi-index tensors and Christoffel symbols require careful formatting. Bibby AI provides physics templates with tensor macros pre-configured, making it far quicker to start writing than setting everything up from scratch in Overleaf.

Basic Index Notation and Einstein Summation

Use superscripts for contravariant (upper) indices and subscripts for covariant (lower) indices. The tensor package helps with mixed indices:

\documentclass{article}
\usepackage{amsmath}
\begin{document}

% Contravariant (upper) and covariant (lower) indices
$v^i$, $\omega_j$, $T^{ij}$, $g_{\mu\nu}$

% Mixed tensor with indices on same kernel
$T^i{}_j$, $R^\rho{}_{\sigma\mu\nu}$

% Einstein summation convention
\[
v^i = g^{ij} v_j
\]

% Metric tensor contraction
\[
ds^2 = g_{\mu\nu} \, dx^\mu \, dx^\nu
\]

\end{document}

Christoffel Symbols and Riemann Tensor

Christoffel symbols and the Riemann curvature tensor require careful placement of multiple indices:

% Christoffel symbols (connection coefficients)
\[
\Gamma^\lambda{}_{\mu\nu} = \frac{1}{2} g^{\lambda\rho}
\left(
    \frac{\partial g_{\rho\mu}}{\partial x^\nu}
    + \frac{\partial g_{\rho\nu}}{\partial x^\mu}
    - \frac{\partial g_{\mu\nu}}{\partial x^\rho}
\right)
\]

% Riemann curvature tensor
\[
R^\rho{}_{\sigma\mu\nu} = 
    \partial_\mu \Gamma^\rho{}_{\nu\sigma}
    - \partial_\nu \Gamma^\rho{}_{\mu\sigma}
    + \Gamma^\rho{}_{\mu\lambda} \Gamma^\lambda{}_{\nu\sigma}
    - \Gamma^\rho{}_{\nu\lambda} \Gamma^\lambda{}_{\mu\sigma}
\]

Using the tensor Package for Complex Indices

For tensors with many indices at precise positions, the tensor package provides cleaner syntax:

\usepackage{tensor}

% Using \tensor command
$\tensor{R}{^\rho_{\sigma\mu\nu}}$

% Indices with gaps (phantom indices for alignment)
$\tensor{T}{^a_b^c_d}$

% Levi-Civita symbol
$\tensor{\varepsilon}{^{ijk}}$,
$\tensor{\varepsilon}{_{\mu\nu\rho\sigma}}$

% Covariant derivative notation
$\tensor{T}{^{\mu\nu}_{;\rho}}$

💡 Tips

  • Use {} to create empty groups for index spacing: T^i{}_j places the lower index directly below, not offset to the right.
  • For repeated indices (summation), use consistent notation — either all Greek (relativity) or all Latin (3D) indices.
  • The tensor package is especially useful when you have more than two index positions on a single symbol.
  • Bibby AI's GR and continuum mechanics templates include pre-defined macros for Christoffel symbols, Riemann tensors, and covariant derivatives.

Try This in Bibby AI

Write LaTeX faster with AI auto-complete and instant compilation.

Start Writing Free

Related Tutorials

How to Write Tensor and Index Notation in LaTeX | Bibby AI