> ## Documentation Index
> Fetch the complete documentation index at: https://resources.latex-cloud-studio.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Subscript in LaTeX: _, Braces, Superscripts, and Common Errors

> Write a subscript in LaTeX with `_` and a superscript with `^`. Use braces for multiple characters and fix double-subscript errors.

export const RenderedOutput = ({title = "Rendered output", ctaHref, ctaLabel = "Open LaTeX Cloud Studio", children}) => {
  const [isExpanded, setIsExpanded] = useState(false);
  const trackEditorCta = () => {
    const target = new URL(ctaHref, window.location.href);
    globalThis.posthog?.capture?.("docs_app_cta_clicked", {
      source_page: window.location.pathname,
      source_section: "rendered_output",
      cta_variant: "first_compiled_example",
      target_url: target.toString(),
      target_utm_source: target.searchParams.get("utm_source"),
      target_utm_medium: target.searchParams.get("utm_medium"),
      target_utm_campaign: target.searchParams.get("utm_campaign"),
      target_utm_content: target.searchParams.get("utm_content")
    }, {
      transport: "sendBeacon",
      send_instantly: true
    });
  };
  return <details className="rendered-output" onToggle={event => setIsExpanded(event.currentTarget.open)}>
      <summary className="rendered-output__summary">
        <span className="rendered-output__title">{title}</span>
        <span className="rendered-output__hint" aria-hidden="true">View compiled result</span>
      </summary>
      {isExpanded && <div className="rendered-output__content">
          {children}
          {ctaHref && <aside className="rendered-output__cta" aria-label="Continue in the LaTeX editor">
              <span>
                <strong>Ready to use this syntax?</strong>
                Continue in the browser editor when you want to adapt the example in a real project.
              </span>
              <a href={ctaHref} onClick={trackEditorCta}>{ctaLabel}<span aria-hidden="true"> →</span></a>
            </aside>}
        </div>}
    </details>;
};

export const LatexSource = ({filename, source}) => {
  const [copyStatus, setCopyStatus] = useState("Copy");
  const copySource = async () => {
    try {
      await navigator.clipboard.writeText(source);
      setCopyStatus("Copied");
    } catch {
      setCopyStatus("Select and copy");
    }
  };
  return <figure className="latex-source">
      <figcaption className="latex-source__header">
        <span className="latex-source__filename">{filename}</span>
        <button type="button" className="latex-source__copy" onClick={copySource} aria-live="polite">
          {copyStatus}
        </button>
      </figcaption>
      <pre className="latex-source__pre" aria-label={`LaTeX source: ${filename}`} tabIndex="0">
        <code className="language-latex">{source}</code>
      </pre>
    </figure>;
};

