> ## 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.

# LaTeX Brackets: \left, \right, Curly Braces, and Sizing

> Write parentheses, square brackets, and curly braces in LaTeX. Use \left and \right for automatic sizing or \big for manual control.

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>;
};

Write ordinary LaTeX brackets directly as `( )` or `[ ]`, but escape curly braces as `\{ \}` because unescaped braces group source code. For fractions, matrices, or other tall expressions, wrap the pair with `\left` and `\right`; use `\big`, `\Big`, `\bigg`, or `\Bigg` when both sides need a fixed size.

<Info>
  **Quick answer**: `\left( \frac{a}{b} \right)` produces parentheses that grow with the fraction. Every `\left` needs a matching `\right`; use an invisible `\left.` or `\right.` when only one side should be visible.

  **Prerequisites**: Basic LaTeX math mode knowledge. See [Mathematical Expressions](/learn/latex/mathematics/mathematical-expressions) for math mode basics.
</Info>

## Quick answers

| If you need...               | Use                                    |
| ---------------------------- | -------------------------------------- |
| Ordinary parentheses         | `(a+b)`                                |
| Square brackets              | `[a,b]`                                |
| Curly braces in math mode    | `\{x \in A\}`                          |
| Angle brackets               | `\langle u, v \rangle`                 |
| Automatically sized brackets | `\left( \frac{a}{b} \right)`           |
| Manually larger brackets     | `\big( ... \big)` or `\Big( ... \Big)` |
| One visible delimiter only   | `\left.` or `\right.`                  |

## Types of Brackets and Delimiters

### Complete Visual Reference

| Type            | LaTeX Code        | Output               | Common Use        |
| --------------- | ----------------- | -------------------- | ----------------- |
| Parentheses     | `( )`             | $( \, )$             | General grouping  |
| Square brackets | `[ ]`             | $[ \, ]$             | Arrays, intervals |
| Curly braces    | `\{ \}`           | $\{ \, \}$           | Sets, systems     |
| Angle brackets  | `\langle \rangle` | $\langle \, \rangle$ | Inner products    |
| Vertical bars   | `\|` or `\vert`   | $\lvert \, \rvert$   | Absolute value    |
| Double bars     | `\|\|` or `\Vert` | $\lVert \, \rVert$   | Norms             |
| Floor           | `\lfloor \rfloor` | $\lfloor \, \rfloor$ | Floor function    |
| Ceiling         | `\lceil \rceil`   | $\lceil \, \rceil$   | Ceiling function  |

### Basic Examples

<LatexSource filename="basic-brackets.tex" source={"\\documentclass{article}\n\\usepackage{amsmath}\n\\begin{document}\n\n% Parentheses\n$(a + b)$\n\n% Square brackets  \n$[x, y]$\n\n% Curly braces (must be escaped)\n$\\{z : z > 0\\}$\n\n% Angle brackets\n$\\langle u, v \\rangle$\n\n% Absolute value\n$|x - y|$\n\n% Norm\n$\\|v\\|$\n\n% Floor and ceiling\n$\\lfloor x \\rfloor$ and $\\lceil x \\rceil$\n\n\\end{document}"} />

<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_brackets_parentheses">
  <LatexPreview src="/images/rendered/learn-latex-mathematics-brackets-parentheses-01/page-1.svg" alt="Compiled PDF page 1 from basic-brackets.tex" caption="Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={595.276} height={841.89} />
</RenderedOutput>

## Automatic Delimiter Sizing

### The `\left` and `\right` Commands

LaTeX can automatically size delimiters to match their content using `\left` and `\right`:

<LatexSource filename="auto-sizing.tex" source={"\\documentclass{article}\n\\usepackage{amsmath}\n\\begin{document}\n\n% Without automatic sizing\n$(\\frac{1}{2})$\n\n% With automatic sizing\n$\\left(\\frac{1}{2}\\right)$\n\n% Works with any delimiter type\n$\\left[\\frac{x^2}{y}\\right]$\n\n$\\left\\{\\sqrt{\\frac{a}{b}}\\right\\}$\n\n$\\left|\\sum_{i=1}^n x_i\\right|$\n\n% Nested fractions\n$\\left(\\frac{\\frac{a}{b}}{\\frac{c}{d}}\\right)$\n\n\\end{document}"} />

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

