> ## 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 Paragraph Spacing: \parskip, \parindent, \vspace, and line spacing

> Control paragraph spacing in LaTeX with \parskip, \parindent, \vspace, and setspace. Includes the common fixes for extra space and missing indents.

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

Use `\parskip` to add space between paragraphs, `\parindent` to control the first-line indent, and `\vspace` for one-off vertical gaps. This guide focuses on those common spacing tasks first, then covers line spacing, list spacing, section spacing, and troubleshooting.

<Info>
  **Quick answer**: most paragraph-spacing changes come down to `\setlength{\parskip}{...}`, `\setlength{\parindent}{...}`, `\noindent`, and `\vspace{...}`. Use page-level settings for consistent layout, and use `\vspace` only for local adjustments.
</Info>

## Quick fixes for common spacing tasks

| If you need...                  | Use                                           | Notes                                                     |
| ------------------------------- | --------------------------------------------- | --------------------------------------------------------- |
| Space between paragraphs        | `\setlength{\parskip}{1em}`                   | Applies to the whole document or current group            |
| No first-line indent            | `\setlength{\parindent}{0pt}`                 | Common when `\parskip` is non-zero                        |
| Remove indent for one paragraph | `\noindent`                                   | Local change only                                         |
| Add a one-off vertical gap      | `\vspace{1em}`                                | Best for local layout fixes, not global paragraph spacing |
| Change line spacing             | `\usepackage{setspace}` and `\onehalfspacing` | Better than manual `\baselineskip` changes in most cases  |

## Quick Start

