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

# New Line in LaTeX: \\, \newline, and Paragraph Breaks

> Start a new line in LaTeX with `\\` or `\newline`, and start a new paragraph with a blank source line. See when each method is correct.

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 start a new line in LaTeX without beginning a new paragraph, use `\\` or `\newline`. To start a new paragraph, leave one blank line in the source. Do not insert manual breaks just to wrap ordinary prose—LaTeX calculates those line endings automatically.

<Info>
  **Choose the right break**: use a blank source line for a paragraph, `\\` for a deliberate line break, and `\\[6pt]` only when that manual break also needs extra vertical space.
</Info>

## How LaTeX Handles Paragraphs

### Creating Paragraphs

In LaTeX, a blank line creates a new paragraph:

<LatexSource filename="paragraphs.tex" source={"\\documentclass{article}\n\\begin{document}\n\nThis is the first paragraph. It can span multiple lines in your source file, but LaTeX will format it as one continuous paragraph in the output.\n\nThis is the second paragraph. Notice the blank line above - that's what tells LaTeX to start a new paragraph. LaTeX automatically indents the first line.\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_basics_paragraphs_new_lines">
  <LatexPreview src="/images/rendered/learn-latex-basics-paragraphs-new-lines-01/page-1.svg" alt="Compiled PDF page 1 from 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>

### Multiple Spaces and Line Breaks

LaTeX treats multiple spaces as one and ignores single line breaks:

<LatexSource filename="spacing.tex" source={"This    has    multiple    spaces.\nThis is on\nmultiple lines\nin the source.\n\nThis is a new paragraph."} />

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

<Tip>
  LaTeX ignores extra whitespace to give you flexibility in formatting your source code without affecting the output.
</Tip>

## Manual Line Breaks

### Using Double Backslash

Force a line break within a paragraph using `\\`:

<LatexSource filename="line-breaks.tex" source={"\\documentclass{article}\n\\begin{document}\n\nFirst line\\\\\nSecond line\\\\\nThird line\n\nThis is still the same paragraph, but with forced line breaks.\n\nThis is a new paragraph.\n\n\\end{document}"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-latex-basics-paragraphs-new-lines-03/page-1.svg" alt="Compiled PDF page 1 from line-breaks.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 Break with Extra Space

Add vertical space after a line break:

<LatexSource filename="line-break-space.tex" source={"First line\\\\[10pt]\nSecond line with 10pt gap\\\\[0.5cm]\nThird line with 0.5cm gap\n\nNormal line break:\\\\\nNext line"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-latex-basics-paragraphs-new-lines-04/page-1.svg" alt="Compiled PDF page 1 from line-break-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>

### The \newline Command

Alternative to `\\`:

<LatexSource filename="example.tex" source={"This is one line\\newline\nThis is the next line"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-latex-basics-paragraphs-new-lines-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>

## Preventing Line Breaks

### Non-breaking Space

Use `~` to prevent line breaks between words:

<LatexSource filename="non-breaking.tex" source={"% Prevent breaks in names\nDr.~Smith wrote Chapter~5.\n\n% Keep units together\nThe temperature is 25~°C.\n\n% Prevent awkward breaks\nSee Figure~\\ref{fig:example} on page~\\pageref{fig:example}."} />

<RenderedOutput title="Expected effect">
  <Info>
    This excerpt is part of a multi-pass cross-reference or bibliography workflow. A trustworthy final page requires the surrounding project and its auxiliary files, so this standalone code box documents the workflow without claiming a complete rendered result.
  </Info>
</RenderedOutput>

### \mbox Command

Keep text together on one line:

<LatexSource filename="example.tex" source={"The URL is \\mbox{www.example.com/very-long-path}."} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-latex-basics-paragraphs-new-lines-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={595.276} height={841.89} />
</RenderedOutput>

## Paragraph Formatting

### Paragraph Indentation

Control first-line indentation:

<LatexSource filename="indentation.tex" source={"\\documentclass{article}\n\n% Remove indentation globally\n\\setlength{\\parindent}{0pt}\n\n% Or set custom indentation\n% \\setlength{\\parindent}{1cm}\n\n\\begin{document}\n\nThis paragraph has no indentation because we set parindent to 0pt.\n\nThis paragraph also has no indentation. All paragraphs follow the global setting.\n\n\\indent This paragraph is manually indented using the indent command.\n\n\\noindent This paragraph has no indentation even if parindent is set.\n\n\\end{document}"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-latex-basics-paragraphs-new-lines-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>

### Paragraph Spacing

Control space between paragraphs:

<LatexSource filename="paragraph-spacing.tex" source={"\\documentclass{article}\n\n% Add space between paragraphs\n\\setlength{\\parskip}{1em}\n\n% Remove indent when using parskip\n\\setlength{\\parindent}{0pt}\n\n\\begin{document}\n\nFirst paragraph with spacing after it.\n\nSecond paragraph with spacing before and after it.\n\nThird paragraph.\n\n\\end{document}"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-latex-basics-paragraphs-new-lines-09/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>

## Special Paragraph Commands

### \par Command

Explicitly end a paragraph:

<LatexSource filename="example.tex" source={"This is a paragraph.\\par\nThis is another paragraph."} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-latex-basics-paragraphs-new-lines-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>

### Centered Text

<LatexSource filename="centering.tex" source={"\\begin{center}\nThis text is centered.\\\\\nMultiple lines\\\\\ncan be centered.\n\\end{center}\n\n% Or for short text:\n{\\centering This is also centered.\\par}"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-latex-basics-paragraphs-new-lines-11/page-1.svg" alt="Compiled PDF page 1 from centering.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>

### Flush Left and Right

<LatexSource filename="alignment.tex" source={"\\begin{flushleft}\nThis text is\\\\\naligned to\\\\\nthe left.\n\\end{flushleft}\n\n\\begin{flushright}\nThis text is\\\\\naligned to\\\\\nthe right.\n\\end{flushright}"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-latex-basics-paragraphs-new-lines-12/page-1.svg" alt="Compiled PDF page 1 from alignment.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>

## Advanced Line Breaking

### Preventing Hyphenation

<LatexSource filename="hyphenation.tex" source={"% Prevent hyphenation for specific words\n\\hyphenation{LaTeX JavaScript Python}\n\n% Prevent hyphenation in a word\n\\mbox{unbreakableword}\n\n% Allow hyphenation at specific points\nsuper\\-cali\\-fragi\\-listic"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-latex-basics-paragraphs-new-lines-13/page-1.svg" alt="Compiled PDF page 1 from hyphenation.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>

### Line Breaking Commands

| Command        | Effect                     | Usage                |
| -------------- | -------------------------- | -------------------- |
| `\\`           | Line break                 | Most common          |
| `\\*`          | Line break (no page break) | Keeps lines together |
| `\newline`     | Line break                 | Alternative to `\\`  |
| `\linebreak`   | Suggests line break        | LaTeX decides        |
| `\nolinebreak` | Prevents line break        | Keeps on same line   |

### Page Breaking

Control where pages break:

<LatexSource filename="example.tex" source={"\\newpage     % Start new page\n\\pagebreak   % Suggest page break\n\\nopagebreak % Prevent page break\n\\clearpage   % New page after floats"} />

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

## Common Patterns

### Address Format

<LatexSource filename="address.tex" source={"John Smith\\\\\n123 Main Street\\\\\nAnytown, ST 12345\\\\\nUSA"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-latex-basics-paragraphs-new-lines-15/page-1.svg" alt="Compiled PDF page 1 from address.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>

### Poetry or Verses

<LatexSource filename="poetry.tex" source={"\\begin{verse}\nRoses are red,\\\\\nViolets are blue,\\\\\nLaTeX is awesome,\\\\\nAnd so are you!\n\\end{verse}"} />

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

### Quotations

<LatexSource filename="quotations.tex" source={"\\begin{quote}\nThis is a short quotation. It's indented from both margins and has no paragraph indentation.\n\\end{quote}\n\n\\begin{quotation}\nThis is a longer quotation that might span multiple paragraphs. The first line of each paragraph is indented.\n\nThis is the second paragraph of the quotation.\n\\end{quotation}"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-latex-basics-paragraphs-new-lines-17/page-1.svg" alt="Compiled PDF page 1 from quotations.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>
  **Paragraph and line break tips:**

  1. **Let LaTeX decide** - Don't force line breaks unless necessary
  2. **Use blank lines** - Clear paragraph separation in source
  3. **Be consistent** - Choose either indentation or spacing
  4. **Use non-breaking spaces** - Keep related items together
  5. **Avoid `\\` at paragraph ends** - Use blank lines instead
</Tip>

## Common Mistakes

<Warning>
  **Avoid these errors:**

  1. **Using `\\` for paragraph breaks** - Use blank lines
  2. **Multiple `\\` in a row** - Use `\\[space]` instead
  3. **Ending paragraphs with `\\`** - Creates underfull hbox warnings
  4. **Too many manual breaks** - Trust LaTeX's algorithm
</Warning>

## Troubleshooting

### Underfull/Overfull hbox

If you get these warnings:

* Let LaTeX handle line breaking
* Use `\sloppy` for problematic paragraphs
* Rewrite sentences if needed

### Unwanted Page Breaks

<LatexSource filename="example.tex" source={"% Keep content together\n\\begin{samepage}\nThis content stays together on one page.\n\\end{samepage}"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-latex-basics-paragraphs-new-lines-18/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>

### Inconsistent Spacing

Check these settings:

<LatexSource filename="example.tex" source={"\\setlength{\\parindent}{15pt}  % First line indent\n\\setlength{\\parskip}{0pt}     % Between paragraphs\n\\setlength{\\baselineskip}{12pt} % Between lines"} />

<RenderedOutput title="Expected effect">
  <Info>
    This is setup or structural LaTeX code. It changes available commands or document behavior, but it does not produce meaningful standalone page content by itself.
  </Info>
</RenderedOutput>

## Quick Reference

| What you want  | How to do it     | Example          |
| -------------- | ---------------- | ---------------- |
| New paragraph  | Blank line       | `text\n\ntext`   |
| Line break     | `\\`             | `line\\line`     |
| No indentation | `\noindent`      | `\noindent Text` |
| Keep together  | `~`              | `Fig.~1`         |
| Center text    | `\begin{center}` | Centered         |
| Extra space    | `\\[1cm]`        | With gap         |

## Try Paragraph and Line Breaks

<CardGroup cols={2}>
  <Card title="Open the line-break example" icon="cloud" href="https://app.latex-cloud-studio.com/?utm_source=resources&utm_medium=card&utm_campaign=docs_open_app&utm_content=new_lines_open_app">
    Paste the examples into a project and compile them to compare automatic wrapping, paragraphs, and manual line breaks.
  </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=new_lines_online_editor">
    Review the browser editor workflow before starting a project.
  </Card>
</CardGroup>

***

<Info>
  **Next**: Learn about [Bold, italics and underlining](/learn/latex/basics/bold-italics-underlining) to add emphasis to your text.
</Info>