### Important Rules for `\left` and `\right`

<Warning>
  **Critical**: Every `\left` must have a matching `\right` in the same math environment. They must be balanced like opening and closing HTML tags.
</Warning>

#### Invisible Delimiters

Sometimes you need an invisible delimiter to balance the equation:

<LatexSource filename="invisible-delimiters.tex" source={"% Using \\right. for invisible right delimiter\n$\\left\\{\\begin{array}{ll}\nx + y = 1 \\\\\nx - y = 0\n\\end{array}\\right.$\n\n% Using \\left. for invisible left delimiter\n$\\left.\\frac{dy}{dx}\\right|_{x=0}$"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-latex-mathematics-brackets-parentheses-03/page-1.svg" alt="Compiled PDF page 1 from invisible-delimiters.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>

## Manual Size Control

### Size Commands

When automatic sizing doesn't give the desired result, use manual size commands:

<Info>
  **Delimiter Size Commands (smallest to largest):**

  | Command | Size                   |
  | ------- | ---------------------- |
  | `\big`  | 50% larger than normal |
  | `\Big`  | 2× normal size         |
  | `\bigg` | 2.5× normal size       |
  | `\Bigg` | 3× normal size         |
</Info>

### Size Comparison

<LatexSource filename="size-comparison.tex" source={"\\documentclass{article}\n\\usepackage{amsmath}\n\\begin{document}\n\n% Normal size\n$( \\frac{1}{2} )$\n\n% \\big\n$\\big( \\frac{1}{2} \\big)$\n\n% \\Big\n$\\Big( \\frac{1}{2} \\Big)$\n\n% \\bigg\n$\\bigg( \\frac{1}{2} \\bigg)$\n\n% \\Bigg\n$\\Bigg( \\frac{1}{2} \\Bigg)$\n\n% For opening and closing separately\n$\\bigl( x \\bigr)$  % 'l' for left, 'r' for right\n\n\\end{document}"} />

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

### Left and Right Variants

<Tip>
  Use `l` and `r` suffixes for proper spacing: `\bigl(`, `\bigr)`, `\Bigl[`, `\Bigr]`, etc. This ensures correct spacing around the delimiters.
</Tip>

## Advanced Techniques

### Nested Brackets

<LatexSource filename="nested-brackets.tex" source={"\\documentclass{article}\n\\usepackage{amsmath}\n\\begin{document}\n\n% Poor: all brackets same size\n$[1 + [2 + [3 + 4]]]$\n\n% Better: graduated sizes\n$\\Big[1 + \\big[2 + [3 + 4]\\big]\\Big]$\n\n% Best: automatic sizing\n$\\left[1 + \\left[2 + \\left[3 + 4\\right]\\right]\\right]$\n\n% Complex nesting\n$\\left\\{x : \\left[a + \\left(\\frac{b}{c}\\right)\\right] > 0\\right\\}$\n\n\\end{document}"} />

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

### Multi-line Equations with Brackets

For equations that span multiple lines, you need special handling:

<LatexSource filename="multiline-brackets.tex" source={"\\documentclass{article}\n\\usepackage{amsmath}\n\\begin{document}\n\n% Using \\right. and \\left. for invisible delimiters\n\\begin{align}\nf(x) = & \\left[ x^2 + 2x \\right. \\\\\n       & \\left. + 1 \\right]\n\\end{align}\n\n% Alternative using \\big commands\n\\begin{align}\ng(x) = & \\Big[ x^3 + 3x^2 \\\\\n       & \\phantom{\\Big[} + 3x + 1 \\Big]\n\\end{align}\n\n% For cases/piecewise functions\n\\begin{equation}\nf(x) = \\begin{cases}\nx^2 & \\text{if } x \\geq 0 \\\\\n-x^2 & \\text{if } x < 0\n\\end{cases}\n\\end{equation}\n\n\\end{document}"} />

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

### Matrix Delimiters

<LatexSource filename="matrix-delimiters.tex" source={"\\documentclass{article}\n\\usepackage{amsmath}\n\\begin{document}\n\n% Different matrix environments\n$\\begin{pmatrix}  % parentheses\na & b \\\\\nc & d\n\\end{pmatrix}$\n\n$\\begin{bmatrix}  % brackets\na & b \\\\\nc & d\n\\end{bmatrix}$\n\n$\\begin{Bmatrix}  % braces\na & b \\\\\nc & d\n\\end{Bmatrix}$\n\n$\\begin{vmatrix}  % vertical bars\na & b \\\\\nc & d\n\\end{vmatrix}$\n\n$\\begin{Vmatrix}  % double bars\na & b \\\\\nc & d\n\\end{Vmatrix}$\n\n\\end{document}"} />

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

## Special Use Cases

### Set Notation

<LatexSource filename="set-notation.tex" source={"\\documentclass{article}\n\\usepackage{amsmath}\n\\usepackage{amssymb}\n\\begin{document}\n\n% Basic set\n$A = \\{1, 2, 3, 4, 5\\}$\n\n% Set builder notation\n$B = \\{x \\in \\mathbb{R} : x^2 < 4\\}$\n\n% Set with conditions\n$C = \\left\\{x \\in \\mathbb{Z} : \\begin{array}{l}\nx > 0 \\\\\nx \\text{ is even}\n\\end{array}\\right\\}$\n\n% Empty set\n$\\emptyset = \\{\\}$\n\n\\end{document}"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-latex-mathematics-brackets-parentheses-08/page-1.svg" alt="Compiled PDF page 1 from set-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>

### Interval Notation

<LatexSource filename="intervals.tex" source={"\\documentclass{article}\n\\usepackage{amsmath}\n\\begin{document}\n\n% Open interval\n$(a, b)$\n\n% Closed interval\n$[a, b]$\n\n% Half-open intervals\n$[a, b)$ and $(a, b]$\n\n% Infinite intervals\n$(-\\infty, a]$ and $[b, \\infty)$\n\n% Union of intervals\n$[0, 1] \\cup [2, 3]$\n\n\\end{document}"} />

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

### Physics and Engineering

<LatexSource filename="physics-brackets.tex" source={"\\documentclass{article}\n\\usepackage{amsmath}\n\\usepackage{physics} % provides \\bra, \\ket, \\braket\n\\begin{document}\n\n% Quantum mechanics bra-ket notation\n$\\langle \\psi | \\phi \\rangle$\n\n% With physics package\n$\\bra{\\psi}\\ket{\\phi}$\n$\\braket{\\psi|\\phi}$\n\n% Commutator\n$[A, B] = AB - BA$\n\n% Anticommutator\n$\\{A, B\\} = AB + BA$\n\n% Poisson bracket\n$\\{f, g\\} = \\sum_i \\left(\\frac{\\partial f}{\\partial q_i}\\frac{\\partial g}{\\partial p_i} - \\frac{\\partial f}{\\partial p_i}\\frac{\\partial g}{\\partial q_i}\\right)$\n\n\\end{document}"} />

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

## Common Errors and Solutions

<Accordion title="Error: Missing \right. inserted">
  **Problem**: Every `\left` needs a matching `\right`, even across line breaks.

  **Solution**: Use `\right.` for an invisible right delimiter:

  <LatexSource filename="example.tex" source={"\\left[ x + y \\right.  % End of first line\n\\left. + z \\right]    % Start of second line"} />

  <RenderedOutput title="Rendered output">
    <LatexPreview src="/images/rendered/learn-latex-mathematics-brackets-parentheses-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>
</Accordion>

<Accordion title="Brackets too large with \left...\right">
  **Problem**: Automatic sizing makes brackets unnecessarily large.

  **Solution**: Use manual sizing instead:

  <LatexSource filename="example.tex" source={"% Instead of\n$\\left( \\sum_{i=1}^n x_i \\right)$\n\n% Use\n$\\bigg( \\sum_{i=1}^n x_i \\bigg)$"} />

  <RenderedOutput title="Rendered output">
    <LatexPreview src="/images/rendered/learn-latex-mathematics-brackets-parentheses-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>
</Accordion>

<Accordion title="Curly braces not showing">
  **Problem**: `{` and `}` have special meaning in LaTeX.

  **Solution**: Escape them with backslash:

  <LatexSource filename="example.tex" source={"$\\{ x : x > 0 \\}$  % Correct\n${ x : x > 0 }$    % Wrong - braces disappear"} />

  <RenderedOutput title="Rendered output">
    <LatexPreview src="/images/rendered/learn-latex-mathematics-brackets-parentheses-13/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="Mismatched bracket sizes in aligned equations">
  **Problem**: Brackets don't match across aligned lines.

  **Solution**: Use phantom brackets:

  <LatexSource filename="example.tex" source={"\\begin{align}\nf(x) = & \\Big[ x^2 + 2x \\\\\n       & \\phantom{\\Big[} + 1 \\Big]\n\\end{align}"} />

  <RenderedOutput title="Rendered output">
    <LatexPreview src="/images/rendered/learn-latex-mathematics-brackets-parentheses-14/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. Choose the Right Delimiter

<Tip>
  **Good Delimiter Choices:**

  * **Parentheses**: General grouping, function arguments
  * **Square brackets**: Matrices, commutators, intervals
  * **Curly braces**: Sets, systems of equations
  * **Angle brackets**: Inner products, averages
  * **Vertical bars**: Absolute values, determinants, norms
</Tip>

### 2. Sizing Guidelines

* Use `\left...\right` for **complex expressions** with varying heights
* Use manual sizing (`\big`, `\Big`, etc.) for **simple expressions**
* Be consistent within the same document
* Don't oversize—readability is key

### 3. Spacing Considerations

<LatexSource filename="spacing-examples.tex" source={"% Good spacing with \\bigl and \\bigr\n$\\bigl( x + y \\bigr)$\n\n% Poor spacing with just \\big\n$\\big( x + y \\big)$\n\n% For better spacing around bars\n$\\left\\lvert x \\right\\rvert$  % Better than |x|"} />

<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>

### 4. Semantic Markup

Use meaningful commands when available:

<LatexSource filename="semantic-markup.tex" source={"% Instead of manual brackets\n$|| v ||$\n\n% Use semantic commands\n$\\lVert v \\rVert$      % Double bars for norm\n$\\lvert x \\rvert$      % Single bars for absolute value\n$\\langle u, v \\rangle$ % Angle brackets for inner product"} />

<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>

## Quick Reference Card

| Category        | Commands                     | Result                     |
| --------------- | ---------------------------- | -------------------------- |
| Parentheses     | `( )`                        | $(x)$                      |
| Square brackets | `[ ]`                        | $[x]$                      |
| Curly braces    | `\{ \}`                      | $\{x\}$                    |
| Angle brackets  | `\langle \rangle`            | $\langle x \rangle$        |
| Vertical bars   | `\|` or `\vert`              | $\lvert x \rvert$          |
| Double bars     | `\|\|` or `\Vert`            | $\lVert x \rVert$          |
| Floor           | `\lfloor \rfloor`            | $\lfloor x \rfloor$        |
| Ceiling         | `\lceil \rceil`              | $\lceil x \rceil$          |
| Auto sizing     | `\left( \frac{1}{2} \right)` | $\left(\frac{1}{2}\right)$ |
| Manual sizing   | `\Big( x \Big)`              | $\Big( x \Big)$            |

## Practice in LaTeX Cloud Studio

<CardGroup cols={2}>
  <Card title="Try bracket sizing in the editor" icon="cloud" href="https://app.latex-cloud-studio.com/?utm_source=resources&utm_medium=card&utm_campaign=docs_open_app&utm_content=brackets_parentheses_open_app">
    Test `\left`, `\right`, `\lvert`, and `\lVert` in a live document without leaving the browser.
  </Card>

  <Card title="Write a first project" icon="file-text" href="/learn/latex/how-to/first-project?utm_source=resources&utm_medium=related_guide&utm_campaign=docs_open_app&utm_content=brackets_parentheses_first_project">
    Move from isolated syntax examples to a full document workflow.
  </Card>
</CardGroup>

## Related Topics

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

  <Card title="Matrices Guide" icon="table-cells" href="/learn/latex/mathematics/matrices">
    Complete guide to matrices and arrays
  </Card>

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

  <Card title="Math Symbols" icon="sigma" href="/learn/latex/mathematics/symbols">
    Comprehensive symbol reference
  </Card>
</CardGroup>

<Warning>
  **LaTeX Cloud Studio** automatically handles package loading! The `amsmath` package is pre-loaded, so all bracket commands work immediately without manual package management.
</Warning>