export const LatexPreview = ({src, alt, caption, width, height}) => {
  const minZoom = 1;
  const maxZoom = 3;
  const zoomStep = 0.5;
  const measureSvgContent = async (assetSrc, pageWidth, pageHeight) => {
    const cacheKey = "__latexCloudSvgContentBoxCache";
    const contentBoxCache = globalThis[cacheKey] ?? new Map();
    globalThis[cacheKey] = contentBoxCache;
    if (contentBoxCache.has(assetSrc)) return contentBoxCache.get(assetSrc);
    const measurement = (async () => {
      const assetUrl = new URL(assetSrc, window.location.href);
      if (assetUrl.origin !== window.location.origin) {
        throw new Error("Rendered output must use a same-origin SVG asset.");
      }
      const response = await fetch(assetUrl, {
        credentials: "same-origin"
      });
      if (!response.ok) throw new Error(`Rendered output request failed with ${response.status}.`);
      const source = await response.text();
      const documentNode = new DOMParser().parseFromString(source, "image/svg+xml");
      if (documentNode.querySelector("parsererror")) throw new Error("Rendered output is not valid SVG.");
      const sourceSvg = documentNode.documentElement;
      sourceSvg.querySelectorAll("script, foreignObject").forEach(node => node.remove());
      [sourceSvg, ...sourceSvg.querySelectorAll("*")].forEach(node => {
        [...node.attributes].forEach(attribute => {
          if ((/^on/i).test(attribute.name)) node.removeAttribute(attribute.name);
          if ((attribute.name === "href" || attribute.name === "xlink:href") && !attribute.value.startsWith("#")) {
            node.removeAttribute(attribute.name);
          }
        });
      });
      const measurementHost = document.createElement("div");
      measurementHost.className = "latex-preview__measurement-host";
      const measuredSvg = document.importNode(sourceSvg, true);
      measuredSvg.setAttribute("aria-hidden", "true");
      measurementHost.appendChild(measuredSvg);
      document.body.appendChild(measurementHost);
      try {
        const measuredElements = [...measuredSvg.children].filter(node => !["defs", "desc", "metadata", "style", "title"].includes(node.tagName.toLowerCase()));
        const elementBounds = measuredElements.map(node => node.getBBox()).filter(box => [box.x, box.y, box.width, box.height].every(Number.isFinite) && box.width > 0 && box.height > 0);
        if (elementBounds.length === 0) {
          throw new Error("Rendered output has no measurable visible content.");
        }
        const sortedBounds = [...elementBounds].sort((left, right) => left.y - right.y);
        const clusterGap = pageHeight * 0.045;
        const clusters = [];
        sortedBounds.forEach(box => {
          const current = clusters[clusters.length - 1];
          if (!current || box.y - current.bottom > clusterGap) {
            clusters.push({
              boxes: [box],
              bottom: box.y + box.height
            });
            return;
          }
          current.boxes.push(box);
          current.bottom = Math.max(current.bottom, box.y + box.height);
        });
        const contentClusters = clusters.filter(cluster => {
          const clusterBox = cluster.boxes.reduce((combined, box) => {
            const right = Math.max(combined.x + combined.width, box.x + box.width);
            const bottom = Math.max(combined.y + combined.height, box.y + box.height);
            const x = Math.min(combined.x, box.x);
            const y = Math.min(combined.y, box.y);
            return {
              x,
              y,
              width: right - x,
              height: bottom - y
            };
          });
          const centerY = clusterBox.y + clusterBox.height / 2;
          const isMarginFurniture = cluster.boxes.length <= 2 && clusterBox.width < pageWidth * 0.2 && clusterBox.height < pageHeight * 0.04 && (centerY < pageHeight * 0.08 || centerY > pageHeight * 0.8);
          return !isMarginFurniture;
        });
        const visibleBounds = (contentClusters.length > 0 ? contentClusters : clusters).flatMap(cluster => cluster.boxes);
        const bounds = visibleBounds.reduce((combined, box) => {
          const right = Math.max(combined.x + combined.width, box.x + box.width);
          const bottom = Math.max(combined.y + combined.height, box.y + box.height);
          const x = Math.min(combined.x, box.x);
          const y = Math.min(combined.y, box.y);
          return {
            x,
            y,
            width: right - x,
            height: bottom - y
          };
        });
        const clampValue = (value, minimum, maximum) => Math.min(maximum, Math.max(minimum, value));
        const padding = Math.max(8, Math.min(pageWidth, pageHeight) * 0.025);
        const x = clampValue(bounds.x - padding, 0, pageWidth);
        const y = clampValue(bounds.y - padding, 0, pageHeight);
        const right = clampValue(bounds.x + bounds.width + padding, 0, pageWidth);
        const bottom = clampValue(bounds.y + bounds.height + padding, 0, pageHeight);
        return {
          x,
          y,
          width: right - x,
          height: bottom - y
        };
      } finally {
        measurementHost.remove();
      }
    })();
    contentBoxCache.set(assetSrc, measurement);
    measurement.catch(() => contentBoxCache.delete(assetSrc));
    return measurement;
  };
  const renderPreviewAsset = ({contentBox: assetContentBox, loading}) => {
    if (!assetContentBox) {
      return <img className="latex-preview__asset" src={src} alt={alt} width={width} height={height} loading={loading} draggable="false" />;
    }
    return <svg className="latex-preview__asset" viewBox={`${assetContentBox.x} ${assetContentBox.y} ${assetContentBox.width} ${assetContentBox.height}`} preserveAspectRatio="xMidYMid meet" role="img" aria-label={alt}>
        <image href={src} x="0" y="0" width={width} height={height} />
      </svg>;
  };
  const [isOpen, setIsOpen] = useState(false);
  const [frameMode, setFrameMode] = useState("content");
  const [viewMode, setViewMode] = useState("fit");
  const [zoom, setZoom] = useState(minZoom);
  const [contentBox, setContentBox] = useState(null);
  const [measurementStatus, setMeasurementStatus] = useState("loading");
  const dialogRef = useRef(null);
  const closeButtonRef = useRef(null);
  const viewportRef = useRef(null);
  const previousFocusRef = useRef(null);
  const dragRef = useRef(null);
  useEffect(() => {
    let isCurrent = true;
    setMeasurementStatus("loading");
    measureSvgContent(src, width, height).then(box => {
      if (!isCurrent) return;
      setContentBox(box);
      setMeasurementStatus("ready");
    }).catch(() => {
      if (!isCurrent) return;
      setContentBox(null);
      setFrameMode("page");
      setMeasurementStatus("error");
    });
    return () => {
      isCurrent = false;
    };
  }, [height, src, width]);
  const closeViewer = useCallback(() => {
    setIsOpen(false);
  }, []);
  const openViewer = () => {
    previousFocusRef.current = document.activeElement;
    setFrameMode(contentBox ? "content" : "page");
    setViewMode("fit");
    setZoom(minZoom);
    setIsOpen(true);
  };
  const applyZoom = useCallback(nextZoom => {
    const boundedZoom = Math.min(maxZoom, Math.max(minZoom, nextZoom));
    setViewMode("custom");
    setZoom(boundedZoom);
  }, []);
  const zoomIn = useCallback(() => {
    applyZoom(viewMode === "fit" ? minZoom + zoomStep : zoom + zoomStep);
  }, [applyZoom, viewMode, zoom]);
  const zoomOut = useCallback(() => {
    applyZoom(viewMode === "fit" ? minZoom : zoom - zoomStep);
  }, [applyZoom, viewMode, zoom]);
  useEffect(() => {
    if (!isOpen) return undefined;
    const previousOverflow = document.body.style.overflow;
    document.body.style.overflow = "hidden";
    closeButtonRef.current?.focus();
    return () => {
      document.body.style.overflow = previousOverflow;
      previousFocusRef.current?.focus?.();
    };
  }, [isOpen]);
  useEffect(() => {
    if (!isOpen) return undefined;
    const handleKeyDown = event => {
      if (event.key === "Escape") {
        event.preventDefault();
        closeViewer();
        return;
      }
      if ((event.key === "+" || event.key === "=") && !event.metaKey && !event.ctrlKey) {
        event.preventDefault();
        zoomIn();
        return;
      }
      if (event.key === "-" && !event.metaKey && !event.ctrlKey) {
        event.preventDefault();
        zoomOut();
        return;
      }
      if (event.key !== "Tab" || !dialogRef.current) return;
      const focusable = [...dialogRef.current.querySelectorAll('button:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])')];
      if (focusable.length === 0) return;
      const first = focusable[0];
      const last = focusable[focusable.length - 1];
      if (event.shiftKey && document.activeElement === first) {
        event.preventDefault();
        last.focus();
      } else if (!event.shiftKey && document.activeElement === last) {
        event.preventDefault();
        first.focus();
      }
    };
    window.addEventListener("keydown", handleKeyDown);
    return () => {
      window.removeEventListener("keydown", handleKeyDown);
    };
  }, [closeViewer, isOpen, zoomIn, zoomOut]);
  const startDrag = event => {
    if (event.button !== 0 || !viewportRef.current) return;
    const viewport = viewportRef.current;
    dragRef.current = {
      pointerId: event.pointerId,
      x: event.clientX,
      y: event.clientY,
      scrollLeft: viewport.scrollLeft,
      scrollTop: viewport.scrollTop
    };
    viewport.setPointerCapture(event.pointerId);
    viewport.dataset.dragging = "true";
  };
  const continueDrag = event => {
    const drag = dragRef.current;
    const viewport = viewportRef.current;
    if (!drag || !viewport || drag.pointerId !== event.pointerId) return;
    viewport.scrollLeft = drag.scrollLeft - (event.clientX - drag.x);
    viewport.scrollTop = drag.scrollTop - (event.clientY - drag.y);
  };
  const stopDrag = event => {
    const viewport = viewportRef.current;
    if (viewport?.hasPointerCapture(event.pointerId)) viewport.releasePointerCapture(event.pointerId);
    if (viewport) delete viewport.dataset.dragging;
    dragRef.current = null;
  };
  const activeContentBox = frameMode === "content" ? contentBox : null;
  const activeWidth = activeContentBox?.width ?? width;
  const activeHeight = activeContentBox?.height ?? height;
  const activeRatio = activeWidth / activeHeight;
  const inlineContentBox = measurementStatus === "ready" ? contentBox : null;
  const inlineWidth = inlineContentBox?.width ?? width;
  const inlineHeight = inlineContentBox?.height ?? height;
  const inlineGeometry = {
    aspectRatio: `${inlineWidth} / ${inlineHeight}`,
    maxWidth: `${30 * inlineWidth / inlineHeight}rem`
  };
  const imageStyle = viewMode === "fit" ? {
    aspectRatio: `${activeWidth} / ${activeHeight}`,
    width: "100%",
    maxWidth: `${Math.max(16, activeRatio * 78)}dvh`
  } : {
    aspectRatio: `${activeWidth} / ${activeHeight}`,
    width: `${zoom * 100}%`,
    maxWidth: "none"
  };
  const zoomLabel = viewMode === "fit" ? frameMode === "content" ? "Fit content" : "Full page" : `${Math.round(zoom * 100)}%`;
  return <figure className="latex-preview">
      <button type="button" className="latex-preview__trigger" onClick={openViewer} aria-haspopup="dialog" aria-label={`Open zoomable preview: ${alt}`}>
        <span className="latex-preview__page" style={inlineGeometry}>
          {measurementStatus === "loading" ? <span className="latex-preview__loading" role="status">Preparing compiled output…</span> : renderPreviewAsset({
    src,
    alt,
    width,
    height,
    contentBox: inlineContentBox,
    loading: "lazy"
  })}
        </span>
        <span className="latex-preview__trigger-label" aria-hidden="true">
          <span className="latex-preview__trigger-icon">⌕</span>
          Open viewer
        </span>
      </button>
      <figcaption className="latex-preview__caption">
        <span>
          {caption}
          {measurementStatus === "error" && <span className="latex-preview__status" role="status"> Content fit is unavailable; the complete vector page is shown.</span>}
        </span>
        <a href={src} target="_blank" rel="noreferrer" className="latex-preview__source-link">Open SVG</a>
      </figcaption>

      {isOpen && <div className="latex-preview__backdrop" onMouseDown={event => {
    if (event.target === event.currentTarget) closeViewer();
  }}>
          <section ref={dialogRef} className="latex-preview__dialog" role="dialog" aria-modal="true" aria-label={`Rendered LaTeX viewer: ${alt}`}>
            <header className="latex-preview__toolbar">
              <div className="latex-preview__identity">
                <span className="latex-preview__eyebrow">Compiled LaTeX</span>
                <span className="latex-preview__filename">{alt}</span>
              </div>
              <div className="latex-preview__controls" aria-label="Preview controls">
                <button type="button" className={frameMode === "content" && viewMode === "fit" ? "is-active" : undefined} disabled={!contentBox} onClick={() => {
    setFrameMode("content");
    setViewMode("fit");
    setZoom(minZoom);
  }}>
                  Fit content
                </button>
                <button type="button" className={frameMode === "page" && viewMode === "fit" ? "is-active" : undefined} onClick={() => {
    setFrameMode("page");
    setViewMode("fit");
    setZoom(minZoom);
  }}>
                  Full page
                </button>
                <span className="latex-preview__zoom-group">
                  <button type="button" onClick={zoomOut} disabled={viewMode === "fit" || zoom <= minZoom} aria-label="Zoom out">−</button>
                  <output aria-live="polite" aria-label="Current zoom">{zoomLabel}</output>
                  <button type="button" onClick={zoomIn} disabled={viewMode !== "fit" && zoom >= maxZoom} aria-label="Zoom in">+</button>
                </span>
                <a href={src} target="_blank" rel="noreferrer">Open SVG</a>
                <button ref={closeButtonRef} type="button" className="latex-preview__close" onClick={closeViewer} aria-label="Close rendered LaTeX viewer">
                  Close
                </button>
              </div>
            </header>
            <div ref={viewportRef} className="latex-preview__viewport" data-view-mode={viewMode} onPointerDown={startDrag} onPointerMove={continueDrag} onPointerUp={stopDrag} onPointerCancel={stopDrag}>
              <span className="latex-preview__dialog-page" style={imageStyle}>
                {renderPreviewAsset({
    src,
    alt,
    width,
    height,
    contentBox: activeContentBox
  })}
              </span>
            </div>
            <footer className="latex-preview__viewer-note">
              Compiler-generated vector output · Use +/− to zoom · Drag to pan · Esc to close
            </footer>
          </section>
        </div>}
    </figure>;
};

