> ## 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 Document Classes: article vs report vs book vs beamer

> Choose the right LaTeX document class. Compare article, report, book, beamer, and letter, then set font, paper, and layout options correctly.

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

The `\documentclass` command selects the structure and default layout for a LaTeX document. Use `article` for papers without chapters, `report` for chapter-based reports or shorter theses, `book` for long two-sided works, and `beamer` for presentation slides.

<Info>
  **Quick answer**: choose by structure, not only by page count. If the document needs `\chapter`, start with `report` or `book`; `article` does not define that command.

  **Basic syntax**:

  <LatexSource filename="example.tex" source={"\\documentclass[12pt,a4paper]{article}"} />

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

  **Common default**: when no publisher or university provides a required class, `article` is the safest starting point for an essay, assignment, or research paper.
</Info>

## The `\documentclass` Command

This is the basic syntax:

<LatexSource filename="source-1.tex" source={"\\documentclass[options]{class}"} />

<LatexSource filename="source-2.tex" source={"\\documentclass[12pt,a4paper,twoside]{report}"} />

<RenderedOutput title="Expected effect">
  <Info>
    This declaration configures the document class and its options. It does not create visible page content by itself, so no PDF preview is claimed.
  </Info>
</RenderedOutput>

## article vs report vs book vs beamer

| Class     | Best for                                    | Chapters | Default behavior that matters                             |
| --------- | ------------------------------------------- | -------- | --------------------------------------------------------- |
| `article` | Essays, homework, journal papers            | No       | Sections are the highest normal division                  |
| `report`  | Technical reports, projects, shorter theses | Yes      | Chapters can begin on either side; usually one-sided      |
| `book`    | Books, dissertations, long manuals          | Yes      | Front matter support and a two-sided book layout          |
| `beamer`  | Slides and presentations                    | No       | Content is organized into frames rather than pages        |
| `letter`  | Formal correspondence                       | No       | Provides sender, opening, closing, and signature commands |

<Tip>
  If a journal, conference, or university supplies a `.cls` file or official template, use that required class instead of converting the document to a standard class.
</Tip>

## Standard Document Classes

### article

For short documents without chapters.