<LatexSource filename="paragraph-spacing-quickstart.tex" source={"\\documentclass{article}\n\\usepackage{setspace}\n\n\\setlength{\\parskip}{0.75em}\n\\setlength{\\parindent}{0pt}\n\n\\begin{document}\n\nFirst paragraph.\n\nSecond paragraph with space above it.\n\n\\onehalfspacing\nThis paragraph uses wider line spacing.\n\n\\vspace{1em}\nThis line has an extra local gap above it.\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_paragraphs_spacing">
  <LatexPreview src="/images/rendered/learn-latex-paragraphs-spacing-01/page-1.svg" alt="Compiled PDF page 1 from paragraph-spacing-quickstart.tex" caption="Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={595.276} height={841.89} />
</RenderedOutput>

## Paragraph Spacing Basics

### Default Behavior

LaTeX's default paragraph handling:

* First line indented
* No extra space between paragraphs
* Justified text alignment

<LatexSource filename="default-paragraphs.tex" source={"\\documentclass{article}\n\\begin{document}\n\nThis is the first paragraph. It demonstrates LaTeX's default\nformatting with first-line indentation and no extra spacing\nbetween paragraphs.\n\nThis is the second paragraph. Notice how it starts with an\nindent but has no extra vertical space separating it from\nthe previous paragraph.\n\n\\end{document}"} />

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

### Controlling Paragraph Spacing

<LatexSource filename="paragraph-spacing.tex" source={"\\documentclass{article}\n\n% Add space between paragraphs\n\\setlength{\\parskip}{1em}\n\n% Remove first-line indent\n\\setlength{\\parindent}{0pt}\n\n\\begin{document}\n\nThis paragraph has no indentation and is followed by extra space.\n\nThis paragraph also has no indentation. The space between\nparagraphs makes the document structure clearer.\n\n% Temporarily change spacing\n{\\setlength{\\parskip}{2em}\nThese paragraphs have even more space between them.\n\nSee how the larger gap creates stronger visual separation.\n}\n\nBack to normal spacing here.\n\n\\end{document}"} />

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

## Line Spacing

### Basic Line Spacing Commands

<LatexSource filename="line-spacing.tex" source={"\\documentclass{article}\n\\usepackage{setspace}\n\\begin{document}\n\n% Single spacing (default)\n\\singlespacing\nThis text uses single spacing, which is the LaTeX default.\n\n% One and a half spacing\n\\onehalfspacing\nThis text uses one-and-a-half spacing, providing more space\nbetween lines for better readability.\n\n% Double spacing\n\\doublespacing\nThis text uses double spacing, often required for academic\nmanuscripts and drafts.\n\n% Custom spacing\n\\setstretch{1.25}\nThis text uses custom 1.25 line spacing.\n\n% Return to single\n\\singlespacing\n\n\\end{document}"} />

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

### Local Line Spacing

<LatexSource filename="local-spacing.tex" source={"\\documentclass{article}\n\\usepackage{setspace}\n\\begin{document}\n\nNormal spacing paragraph here.\n\n\\begin{doublespace}\nThis paragraph uses double spacing. It's useful for quotes\nor sections that need emphasis through spacing.\n\\end{doublespace}\n\nBack to normal spacing.\n\n% Inline spacing change\n{\\onehalfspacing\nThis paragraph temporarily uses 1.5 spacing without affecting\nthe rest of the document.\n}\n\n\\end{document}"} />

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

## Vertical Spacing

### Adding Vertical Space

<LatexSource filename="vertical-space.tex" source={"\\documentclass{article}\n\\begin{document}\n\nFirst paragraph.\n\n\\vspace{1cm}\nThis paragraph has 1cm of extra space above it.\n\n\\vspace{10pt}\nThis has 10 points of space above.\n\n\\bigskip\nThe bigskip command adds a large vertical space.\n\n\\medskip\nThe medskip command adds medium vertical space.\n\n\\smallskip\nThe smallskip command adds small vertical space.\n\n% Negative space (move up)\n\\vspace{-5mm}\nThis paragraph is moved up by 5mm.\n\n\\end{document}"} />

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

### Flexible Vertical Space

<LatexSource filename="flexible-space.tex" source={"% Fixed space\n\\vspace{2cm}\n\n% Flexible space (can shrink/stretch)\n\\vspace{2cm plus 1cm minus 0.5cm}\n\n% Fill remaining space\n\\vfill\n\n% Multiple fills for proportional spacing\nText at top\n\\vfill\nText in middle (1/3 down)\n\\vfill\n\\vfill\nText at bottom"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-latex-paragraphs-spacing-07/page-1.svg" alt="Compiled PDF page 1 from flexible-space.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>

## Indentation Control

### Managing Paragraph Indentation

<LatexSource filename="indentation.tex" source={"\\documentclass{article}\n\\begin{document}\n\n% Default indented paragraph\nThis paragraph has the default indentation.\n\n\\noindent\nThis paragraph has no indentation because of the noindent command.\n\n\\indent\nThis paragraph is indented even if global indentation is turned off.\n\n% Change indent size\n\\setlength{\\parindent}{2cm}\nThis paragraph has a 2cm indent.\n\n% Remove all indentation\n\\setlength{\\parindent}{0pt}\nNow all paragraphs have no indentation by default.\n\n\\end{document}"} />

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

### Hanging Indentation

<LatexSource filename="hanging-indent.tex" source={"\\documentclass{article}\n\\begin{document}\n\n% Simple hanging indent\n\\hangindent=2cm\n\\hangafter=1\nThis paragraph has a hanging indent. The first line starts at the\nleft margin, but all subsequent lines are indented by 2cm. This is\nuseful for bibliographies and lists.\n\n% Negative hanging indent\n\\hangindent=-2cm\n\\hangafter=1\nThis paragraph has a reverse hanging indent. The first line is\nindented to the right, while subsequent lines extend to the left\nmargin.\n\n% Multiple line hanging\n\\hangindent=1.5cm\n\\hangafter=2\nThis paragraph's hanging indent starts after the second line.\nThe first two lines are normal, then all following lines are\nindented. This creates an interesting visual effect.\n\n\\end{document}"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-latex-paragraphs-spacing-09/page-1.svg" alt="Compiled PDF page 1 from hanging-indent.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 Spacing Environments

### Quote and Quotation Environments

<LatexSource filename="quotes.tex" source={"\\documentclass{article}\n\\begin{document}\n\nRegular paragraph before the quote.\n\n\\begin{quote}\nThis is a short quote. It's indented from both margins and\nhas no paragraph indentation. Perfect for short excerpts.\n\\end{quote}\n\n\\begin{quotation}\nThis is a longer quotation environment. Unlike the quote\nenvironment, it indents the first line of each paragraph.\n\nThis is the second paragraph in the quotation, showing\nthe first-line indentation.\n\\end{quotation}\n\nRegular text continues here.\n\n\\end{document}"} />

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

### Custom Spacing Environments

<LatexSource filename="custom-environments.tex" source={"\\documentclass{article}\n\n% Define custom environment\n\\newenvironment{widespace}\n  {\\par\\vspace{1em}\\begin{minipage}{\\textwidth}\\setstretch{1.5}}\n  {\\end{minipage}\\vspace{1em}\\par}\n\n\\begin{document}\n\nNormal spacing paragraph.\n\n\\begin{widespace}\nThis custom environment adds vertical space before and after,\nplus increases line spacing. It's useful for important passages\nthat need visual emphasis.\n\\end{widespace}\n\nBack to normal spacing.\n\n\\end{document}"} />

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

## List Spacing

### Controlling List Spacing

<LatexSource filename="list-spacing.tex" source={"\\documentclass{article}\n\\usepackage{enumitem}\n\\begin{document}\n\n% Compact list\n\\begin{itemize}[noitemsep,topsep=0pt]\n\\item First item\n\\item Second item\n\\item Third item\n\\end{itemize}\n\n% Wide spacing\n\\begin{enumerate}[itemsep=1em,topsep=1em]\n\\item First item with extra space\n\\item Second item with extra space\n\\item Third item with extra space\n\\end{enumerate}\n\n% Custom spacing\n\\begin{itemize}[\n  topsep=5pt,      % Space before list\n  partopsep=0pt,   % Space before list if new paragraph\n  itemsep=10pt,    % Space between items\n  parsep=5pt,      % Space between paragraphs within item\n  leftmargin=2cm   % Indent from left\n]\n\\item First customized item\n\\item Second customized item\n\\end{itemize}\n\n\\end{document}"} />

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

## Page Layout Spacing

### Margins and Text Area

<LatexSource filename="page-layout.tex" source={"\\documentclass{article}\n\\usepackage[\n  top=2.5cm,\n  bottom=2.5cm,\n  left=3cm,\n  right=2cm,\n  headheight=15pt\n]{geometry}\n\n% Or use individual commands\n% \\setlength{\\topmargin}{0pt}\n% \\setlength{\\textheight}{9in}\n% \\setlength{\\textwidth}{6.5in}\n% \\setlength{\\oddsidemargin}{0pt}\n% \\setlength{\\evensidemargin}{0pt}\n\n\\begin{document}\nContent with custom margins...\n\\end{document}"} />

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

### Section Spacing

<LatexSource filename="section-spacing.tex" source={"\\documentclass{article}\n\\usepackage{titlesec}\n\n% Customize section spacing\n\\titlespacing{\\section}\n  {0pt}      % Left indent\n  {12pt}     % Space before\n  {6pt}      % Space after\n\n\\titlespacing{\\subsection}\n  {0pt}{8pt}{4pt}\n\n\\begin{document}\n\n\\section{First Section}\nText after section heading.\n\n\\subsection{Subsection}\nText after subsection.\n\n\\end{document}"} />

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

## Advanced Techniques

### Baseline Skip Control

<LatexSource filename="baseline-skip.tex" source={"\\documentclass{article}\n\\begin{document}\n\n% Normal baseline skip\nNormal text with default spacing between lines.\n\n% Increase baseline skip\n{\\setlength{\\baselineskip}{20pt}\nThis text has increased baseline skip, creating more space\nbetween lines without changing the font size.}\n\n% Proportional baseline skip\n{\\setlength{\\baselineskip}{1.5\\baselineskip}\nThis uses proportional spacing based on the current value.}\n\n\\end{document}"} />

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

### Rubber Lengths

<LatexSource filename="rubber-lengths.tex" source={"% Stretchable space\n\\hspace{1cm plus 2cm minus 0.5cm}\n\n% Paragraph skip with flexibility\n\\setlength{\\parskip}{6pt plus 2pt minus 1pt}\n\n% Flexible vertical space\n\\vspace{1cm plus 0.5cm minus 0.2cm}\n\n% Fill space examples\nText\\hfill Text  % Horizontal fill\n\\vfill          % Vertical fill"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-latex-paragraphs-spacing-16/page-1.svg" alt="Compiled PDF page 1 from rubber-lengths.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>

## Troubleshooting Spacing Issues

### Common Problems and Solutions

<LatexSource filename="spacing-fixes.tex" source={"% Unwanted page breaks\n\\begin{samepage}\nKeep this content together on one page.\n\\end{samepage}\n\n% Orphan/widow control\n\\widowpenalty=10000\n\\clubpenalty=10000\n\n% Prevent spacing at page top\n\\raggedbottom  % Don't stretch vertical space\n\n% Fix spacing after floats\n\\clearpage     % Force new page after floats"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-latex-paragraphs-spacing-17/page-1.svg" alt="Compiled PDF page 1 from spacing-fixes.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 Practices

<Tip>
  **Spacing guidelines:**

  1. **Consistency**: Use the same spacing throughout similar elements
  2. **Readability first**: Don't sacrifice readability for density
  3. **Document class**: Choose appropriate class for spacing defaults
  4. **Global settings**: Set document-wide spacing in preamble
  5. **Local changes**: Use grouping `{}` for temporary changes
</Tip>

## Quick Reference

| Command         | Purpose                  | Example                           |
| --------------- | ------------------------ | --------------------------------- |
| `\parskip`      | Space between paragraphs | `\setlength{\parskip}{1em}`       |
| `\parindent`    | Paragraph indentation    | `\setlength{\parindent}{0pt}`     |
| `\baselineskip` | Space between lines      | `\setlength{\baselineskip}{15pt}` |
| `\vspace{}`     | Vertical space           | `\vspace{1cm}`                    |
| `\hspace{}`     | Horizontal space         | `\hspace{2em}`                    |
| `\bigskip`      | Large vertical space     | `\bigskip`                        |
| `\noindent`     | No indent for paragraph  | `\noindent Text`                  |

## Try the Spacing Examples

<CardGroup cols={2}>
  <Card title="Open a spacing example" icon="cloud" href="https://app.latex-cloud-studio.com/?utm_source=resources&utm_medium=card&utm_campaign=docs_open_app&utm_content=paragraph_spacing_open_app">
    Paste the examples into a project and compile them to compare `\vspace`, paragraph spacing, indentation, and line spacing.
  </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=paragraph_spacing_online_editor">
    Review the browser editor workflow before testing document-wide spacing changes.
  </Card>
</CardGroup>

***

<Info>
  **Next**: Explore [Font selection and customization](/learn/latex/fonts) to enhance your document's typography.
</Info>