To write a subscript in LaTeX, use `_` in math mode: `x_1`. Use `^` for a superscript: `x^2`. Braces are required when more than one character belongs in the lower or upper position, as in `x_{12}` or `x^{2n}`.

<Info>
  **Copy-paste syntax**: `$x_1$`, `$x_{n+1}$`, `$x^2$`, and `$x^{2n}$`. Put the expression in math mode and group multi-character subscripts or superscripts with `{...}`.

  **Prerequisites**: Basic LaTeX knowledge. For math mode basics, see [Mathematical Expressions](/learn/latex/mathematics/mathematical-expressions).

  **Last updated**: April 2026 | **Reading time**: 12 min | **Difficulty**: Beginner to Intermediate
</Info>

## What You'll Learn

* ✅ Basic LaTeX subscript and superscript syntax for mathematical notation
* ✅ Multiple character subscripts and compound superscript expressions
* ✅ Special cases (limits, operators, tensor notation)
* ✅ Chemical formula subscript notation and isotopes
* ✅ Advanced subscript positioning and formatting techniques
* ✅ Common subscript errors and how to fix them
* ✅ Best practices for readable mathematical notation

## Frequently Asked Questions

<Accordion title="What is the difference between subscripts and superscripts in LaTeX?">
  In LaTeX, **subscripts** are notations placed below the baseline using the underscore character (`_`), commonly used for indices and chemical formulas. **Superscripts** are placed above the baseline using the caret character (`^`), typically for exponents and powers. Both are essential for mathematical and scientific notation in professional documents.

  **Quick Example:**

  * Subscript: `x_1` renders as x₁
  * Superscript: `x^2` renders as x²