<LatexSource filename="article-class.tex" source={"\\documentclass[options]{article}\n\n% Best for:\n% - Research papers\n% - Journal articles\n% - Reports (short)\n% - Homework assignments\n% - Essays\n\n% Structure hierarchy:\n% \\section{}\n% \\subsection{}\n% \\subsubsection{}\n% \\paragraph{}\n% \\subparagraph{}\n\n\\begin{document}\n\\title{Article Title}\n\\author{Author Name}\n\\date{\\today}\n\\maketitle\n\n\\begin{abstract}\nAbstract content for articles.\n\\end{abstract}\n\n\\section{Introduction}\nArticle content starts here.\n\n\\section{Main Content}\nMore sections as needed.\n\n\\section{Conclusion}\nFinal thoughts.\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_reference_document_classes">
  <LatexPreview src="/images/rendered/learn-reference-document-classes-02/page-1.svg" alt="Compiled PDF page 1 from article-class.tex" caption="Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={595.276} height={841.89} />
</RenderedOutput>

**Article Features:**

* No `\chapter` command
* Abstract environment available
* Compact formatting
* Good for papers under 20-30 pages

### report

For longer documents with chapters.

<LatexSource filename="report-class.tex" source={"\\documentclass[options]{report}\n\n% Best for:\n% - Technical reports\n% - Theses (shorter)\n% - Project documentation\n% - Lab reports\n% - User manuals\n\n% Structure hierarchy:\n% \\chapter{}\n% \\section{}\n% \\subsection{}\n% \\subsubsection{}\n% \\paragraph{}\n% \\subparagraph{}\n\n\\begin{document}\n\\title{Report Title}\n\\author{Author Name}\n\\date{\\today}\n\\maketitle\n\n\\begin{abstract}\nAbstract for reports.\n\\end{abstract}\n\n\\tableofcontents\n\n\\chapter{Introduction}\nFirst chapter content.\n\n\\chapter{Methodology}\nSecond chapter content.\n\n\\chapter{Results}\nThird chapter content.\n\n\\chapter{Conclusion}\nFinal chapter content.\n\n\\end{document}"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-reference-document-classes-03/page-1.svg" alt="Compiled PDF page 1 from report-class.tex" caption="Page 1 of 7. Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={595.276} height={841.89} />

  <LatexPreview src="/images/rendered/learn-reference-document-classes-03/page-2.svg" alt="Compiled PDF page 2 from report-class.tex" caption="Page 2 of 7. Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={595.276} height={841.89} />

  <LatexPreview src="/images/rendered/learn-reference-document-classes-03/page-3.svg" alt="Compiled PDF page 3 from report-class.tex" caption="Page 3 of 7. Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={595.276} height={841.89} />

  <LatexPreview src="/images/rendered/learn-reference-document-classes-03/page-4.svg" alt="Compiled PDF page 4 from report-class.tex" caption="Page 4 of 7. Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={595.276} height={841.89} />

  <LatexPreview src="/images/rendered/learn-reference-document-classes-03/page-5.svg" alt="Compiled PDF page 5 from report-class.tex" caption="Page 5 of 7. Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={595.276} height={841.89} />

  <LatexPreview src="/images/rendered/learn-reference-document-classes-03/page-6.svg" alt="Compiled PDF page 6 from report-class.tex" caption="Page 6 of 7. Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={595.276} height={841.89} />

  <LatexPreview src="/images/rendered/learn-reference-document-classes-03/page-7.svg" alt="Compiled PDF page 7 from report-class.tex" caption="Page 7 of 7. Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={595.276} height={841.89} />
</RenderedOutput>

**Report Features:**

* `\chapter` command available
* Abstract environment included
* Separate title page by default
* Good for documents 20-100 pages

### book

For books and very long documents.

<LatexSource filename="book-class.tex" source={"\\documentclass[options]{book}\n\n% Best for:\n% - Books\n% - Long theses/dissertations\n% - Textbooks\n% - Multi-volume works\n% - Complex documents\n\n% Structure hierarchy:\n% \\part{}\n% \\chapter{}\n% \\section{}\n% \\subsection{}\n% \\subsubsection{}\n% \\paragraph{}\n% \\subparagraph{}\n\n\\begin{document}\n\n\\frontmatter  % Roman page numbers, no chapter numbers\n\\title{Book Title}\n\\author{Author Name}\n\\date{\\today}\n\\maketitle\n\n\\tableofcontents\n\\listoffigures\n\\listoftables\n\n\\mainmatter   % Arabic page numbers, normal numbering\n\\part{First Part}\n\n\\chapter{Introduction}\nChapter content begins here.\n\n\\chapter{Background}\nMore content here.\n\n\\backmatter   % No chapter numbers\n\\appendix\n\\chapter{Additional Information}\n\n\\bibliographystyle{plain}\n\\bibliography{references}\n\n\\end{document}"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-reference-document-classes-04/page-1.svg" alt="Compiled PDF page 1 from book-class.tex" caption="Page 1 of 15. Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={595.276} height={841.89} />

  <LatexPreview src="/images/rendered/learn-reference-document-classes-04/page-2.svg" alt="Compiled PDF page 2 from book-class.tex" caption="Page 2 of 15. Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={595.276} height={841.89} />

  <LatexPreview src="/images/rendered/learn-reference-document-classes-04/page-3.svg" alt="Compiled PDF page 3 from book-class.tex" caption="Page 3 of 15. Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={595.276} height={841.89} />

  <LatexPreview src="/images/rendered/learn-reference-document-classes-04/page-4.svg" alt="Compiled PDF page 4 from book-class.tex" caption="Page 4 of 15. Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={595.276} height={841.89} />

  <LatexPreview src="/images/rendered/learn-reference-document-classes-04/page-5.svg" alt="Compiled PDF page 5 from book-class.tex" caption="Page 5 of 15. Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={595.276} height={841.89} />

  <LatexPreview src="/images/rendered/learn-reference-document-classes-04/page-6.svg" alt="Compiled PDF page 6 from book-class.tex" caption="Page 6 of 15. Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={595.276} height={841.89} />

  <LatexPreview src="/images/rendered/learn-reference-document-classes-04/page-7.svg" alt="Compiled PDF page 7 from book-class.tex" caption="Page 7 of 15. Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={595.276} height={841.89} />

  <LatexPreview src="/images/rendered/learn-reference-document-classes-04/page-8.svg" alt="Compiled PDF page 8 from book-class.tex" caption="Page 8 of 15. Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={595.276} height={841.89} />

  <LatexPreview src="/images/rendered/learn-reference-document-classes-04/page-9.svg" alt="Compiled PDF page 9 from book-class.tex" caption="Page 9 of 15. Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={595.276} height={841.89} />

  <LatexPreview src="/images/rendered/learn-reference-document-classes-04/page-10.svg" alt="Compiled PDF page 10 from book-class.tex" caption="Page 10 of 15. Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={595.276} height={841.89} />

  <LatexPreview src="/images/rendered/learn-reference-document-classes-04/page-11.svg" alt="Compiled PDF page 11 from book-class.tex" caption="Page 11 of 15. Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={595.276} height={841.89} />

  <LatexPreview src="/images/rendered/learn-reference-document-classes-04/page-12.svg" alt="Compiled PDF page 12 from book-class.tex" caption="Page 12 of 15. Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={595.276} height={841.89} />

  <LatexPreview src="/images/rendered/learn-reference-document-classes-04/page-13.svg" alt="Compiled PDF page 13 from book-class.tex" caption="Page 13 of 15. Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={595.276} height={841.89} />

  <LatexPreview src="/images/rendered/learn-reference-document-classes-04/page-14.svg" alt="Compiled PDF page 14 from book-class.tex" caption="Page 14 of 15. Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={595.276} height={841.89} />

  <LatexPreview src="/images/rendered/learn-reference-document-classes-04/page-15.svg" alt="Compiled PDF page 15 from book-class.tex" caption="Page 15 of 15. Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={595.276} height={841.89} />
</RenderedOutput>

**Book Features:**

* Two-sided layout by default
* Front matter, main matter, back matter
* Parts and chapters available
* Best for 100+ page documents

### beamer

For presentations and slides.

<LatexSource filename="beamer-class.tex" source={"\\documentclass[options]{beamer}\n\n% Best for:\n% - Conference presentations\n% - Lecture slides\n% - Academic talks\n% - Business presentations\n\n% Slide structure:\n% \\frame{} or \\begin{frame}...\\end{frame}\n% \\section{} for navigation\n% \\subsection{} for organization\n\n\\usetheme{Warsaw}  % Choose theme\n\\usecolortheme{dolphin}  % Choose colors\n\n\\title{Presentation Title}\n\\author{Author Name}\n\\institute{Institution}\n\\date{\\today}\n\n\\begin{document}\n\n\\frame{\\titlepage}\n\n\\begin{frame}\n\\frametitle{Outline}\n\\tableofcontents\n\\end{frame}\n\n\\section{Introduction}\n\\begin{frame}\n\\frametitle{Introduction}\n\\begin{itemize}\n  \\item First point\n  \\item Second point\n  \\item<2-> This appears on second click\n\\end{itemize}\n\\end{frame}\n\n\\section{Main Content}\n\\begin{frame}\n\\frametitle{Main Points}\nContent of the slide here.\n\\end{frame}\n\n\\end{document}"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-reference-document-classes-05/page-1.svg" alt="Compiled PDF page 1 from beamer-class.tex" caption="Page 1 of 5. Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={362.835} height={272.126} />

  <LatexPreview src="/images/rendered/learn-reference-document-classes-05/page-2.svg" alt="Compiled PDF page 2 from beamer-class.tex" caption="Page 2 of 5. Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={362.835} height={272.126} />

  <LatexPreview src="/images/rendered/learn-reference-document-classes-05/page-3.svg" alt="Compiled PDF page 3 from beamer-class.tex" caption="Page 3 of 5. Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={362.835} height={272.126} />

  <LatexPreview src="/images/rendered/learn-reference-document-classes-05/page-4.svg" alt="Compiled PDF page 4 from beamer-class.tex" caption="Page 4 of 5. Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={362.835} height={272.126} />

  <LatexPreview src="/images/rendered/learn-reference-document-classes-05/page-5.svg" alt="Compiled PDF page 5 from beamer-class.tex" caption="Page 5 of 5. Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={362.835} height={272.126} />
</RenderedOutput>

**Beamer Features:**

* Built-in themes and color schemes
* Overlay specifications for animations
* Navigation aids
* PDF presentation format

### letter

For correspondence.

<LatexSource filename="letter-class.tex" source={"\\documentclass[options]{letter}\n\n% Best for:\n% - Business letters\n% - Formal correspondence\n% - Cover letters\n% - Official documents\n\n\\usepackage[utf8]{inputenc}\n\n\\signature{Your Name}\n\\address{Your Address\\\\City, State ZIP}\n\n\\begin{document}\n\n\\begin{letter}{Recipient Name\\\\Recipient Address\\\\City, State ZIP}\n\n\\opening{Dear Sir or Madam,}\n\nBody of the letter goes here. Multiple paragraphs\nare separated by blank lines.\n\nThis is the second paragraph of the letter.\n\n\\closing{Sincerely,}\n\n\\ps{P.S. Additional note here.}\n\n\\encl{Enclosure list}\n\n\\end{letter}\n\\end{document}"} />

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

**Letter Features:**

* Automatic formatting for addresses
* Date insertion
* Signature placement
* Standard letter conventions

## Document Class Options

### Font Size Options

<LatexSource filename="font-size-options.tex" source={"% Available font sizes\n\\documentclass[10pt]{article}  % 10pt (default)\n\\documentclass[11pt]{article}  % 11pt\n\\documentclass[12pt]{article}  % 12pt\n\n% Font size affects:\n% - Body text size\n% - Section heading sizes\n% - Math formula sizes\n% - Footnote sizes"} />

<RenderedOutput title="Expected effect">
  <Info>
    This declaration configures the document class and its options. It does not create visible page content by itself, so no PDF preview is claimed.
  </Info>
</RenderedOutput>

### Paper Size Options

<LatexSource filename="paper-size-options.tex" source={"% US paper sizes\n\\documentclass[letterpaper]{article}  % 8.5 × 11 inches (default)\n\\documentclass[legalpaper]{article}   % 8.5 × 14 inches\n\\documentclass[executivepaper]{article} % 7.25 × 10.5 inches\n\n% International paper sizes\n\\documentclass[a4paper]{article}      % 210 × 297 mm\n\\documentclass[a5paper]{article}      % 148 × 210 mm\n\\documentclass[b5paper]{article}      % 176 × 250 mm\n\n% Custom paper size (with geometry package)\n\\usepackage[paperwidth=8in,paperheight=10in]{geometry}"} />

<RenderedOutput title="Expected effect">
  <Info>
    This declaration configures the document class and its options. It does not create visible page content by itself, so no PDF preview is claimed.
  </Info>
</RenderedOutput>

### Layout Options

<LatexSource filename="layout-options.tex" source={"% Page orientation\n\\documentclass[landscape]{article}    % Landscape orientation\n\\documentclass[portrait]{article}     % Portrait (default)\n\n% Columns\n\\documentclass[onecolumn]{article}    % Single column (default)\n\\documentclass[twocolumn]{article}    % Two columns\n\n% Sides\n\\documentclass[oneside]{article}      % Single-sided (default for article)\n\\documentclass[twoside]{book}         % Double-sided (default for book)\n\n% Draft mode\n\\documentclass[draft]{article}        % Shows overfull boxes, faster compilation\n\\documentclass[final]{article}        % Final mode (default)"} />

<RenderedOutput title="Expected effect">
  <Info>
    This declaration configures the document class and its options. It does not create visible page content by itself, so no PDF preview is claimed.
  </Info>
</RenderedOutput>

### Title Page Options

<LatexSource filename="title-options.tex" source={"% Title page behavior\n\\documentclass[titlepage]{article}    % Separate title page\n\\documentclass[notitlepage]{report}   % Title on first page\n\n% Abstract behavior (for article)\n\\documentclass[onecolumn]{article}    % Abstract spans full width\n\\documentclass[twocolumn]{article}    % Abstract spans both columns"} />

<RenderedOutput title="Expected effect">
  <Info>
    This declaration configures the document class and its options. It does not create visible page content by itself, so no PDF preview is claimed.
  </Info>
</RenderedOutput>

### Equation Options

<LatexSource filename="equation-options.tex" source={"% Equation numbering\n\\documentclass[leqno]{article}        % Equation numbers on left\n\\documentclass[reqno]{article}        % Equation numbers on right (default)\n\n% Equation formatting\n\\documentclass[fleqn]{article}        % Left-aligned equations\n% Default: centered equations"} />

<RenderedOutput title="Expected effect">
  <Info>
    This declaration configures the document class and its options. It does not create visible page content by itself, so no PDF preview is claimed.
  </Info>
</RenderedOutput>

### Bibliography Options

<LatexSource filename="bibliography-options.tex" source={"% Bibliography formatting\n\\documentclass[openbib]{article}      % Open bibliography format\n% Default: closed bibliography format"} />

<RenderedOutput title="Expected effect">
  <Info>
    This declaration configures the document class and its options. It does not create visible page content by itself, so no PDF preview is claimed.
  </Info>
</RenderedOutput>

## Custom Document Classes

### Creating Custom Classes

<LatexSource filename="myclass.cls" source={"% File: myclass.cls\n\\NeedsTeXFormat{LaTeX2e}\n\\ProvidesClass{myclass}[2024/01/01 My Custom Class]\n\n% Based on article class\n\\LoadClass[11pt,a4paper]{article}\n\n% Required packages\n\\RequirePackage{geometry}\n\\RequirePackage{fancyhdr}\n\\RequirePackage{graphicx}\n\n% Page layout\n\\geometry{margin=1in}\n\n% Custom commands\n\\newcommand{\\institution}[1]{\\def\\@institution{#1}}\n\\newcommand{\\course}[1]{\\def\\@course{#1}}\n\n% Custom title format\n\\renewcommand{\\maketitle}{\n  \\begin{center}\n    {\\LARGE\\bfseries\\@title}\\\\[1em]\n    {\\large\\@author}\\\\\n    {\\large\\@institution}\\\\\n    {\\large\\@course}\\\\\n    {\\large\\@date}\n  \\end{center}\n}"} />

<LatexSource filename="using-custom-class.tex" source={"% Using the custom class\n\\documentclass{myclass}\n\n\\title{Assignment Title}\n\\author{Student Name}\n\\institution{University Name}\n\\course{Course Code}\n\n\\begin{document}\n\\maketitle\n\nContent goes here.\n\n\\end{document}"} />

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

## Academic Document Classes

### Thesis Classes

<LatexSource filename="thesis-classes.tex" source={"% University-specific thesis classes\n\\documentclass{phdthesis}     % PhD thesis\n\\documentclass{msthesis}      % Master's thesis\n\\documentclass{ucthesis}      % UC system thesis\n\n% Generic thesis classes\n\\documentclass[thesis]{memoir}\n\\documentclass{scrbook}       % KOMA-Script book class\n\n% Configuration example\n\\documentclass[12pt,oneside,openright]{report}\n\\usepackage[margin=1.5in,left=2in]{geometry}\n\\usepackage{setspace}\n\\doublespacing"} />

<RenderedOutput title="Expected effect">
  <Info>
    This declaration configures the document class and its options. It does not create visible page content by itself, so no PDF preview is claimed.
  </Info>
</RenderedOutput>

### Journal Classes

<LatexSource filename="journal-classes.tex" source={"% IEEE papers\n\\documentclass{IEEEtran}\n\n% ACM papers\n\\documentclass{acmart}\n\n% Springer papers\n\\documentclass{llncs}         % Lecture Notes in Computer Science\n\\documentclass{svjour3}       % Springer journals\n\n% Elsevier papers\n\\documentclass{elsarticle}\n\n% AMS papers\n\\documentclass{amsart}"} />

<RenderedOutput title="Expected effect">
  <Info>
    This declaration configures the document class and its options. It does not create visible page content by itself, so no PDF preview is claimed.
  </Info>
</RenderedOutput>

## KOMA-Script Classes

Alternative to standard classes with enhanced features:

<LatexSource filename="koma-script.tex" source={"% KOMA-Script equivalents\n\\documentclass{scrartcl}      % Instead of article\n\\documentclass{scrreprt}      % Instead of report\n\\documentclass{scrbook}       % Instead of book\n\\documentclass{scrlttr2}      % Instead of letter\n\n% Enhanced features\n\\documentclass[\n  fontsize=11pt,\n  paper=a4,\n  twoside=false,\n  titlepage=false,\n  headings=small\n]{scrartcl}\n\n% KOMA options\n\\KOMAoptions{\n  DIV=12,                     % Text area calculation\n  BCOR=8mm,                   % Binding correction\n  headinclude=true,           % Include header in text area\n  footinclude=false           % Exclude footer from text area\n}"} />

<RenderedOutput title="Expected effect">
  <Info>
    This declaration configures the document class and its options. It does not create visible page content by itself, so no PDF preview is claimed.
  </Info>
</RenderedOutput>

## Memoir Class

Highly customizable class for books and articles:

<LatexSource filename="memoir-class.tex" source={"\\documentclass[11pt,a4paper,oneside]{memoir}\n\n% Page layout\n\\settrimmedsize{297mm}{210mm}{*}  % A4 paper\n\\setlength{\\trimtop}{0pt}\n\\setlength{\\trimedge}{\\stockwidth}\n\\addtolength{\\trimedge}{-\\paperwidth}\n\\settypeblocksize{634pt}{448.13pt}{*}\n\\setulmargins{4cm}{*}{*}\n\\setlrmargins{2.5cm}{*}{*}\n\\checkandfixthelayout\n\n% Chapter styles\n\\chapterstyle{veelo}          % Pre-defined style\n% or create custom style\n\\makechapterstyle{custom}{\n  \\renewcommand{\\chapternamenum}{}\n  \\renewcommand{\\printchaptername}{}\n  \\renewcommand{\\printchapternum}{\\chapnumfont\\thechapter\\space}\n  \\renewcommand{\\afterchapternum}{}\n}"} />

<RenderedOutput title="Expected effect">
  <Info>
    This declaration configures the document class and its options. It does not create visible page content by itself, so no PDF preview is claimed.
  </Info>
</RenderedOutput>

## Document Class Comparison

### When to Use Each Class

<Tabs>
  <Tab title="article">
    **Best for:**

    * Research papers (5-30 pages)
    * Journal submissions
    * Conference papers
    * Technical reports
    * Essays and assignments

    **Features:**

    * No chapters
    * Compact layout
    * Abstract support
    * Bibliography integration
  </Tab>

  <Tab title="report">
    **Best for:**

    * Technical reports (20-100 pages)
    * Master's theses
    * Project documentation
    * Lab reports
    * User manuals

    **Features:**

    * Chapter support
    * Title page by default
    * Abstract support
    * Good for structured documents
  </Tab>

  <Tab title="book">
    **Best for:**

    * Books (100+ pages)
    * PhD dissertations
    * Textbooks
    * Reference manuals
    * Multi-volume works

    **Features:**

    * Two-sided by default
    * Front/main/back matter
    * Parts and chapters
    * Professional typography
  </Tab>

  <Tab title="beamer">
    **Best for:**

    * Academic presentations
    * Conference talks
    * Lecture slides
    * Business presentations

    **Features:**

    * Frame-based content
    * Themes and animations
    * Navigation tools
    * PDF output optimized for projection
  </Tab>
</Tabs>

## Common `\documentclass` Errors

| Error or symptom                       | Cause                                                        | Fix                                                                             |
| -------------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------------------------- |
| `Undefined control sequence \chapter`  | The document uses the `article` class                        | Switch to `report` or `book`, or use `\section` as the highest level            |
| `File ... .cls not found`              | A custom journal or university class is missing              | Add the exact `.cls` file supplied with the template or install its package     |
| `Unused global option(s)`              | The selected class or packages do not recognize an option    | Check the class documentation and pass package-specific options to that package |
| The page uses the wrong paper size     | The default differs from the required format                 | Set `a4paper` or `letterpaper` explicitly                                       |
| Blank pages appear before chapters     | The class uses `openright` (`book` does by default)          | Use `openany` only when the required format permits it                          |
| Layout changes after switching classes | Classes define different headings, margins, and front matter | Treat a class change as a structural change and review the entire PDF           |

<Warning>
  Do not rename a missing custom `.cls` file to `article.cls` or replace it silently. Publisher and university classes often contain required formatting and metadata rules.
</Warning>

## Best Practices

<Tip>
  **Document class selection tips:**

  1. **Follow submission requirements first** — an official class overrides a general recommendation.
  2. **Choose the required structure** — chapter support and front matter matter more than a rough page count.
  3. **Set regional defaults explicitly** — declare paper size and any required one- or two-sided layout.
  4. **Keep class options intentional** — unsupported options are ignored and usually produce a warning.
  5. **Compile early with the real template** — class/package conflicts are easier to fix before the document grows.
  6. **Review the class documentation** — custom classes can redefine commands and defaults.
</Tip>

## Quick Reference

### Standard Classes Summary

| Class     | Purpose           | Length | Chapters | Default Layout |
| --------- | ----------------- | ------ | -------- | -------------- |
| `article` | Papers, reports   | Short  | No       | One-sided      |
| `report`  | Technical reports | Medium | Yes      | One-sided      |
| `book`    | Books, theses     | Long   | Yes      | Two-sided      |
| `beamer`  | Presentations     | N/A    | No       | Slides         |
| `letter`  | Correspondence    | Short  | No       | Letter format  |

### Common Options Summary

| Option                     | Effect        | Classes             |
| -------------------------- | ------------- | ------------------- |
| `10pt`, `11pt`, `12pt`     | Font size     | All                 |
| `a4paper`, `letterpaper`   | Paper size    | All (except beamer) |
| `oneside`, `twoside`       | Page layout   | All (except beamer) |
| `onecolumn`, `twocolumn`   | Column layout | article, report     |
| `titlepage`, `notitlepage` | Title page    | article, report     |
| `draft`, `final`           | Draft mode    | All                 |

## Practice in LaTeX Cloud Studio

<CardGroup cols={2}>
  <Card title="Open a project and choose a class" icon="cloud" href="https://app.latex-cloud-studio.com/?utm_source=resources&utm_medium=card&utm_campaign=docs_open_app&utm_content=document_classes_open_app">
    Start with `article`, `report`, or `beamer` in the browser editor and compile early to confirm the structure.
  </Card>

  <Card title="Templates that match the class" icon="file-text" href="/templates/article?utm_source=resources&utm_medium=related_template&utm_campaign=docs_open_app&utm_content=document_classes_templates">
    Use a working template when you want the document class and layout decisions already in place.
  </Card>
</CardGroup>

***

<Info>
  **Next**: Learn about [LaTeX Packages](/learn/reference/packages) to extend document functionality, or explore [Document Structure](/learn/latex/basics/creating-first-document) for hands-on examples.
</Info>