</Accordion>

<Accordion title="How do I write multiple character subscripts in LaTeX?">
  Always use braces `{}` to group multiple characters in a LaTeX subscript or superscript. Without braces, only the first character becomes a subscript.

  **Correct subscript syntax:**

  <LatexSource filename="example.tex" source={"x_{12}      % Both 1 and 2 are subscript\nx_{n+1}     % Entire expression is subscript"} />

  <RenderedOutput title="Rendered output" ctaHref="https://app.latex-cloud-studio.com/?utm_source=resources&utm_medium=rendered_output&utm_campaign=docs_open_app&utm_content=learn_latex_mathematics_subscripts_superscripts">
    <LatexPreview src="/images/rendered/learn-latex-mathematics-subscripts-superscripts-01/page-1.svg" alt="Compiled PDF page 1 from example.tex" caption="Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment. The visible fragment is compiled inside the documented minimal article wrapper." width={595.276} height={841.89} />
  </RenderedOutput>

  **Wrong syntax:**

  <LatexSource filename="example.tex" source={"x_12        % Only 1 is subscript (renders as x₁2)"} />

  <RenderedOutput title="Expected effect">
    <Info>
      This code is a contextual or intentionally partial LaTeX excerpt, not a self-contained compilable document. Its visible result depends on the surrounding document, so the documentation shows the expected role without inventing a standalone preview.
    </Info>
  </RenderedOutput>

  This is one of the most common subscript errors in LaTeX.
</Accordion>

<Accordion title="Why do I get a 'Double subscript' error in LaTeX?">
  The "Double subscript" error occurs when you try to apply two subscripts to the same variable without proper grouping:

  <LatexSource filename="example.tex" source={"x_a_b       % ERROR: Double subscript"} />

  <RenderedOutput title="Expected effect">
    <Info>
      This code is a contextual or intentionally partial LaTeX excerpt, not a self-contained compilable document. Its visible result depends on the surrounding document, so the documentation shows the expected role without inventing a standalone preview.
    </Info>
  </RenderedOutput>

  **Solutions:**

  1. Use nested braces if one subscript depends on another:

  <LatexSource filename="example.tex" source={"x_{a_b}     % Correct: a has subscript b, all subscript to x"} />

  <RenderedOutput title="Rendered output">
    <LatexPreview src="/images/rendered/learn-latex-mathematics-subscripts-superscripts-04/page-1.svg" alt="Compiled PDF page 1 from example.tex" caption="Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment. The visible fragment is compiled inside the documented minimal article wrapper." width={595.276} height={841.89} />
  </RenderedOutput>

  2. Or separate them with an empty group:

  <LatexSource filename="example.tex" source={"x_a{}_{b}   % Correct: separate subscripts"} />

  <RenderedOutput title="Rendered output">
    <LatexPreview src="/images/rendered/learn-latex-mathematics-subscripts-superscripts-05/page-1.svg" alt="Compiled PDF page 1 from example.tex" caption="Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment. The visible fragment is compiled inside the documented minimal article wrapper." width={595.276} height={841.89} />
  </RenderedOutput>
</Accordion>

<Accordion title="How do I use subscripts in chemical formulas?">
  For chemical formula subscript notation, enclose the formula in `\mathrm{}` and use subscripts for atom counts:

  <LatexSource filename="example.tex" source={"$\\mathrm{H_2O}$         % Water\n$\\mathrm{SO_4^{2-}}$    % Sulfate ion\n$^{14}\\mathrm{C}$       % Carbon-14 isotope"} />

  <RenderedOutput title="Rendered output">
    <LatexPreview src="/images/rendered/learn-latex-mathematics-subscripts-superscripts-06/page-1.svg" alt="Compiled PDF page 1 from example.tex" caption="Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment. The visible fragment is compiled inside the documented minimal article wrapper." width={595.276} height={841.89} />
  </RenderedOutput>

  For better chemistry support, use the `mhchem` package:

  <LatexSource filename="example.tex" source={"\\usepackage{mhchem}\n\\ce{H2O}                % Simpler syntax\n\\ce{SO4^{2-}}           % Cleaner appearance"} />

  <RenderedOutput title="Rendered output">
    <LatexPreview src="/images/rendered/learn-latex-mathematics-subscripts-superscripts-07/page-1.svg" alt="Compiled PDF page 1 from example.tex" caption="Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment. The visible fragment is compiled inside the documented minimal article wrapper." width={612} height={792} />
  </RenderedOutput>
</Accordion>

<Accordion title="What's the correct syntax for tensor notation subscripts?">
  Tensor notation typically places superscripts before subscripts for contravariant and covariant indices:

  <LatexSource filename="example.tex" source={"$T^{\\mu\\nu}_{\\rho\\sigma}$   % Standard tensor notation\n$R^{\\alpha}_{\\beta\\gamma\\delta}$    % Riemann curvature tensor\n$g_{\\mu\\nu}$                        % Metric tensor"} />

  <RenderedOutput title="Rendered output">
    <LatexPreview src="/images/rendered/learn-latex-mathematics-subscripts-superscripts-08/page-1.svg" alt="Compiled PDF page 1 from example.tex" caption="Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment. The visible fragment is compiled inside the documented minimal article wrapper." width={595.276} height={841.89} />
  </RenderedOutput>

  The `tensor` package can simplify pre-superscripts and pre-subscripts in tensor notation.
</Accordion>

<Accordion title="Can I use subscripts in LaTeX text mode (outside of equations)?">
  Yes! Use `\textsubscript{}` and `\textsuperscript{}` commands for text mode subscript notation:

  <LatexSource filename="example.tex" source={"H\\textsubscript{2}O is water.\nE = mc\\textsuperscript{2} is Einstein's equation."} />

  <RenderedOutput title="Rendered output">
    <LatexPreview src="/images/rendered/learn-latex-mathematics-subscripts-superscripts-09/page-1.svg" alt="Compiled PDF page 1 from example.tex" caption="Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment. The visible fragment is compiled inside the documented minimal article wrapper." width={595.276} height={841.89} />
  </RenderedOutput>

  Alternatively, use math mode notation within text:

  <LatexSource filename="example.tex" source={"H$_2$O is water."} />

  <RenderedOutput title="Rendered output">
    <LatexPreview src="/images/rendered/learn-latex-mathematics-subscripts-superscripts-10/page-1.svg" alt="Compiled PDF page 1 from example.tex" caption="Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment. The visible fragment is compiled inside the documented minimal article wrapper." width={595.276} height={841.89} />
  </RenderedOutput>
</Accordion>

<Accordion title="How do I avoid deeply nested subscript errors?">
  Avoid excessive subscript nesting beyond 2-3 levels, as it becomes hard to read:

  **Acceptable nesting:**

  <LatexSource filename="example.tex" source={"$x_{i_j}$       % OK: two levels"} />

  <RenderedOutput title="Rendered output">
    <LatexPreview src="/images/rendered/learn-latex-mathematics-subscripts-superscripts-11/page-1.svg" alt="Compiled PDF page 1 from example.tex" caption="Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment. The visible fragment is compiled inside the documented minimal article wrapper." width={595.276} height={841.89} />
  </RenderedOutput>

  **Problematic nesting:**

  <LatexSource filename="example.tex" source={"$x_{i_{j_{k}}}$ % Difficult to read and maintain"} />

  <RenderedOutput title="Rendered output">
    <LatexPreview src="/images/rendered/learn-latex-mathematics-subscripts-superscripts-12/page-1.svg" alt="Compiled PDF page 1 from example.tex" caption="Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment. The visible fragment is compiled inside the documented minimal article wrapper." width={595.276} height={841.89} />
  </RenderedOutput>

  **Best practice:** For complex notation, break expressions into parts for clarity.
</Accordion>

<Accordion title="What's the best practice for mathematical indices in research papers?">
  **Consistency guidelines for academic subscript notation:**

  1. **Index naming:** Use consistent single letters (i, j, k) throughout
  2. **Coordinate systems:** Stick to one notation style consistently
  3. **Vector notation:** Use either subscripts or superscripts consistently
  4. **Summation indices:** Follow Einstein summation convention in physics
  5. **Semantic meaning:** Choose meaningful indices: `v_x` instead of `v_1` for x-component
</Accordion>

## Basic Syntax

### Subscripts (Indices)

<LatexSource filename="basic-subscripts.tex" source={"\\documentclass{article}\n\\usepackage{amsmath}\n\\begin{document}\n\n% Single character subscript\n$x_1$, $x_2$, $x_n$\n\n% Multiple character subscript (requires braces)\n$x_{12}$, $x_{n+1}$, $x_{max}$\n\n% Variables with subscripts\n$a_i$, $b_j$, $c_{ij}$\n\n% Greek letters with subscripts\n$\\alpha_1$, $\\beta_{n}$, $\\gamma_{i,j}$\n\n\\end{document}"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-latex-mathematics-subscripts-superscripts-13/page-1.svg" alt="Compiled PDF page 1 from basic-subscripts.tex" caption="Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={595.276} height={841.89} />
</RenderedOutput>

<Card title="Expected output" icon="eye">
  **Single character:** $x_1$, $x_2$, $x_n$

  **Multiple characters:** $x_{12}$, $x_{n+1}$, $x_{max}$

  **Variables:** $a_i$, $b_j$, $c_{ij}$

  **Greek letters:** $\alpha_1$, $\beta_{n}$, $\gamma_{i,j}$
</Card>

### Superscripts (Exponents)

<LatexSource filename="basic-superscripts.tex" source={"\\documentclass{article}\n\\usepackage{amsmath}\n\\begin{document}\n\n% Single character superscript\n$x^2$, $x^n$, $x^*$\n\n% Multiple character superscript (requires braces)\n$x^{10}$, $x^{2n}$, $x^{n+1}$\n\n% Common exponents\n$e^x$, $2^n$, $10^{-3}$\n\n% Special notations\n$x^{\\prime}$, $x^{\\dagger}$, $x^{\\ast}$\n\n\\end{document}"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-latex-mathematics-subscripts-superscripts-14/page-1.svg" alt="Compiled PDF page 1 from basic-superscripts.tex" caption="Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={595.276} height={841.89} />
</RenderedOutput>

<Card title="Expected output" icon="eye">
  **Single character:** $x^2$, $x^n$, $x^*$

  **Multiple characters:** $x^{10}$, $x^{2n}$, $x^{n+1}$

  **Common exponents:** $e^x$, $2^n$, $10^{-3}$

  **Special notations:** $x^{\prime}$, $x^{\dagger}$, $x^{\ast}$
</Card>

### Important Rule: Braces for Multiple Characters

<Warning>
  **Critical**: Without braces, only the first character after `_` or `^` becomes sub/superscript:

  * `x_12` renders as x₁2 (only 1 is subscript)
  * `x_{12}` renders as x₁₂ (both 1 and 2 are subscript)
</Warning>

## Combined Subscripts and Superscripts

### Basic Combinations

<LatexSource filename="combined-sub-super.tex" source={"\\documentclass{article}\n\\usepackage{amsmath}\n\\begin{document}\n\n% Both subscript and superscript\n$x_1^2$, $a_n^m$, $x_i^{j+1}$\n\n% Order doesn't matter\n$x_1^2 = x^2_1$\n\n% Complex combinations\n$x_{n+1}^{2m}$, $a_{ij}^{kl}$\n\n% With operators\n$\\sum_{i=1}^n$, $\\int_0^{\\infty}$\n\n% Tensor notation\n$T_{\\mu\\nu}^{\\rho\\sigma}$\n\n\\end{document}"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-latex-mathematics-subscripts-superscripts-15/page-1.svg" alt="Compiled PDF page 1 from combined-sub-super.tex" caption="Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={595.276} height={841.89} />
</RenderedOutput>

<Card title="Expected output" icon="eye">
  **Both subscript and superscript:** $x_1^2$, $a_n^m$, $x_i^{j+1}$

  **Order doesn't matter:** $x_1^2 = x^2_1$

  **Complex combinations:** $x_{n+1}^{2m}$, $a_{ij}^{kl}$

  **With operators:** $\displaystyle\sum_{i=1}^n$, $\displaystyle\int_0^{\infty}$

  **Tensor notation:** $T_{\mu\nu}^{\rho\sigma}$
</Card>

### Nested Subscripts and Superscripts

<LatexSource filename="nested-sub-super.tex" source={"\\documentclass{article}\n\\usepackage{amsmath}\n\\begin{document}\n\n% Nested superscripts\n$x^{2^n}$, $e^{x^2}$, $2^{2^{2^2}}$\n\n% Nested subscripts\n$x_{i_j}$, $a_{n_{k+1}}$\n\n% Mixed nesting\n$x_i^{j^k}$, $a_{m_n}^{p^q}$\n\n% Using additional braces for clarity\n${(x^2)}^3 = x^6$\n\n% Tower notation\n$2^{2^{2^{\\cdot^{\\cdot^{\\cdot}}}}}$\n\n\\end{document}"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-latex-mathematics-subscripts-superscripts-16/page-1.svg" alt="Compiled PDF page 1 from nested-sub-super.tex" caption="Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={595.276} height={841.89} />
</RenderedOutput>

The preview demonstrates every nesting pattern from the source in one compiled page. Prefer
the shallowest notation that communicates the structure, and add braces explicitly at each
level so the grouping remains readable and maintainable.

## Special Use Cases

### Limits and Operators

<LatexSource filename="limits-operators.tex" source={"\\documentclass{article}\n\\usepackage{amsmath}\n\\begin{document}\n\n% Inline limits\n$\\lim_{x \\to 0} f(x)$\n\n% Display style limits\n\\[\\lim_{x \\to \\infty} \\frac{1}{x} = 0\\]\n\n% Summation\n\\[\\sum_{i=1}^{n} i = \\frac{n(n+1)}{2}\\]\n\n% Product\n\\[\\prod_{k=1}^{n} k = n!\\]\n\n% Integration\n\\[\\int_0^1 x^2 \\, dx = \\frac{1}{3}\\]\n\n% Multiple limits\n\\[\\lim_{\\substack{x \\to 0 \\\\ y \\to 0}} f(x,y)\\]\n\n\\end{document}"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-latex-mathematics-subscripts-superscripts-17/page-1.svg" alt="Compiled PDF page 1 from limits-operators.tex" caption="Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={595.276} height={841.89} />
</RenderedOutput>

The compiled result above shows the important layout difference: inline limits keep their
condition beside the operator, while display-style limits, sums, products, integrals, and
multi-line conditions place their scripts in the conventional display positions. Use the
source and preview together to compare the exact input with the typeset result.

### Chemical Formulas

<LatexSource filename="chemical-formulas.tex" source={"\\documentclass{article}\n\\usepackage{amsmath}\n\\usepackage{mhchem} % Better chemistry support\n\\begin{document}\n\n% Basic chemical formulas\n$\\mathrm{H_2O}$, $\\mathrm{CO_2}$, $\\mathrm{H_2SO_4}$\n\n% Isotopes\n$^{14}\\mathrm{C}$, $^{235}\\mathrm{U}$, $^2\\mathrm{H}$\n\n% Ions\n$\\mathrm{Na^+}$, $\\mathrm{Cl^-}$, $\\mathrm{SO_4^{2-}}$\n\n% With mhchem package (recommended)\n\\ce{H2O}, \\ce{CO2}, \\ce{H2SO4}\n\\ce{^{14}C}, \\ce{Na+}, \\ce{SO4^{2-}}\n\n% Chemical equations\n\\ce{2H2 + O2 -> 2H2O}\n\n\\end{document}"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-latex-mathematics-subscripts-superscripts-18/page-1.svg" alt="Compiled PDF page 1 from chemical-formulas.tex" caption="Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={612} height={792} />
</RenderedOutput>

<Card title="Expected output" icon="eye">
  **Basic chemical formulas:** $\mathrm{H_2O}$, $\mathrm{CO_2}$, $\mathrm{H_2SO_4}$

  **Isotopes:** $^{14}\mathrm{C}$, $^{235}\mathrm{U}$, $^{2}\mathrm{H}$

  **Ions:** $\mathrm{Na^+}$, $\mathrm{Cl^-}$, $\mathrm{SO_4^{2-}}$

  **Chemical equation:** $2\mathrm{H_2} + \mathrm{O_2} \rightarrow 2\mathrm{H_2O}$
</Card>

### Physics and Engineering Notation

<LatexSource filename="physics-notation.tex" source={"\\documentclass{article}\n\\usepackage{amsmath}\n\\usepackage{tensor} % For tensor notation\n\\begin{document}\n\n% Vector components\n$\\vec{v} = v_x\\hat{i} + v_y\\hat{j} + v_z\\hat{k}$\n\n% Derivatives\n$\\frac{d^2y}{dx^2}$, $\\frac{\\partial^2 f}{\\partial x^2}$\n\n% Tensors\n$g_{\\mu\\nu}$, $R^{\\alpha}_{\\beta\\gamma\\delta}$\n\n% Four-vectors\n$x^\\mu = (ct, x, y, z)$\n\n% Christoffel symbols\n$\\Gamma^{\\lambda}_{\\mu\\nu}$\n\n% Units\n$10^{-9}\\,\\mathrm{m}$, $3.0 \\times 10^8\\,\\mathrm{m/s}$\n\n\\end{document}"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-latex-mathematics-subscripts-superscripts-19/page-1.svg" alt="Compiled PDF page 1 from physics-notation.tex" caption="Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={595.276} height={841.89} />
</RenderedOutput>

<Card title="Expected output" icon="eye">
  **Vector components:** $\vec{v} = v_x\hat{i} + v_y\hat{j} + v_z\hat{k}$

  **Derivatives:** $\frac{d^2y}{dx^2}$, $\frac{\partial^2 f}{\partial x^2}$

  **Tensors:** $g_{\mu\nu}$, $R^{\alpha}_{\beta\gamma\delta}$

  **Four-vectors:** $x^\mu = (ct, x, y, z)$

  **Christoffel symbols:** $\Gamma^{\lambda}_{\mu\nu}$

  **Units:** $10^{-9}\,\mathrm{m}$, $3.0 \times 10^8\,\mathrm{m/s}$
</Card>

## Advanced Techniques

### Primes and Multiple Primes

<LatexSource filename="primes.tex" source={"\\documentclass{article}\n\\usepackage{amsmath}\n\\begin{document}\n\n% Single prime\n$f'(x)$, $y'$\n\n% Multiple primes\n$f''(x)$, $f'''(x)$\n\n% Alternative notation\n$f^{\\prime}(x)$, $f^{\\prime\\prime}(x)$\n\n% With subscripts\n$x'_1$, $x''_n$\n\n% Prime on subscript\n$x_{n'}$, $x_{n''}$\n\n\\end{document}"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-latex-mathematics-subscripts-superscripts-20/page-1.svg" alt="Compiled PDF page 1 from primes.tex" caption="Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={595.276} height={841.89} />
</RenderedOutput>

<Card title="Expected output" icon="eye">
  **Single prime:** $f'(x)$, $y'$

  **Multiple primes:** $f''(x)$, $f'''(x)$

  **Alternative notation:** $f^{\prime}(x)$, $f^{\prime\prime}(x)$

  **With subscripts:** $x'_1$, $x''_n$

  **Prime on subscript:** $x_{n'}$, $x_{n''}$
</Card>

### Positioning and Spacing

<LatexSource filename="positioning.tex" source={"\\documentclass{article}\n\\usepackage{amsmath}\n\\begin{document}\n\n% Pre-subscripts and superscripts\n${}_a^b X_c^d$\n\n% Tensor notation with prescript package\n\\usepackage{tensor}\n\\tensor[^a_b]{X}{_c^d}\n\n% Manual spacing adjustments\n$x_{\\!n}$ % negative thin space\n$x_{\\,n}$ % thin space\n$x_{\\:n}$ % medium space\n$x_{\\;n}$ % thick space\n\n% Phantom subscripts for alignment\n\\begin{align}\nx_1 &= a \\\\\nx_{\\phantom{1}2} &= b\n\\end{align}\n\n\\end{document}"} />

<RenderedOutput title="Expected effect">
  <Info>
    This is document setup or preamble code. It changes the behavior of a containing document but does not produce an honest standalone page by itself.
  </Info>
</RenderedOutput>

### Accents with Sub/Superscripts

<LatexSource filename="accents-sub-super.tex" source={"\\documentclass{article}\n\\usepackage{amsmath}\n\\begin{document}\n\n% Accents with subscripts\n$\\hat{x}_i$, $\\tilde{y}_n$, $\\bar{z}_k$\n\n% Accents with superscripts\n$\\hat{x}^2$, $\\vec{v}^T$, $\\dot{x}^n$\n\n% Combined\n$\\hat{x}_i^2$, $\\tilde{\\phi}_{nm}^{kl}$\n\n% Wide accents\n$\\widehat{xyz}_1^2$, $\\widetilde{ABC}_{ij}$\n\n\\end{document}"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-latex-mathematics-subscripts-superscripts-22/page-1.svg" alt="Compiled PDF page 1 from accents-sub-super.tex" caption="Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={595.276} height={841.89} />
</RenderedOutput>

<Card title="Expected output" icon="eye">
  **Accents with subscripts:** $\hat{x}_i$, $\tilde{y}_n$, $\bar{z}_k$

  **Accents with superscripts:** $\hat{x}^2$, $\vec{v}^T$, $\dot{x}^n$

  **Combined:** $\hat{x}_i^2$, $\tilde{\phi}_{nm}^{kl}$

  **Wide accents:** $\widehat{xyz}_1^2$, $\widetilde{ABC}_{ij}$
</Card>

## Text Mode Subscripts and Superscripts

<LatexSource filename="text-mode.tex" source={"\\documentclass{article}\n\\usepackage{fixltx2e} % For \\textsubscript\n\\begin{document}\n\n% In text mode\nH\\textsubscript{2}O is water.\nE = mc\\textsuperscript{2} is Einstein's equation.\n\n% Or use math mode\nH$_2$O is water.\nE = mc$^2$ is Einstein's equation.\n\n% Ordinals\n1\\textsuperscript{st}, 2\\textsuperscript{nd}, 3\\textsuperscript{rd}\n\n% Footnote markers\nText\\textsuperscript{a}, Reference\\textsuperscript{1}\n\n\\end{document}"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-latex-mathematics-subscripts-superscripts-23/page-1.svg" alt="Compiled PDF page 1 from text-mode.tex" caption="Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={595.276} height={841.89} />
</RenderedOutput>

<Card title="Expected output" icon="eye">
  **In text mode:** H$_2$O is water. E = mc$^2$ is Einstein's equation.

  **Ordinals:** 1$^{\text{st}}$, 2$^{\text{nd}}$, 3$^{\text{rd}}$

  **Footnote markers:** Text$^{\text{a}}$, Reference$^1$
</Card>

## Common Errors and Solutions

<Accordion title="Error: Double subscript">
  **Problem**: `x_a_b` causes "Double subscript" error.

  **Solution**: Use braces to clarify structure:

  <LatexSource filename="example.tex" source={"x_{a_b}    % a with subscript b, all subscript to x\nx_a{}_{b}  % separate subscripts a and b"} />

  <RenderedOutput title="Rendered output">
    <LatexPreview src="/images/rendered/learn-latex-mathematics-subscripts-superscripts-24/page-1.svg" alt="Compiled PDF page 1 from example.tex" caption="Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment. The visible fragment is compiled inside the documented minimal article wrapper." width={595.276} height={841.89} />
  </RenderedOutput>
</Accordion>

<Accordion title="Only first character is sub/superscript">
  **Problem**: `x_12` shows as x₁2 instead of x₁₂.

  **Solution**: Always use braces for multiple characters:

  <LatexSource filename="example.tex" source={"x_{12}     % Correct\nx_12       % Wrong"} />

  <RenderedOutput title="Rendered output">
    <LatexPreview src="/images/rendered/learn-latex-mathematics-subscripts-superscripts-25/page-1.svg" alt="Compiled PDF page 1 from example.tex" caption="Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment. The visible fragment is compiled inside the documented minimal article wrapper." width={595.276} height={841.89} />
  </RenderedOutput>
</Accordion>

<Accordion title="Subscripts in limit are inline">
  **Problem**: Limits appear cramped in inline math.

  **Solution**: Use display style or `\limits`:

  <LatexSource filename="example.tex" source={"$\\lim\\limits_{x \\to 0}$     % Forces display style\n\\[\\lim_{x \\to 0}\\]          % Use display math"} />

  <RenderedOutput title="Rendered output">
    <LatexPreview src="/images/rendered/learn-latex-mathematics-subscripts-superscripts-26/page-1.svg" alt="Compiled PDF page 1 from example.tex" caption="Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment. The visible fragment is compiled inside the documented minimal article wrapper." width={595.276} height={841.89} />
  </RenderedOutput>
</Accordion>

<Accordion title="Prime notation conflicts">
  **Problem**: `x'^2` doesn't work as expected.

  **Solution**: Use proper grouping:

  <LatexSource filename="example.tex" source={"{x'}^2     % Correct\nx'^2       % May cause issues\nx^{\\prime 2}  % Alternative"} />

  <RenderedOutput title="Rendered output">
    <LatexPreview src="/images/rendered/learn-latex-mathematics-subscripts-superscripts-27/page-1.svg" alt="Compiled PDF page 1 from example.tex" caption="Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment. The visible fragment is compiled inside the documented minimal article wrapper." width={595.276} height={841.89} />
  </RenderedOutput>
</Accordion>

## Best Practices

### 1. Readability Guidelines

<Tip>
  **Good Practices:**

  * Use meaningful subscripts: `v_x` not `v_1` for x-component
  * Avoid deep nesting: `x_{i_j}` is okay, deeper is confusing
  * Be consistent: If using `i,j,k` for indices, stick to it
  * Use semantic notation: `\max` not `max`
</Tip>

<Warning>
  **Poor Practices to Avoid:**

  * Overusing sub/superscripts: `x_{a_{b_{c_{d}}}}`
  * Mixing notation styles in same document
  * Using subscripts for non-mathematical text
  * Forgetting braces: `x_min` instead of `x_{min}`
</Warning>

### 2. Consistency Rules

* **Indices**: Use consistent letters (i, j, k or m, n, p)
* **Coordinates**: Be consistent (x, y, z or r, θ, φ)
* **Time derivatives**: Choose notation and stick to it (ẋ or dx/dt)
* **Vector components**: Consistent notation (subscripts or superscripts)

### 3. Special Notation Standards

<LatexSource filename="standard-notations.tex" source={"% Tensors - superscripts before subscripts\n$T^{\\mu\\nu}_{\\rho\\sigma}$  % Correct\n$T_{\\rho\\sigma}^{\\mu\\nu}$  % Less standard\n\n% Derivatives - use consistent notation\n$\\frac{\\partial^2 f}{\\partial x^2}$  % Standard\n$f_{xx}$                              % Alternative\n\n% Units - use upright text\n$10^{-3}\\,\\mathrm{m}$     % Correct\n$10^{-3}\\,m$              % Wrong (italic m)"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-latex-mathematics-subscripts-superscripts-28/page-1.svg" alt="Compiled PDF page 1 from standard-notations.tex" caption="Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment. The visible fragment is compiled inside the documented minimal article wrapper." width={595.276} height={841.89} />
</RenderedOutput>

### 4. Accessibility Considerations

* Avoid excessive nesting that's hard to read
* Use `\text{}` for words in subscripts: `x_{\text{max}}`
* Consider alternative notations for complex expressions
* Break very complex expressions into parts

## Quick Reference Card

| Command               | Result                        | Description                    |
| --------------------- | ----------------------------- | ------------------------------ |
| `x_1`                 | $x_1$                         | Single subscript               |
| `x^2`                 | $x^2$                         | Single superscript             |
| `x_{12}`              | $x_{12}$                      | Multiple character subscript   |
| `x^{2n}`              | $x^{2n}$                      | Multiple character superscript |
| `x_i^j`               | $x_i^j$                       | Combined sub/superscript       |
| `\sum_{i=1}^n`        | $\displaystyle\sum_{i=1}^n$   | Summation limits               |
| `\lim_{x \to 0}`      | $\displaystyle\lim_{x \to 0}$ | Limit notation                 |
| `f'(x)`               | $f'(x)$                       | Prime notation                 |
| `{}_{a}^{b}X_{c}^{d}` | ${}_a^b X_c^d$                | Pre-superscript/subscript      |
| `\textsubscript{2}`   | H$_2$O                        | Text mode subscript            |
| `^{14}\mathrm{C}`     | $^{14}\mathrm{C}$             | Isotope notation               |
| `T^{\mu\nu}_{\rho}`   | $T^{\mu\nu}_{\rho}$           | Tensor notation                |

## Related Topics

<CardGroup cols={2}>
  <Card title="Mathematical Expressions" icon="calculator" href="/learn/latex/mathematics/mathematical-expressions">
    Basic math mode and LaTeX subscript expressions
  </Card>

  <Card title="Equations Guide" icon="equals" href="/learn/latex/mathematics/equations">
    Multi-line and numbered equations
  </Card>

  <Card title="Matrices & Arrays" icon="table-cells" href="/learn/latex/mathematics/matrices">
    Matrix notation with subscript indices
  </Card>

  <Card title="LaTeX Symbols Reference" icon="list" href="/learn/reference/symbols">
    Complete symbol reference for subscripts
  </Card>

  <Card title="Chemistry Notation" icon="flask" href="/learn/latex/specialized-notation/chemistry">
    Chemical formula subscript notation
  </Card>

  <Card title="Physics Notation" icon="atom" href="/learn/latex/specialized-notation/physics">
    Physics symbols and tensor notation
  </Card>
</CardGroup>

## Further Reading & References

For authoritative documentation on LaTeX subscript and superscript handling:

* **amsmath Package Documentation** - The standard package for advanced mathematical notation, including enhanced subscript positioning
* **The LaTeX Companion (3rd Edition)** - Comprehensive reference for mathematical typesetting best practices
* **ISO 80000-2** - International standard for mathematical notation in scientific documents

## Try Subscripts and Superscripts

<CardGroup cols={2}>
  <Card title="Open a math example" icon="cloud" href="https://app.latex-cloud-studio.com/?utm_source=resources&utm_medium=card&utm_campaign=docs_open_app&utm_content=subscripts_open_app">
    Paste the examples into a project and compile them to check braces, combined indices, and common error fixes.
  </Card>

  <Card title="See the online LaTeX editor" icon="arrow-up-right-from-square" href="https://www.latex-cloud-studio.com/online-latex-editor?utm_source=resources&utm_medium=related_product&utm_campaign=docs_to_website&utm_content=subscripts_online_editor">
    Review the browser editor workflow before starting a math-heavy document.
  </Card>
</CardGroup>
