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

# Single-sided vs Double-sided Documents

> Guide to single-sided and double-sided layouts in LaTeX. Learn oneside/twoside options, margins, and printing tips.

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

Understanding the difference between single-sided and double-sided document layouts is crucial for professional document preparation. This guide covers layout options, margin considerations, and best practices for both digital and print documents.

<Info>
  **Key concept**: The choice between oneside and twoside affects not just printing but also margins, headers, page breaks, and overall document flow. Understanding these differences helps you choose the right option for your specific use case.

  **Related topics**: [Page numbering](/learn/latex/formatting/page-numbering) | [Headers and footers](/learn/latex/formatting/headers-footers) | [Multiple columns](/learn/latex/formatting/multiple-columns)
</Info>

## Understanding Document Sides

### Single-sided Documents (oneside)

Single-sided documents are designed for:

* Digital viewing (PDFs on screen)
* Single-sided printing
* Simple document structure
* Consistent margins on all pages

### Double-sided Documents (twoside)

Double-sided documents are designed for:

* Professional book-like printing
* Bound documents
* Academic papers and theses
* Different margins for odd/even pages

## Basic Configuration

### Document Class Options

<LatexSource filename="document-options.tex" source={"% Single-sided document (default for article)\n\\documentclass[oneside]{article}\n\n% Double-sided document (default for book and report)\n\\documentclass[twoside]{article}\n\n% Explicit specification\n\\documentclass[12pt,letterpaper,oneside]{article}\n\\documentclass[12pt,a4paper,twoside]{book}\n\n\\begin{document}\n\n\\section{Sample Content}\nThis content will be formatted according to the chosen option.\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>

### Class Defaults

| Document Class | Default Setting |
| -------------- | --------------- |
| `article`      | `oneside`       |
| `report`       | `oneside`       |
| `book`         | `twoside`       |
| `memoir`       | `twoside`       |

## Margin Differences

### Single-sided Margins

<LatexSource filename="oneside-margins.tex" source={"\\documentclass[oneside]{article}\n\\usepackage[showframe]{geometry} % Shows margin boxes\n\\usepackage{lipsum} % For dummy text\n\n% All pages have identical margins\n\\geometry{\n    left=3cm,\n    right=3cm,\n    top=3cm,\n    bottom=3cm\n}\n\n\\begin{document}\n\n\\section{Page 1}\n\\lipsum[1-2]\n\n\\newpage\n\\section{Page 2}\n\\lipsum[3-4]\n\n\\newpage\n\\section{Page 3}\n\\lipsum[5-6]\n\n% All pages have the same margin layout\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_formatting_document_sides">
  <LatexPreview src="/images/rendered/learn-latex-formatting-document-sides-02/page-1.svg" alt="Compiled PDF page 1 from oneside-margins.tex" caption="Page 1 of 3. Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={612} height={792} />

  <LatexPreview src="/images/rendered/learn-latex-formatting-document-sides-02/page-2.svg" alt="Compiled PDF page 2 from oneside-margins.tex" caption="Page 2 of 3. Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={612} height={792} />

  <LatexPreview src="/images/rendered/learn-latex-formatting-document-sides-02/page-3.svg" alt="Compiled PDF page 3 from oneside-margins.tex" caption="Page 3 of 3. Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={612} height={792} />
</RenderedOutput>

### Double-sided Margins

<LatexSource filename="twoside-margins.tex" source={"\\documentclass[twoside]{article}\n\\usepackage[showframe]{geometry}\n\\usepackage{lipsum}\n\n% Different margins for odd and even pages\n\\geometry{\n    inner=3.5cm,  % Binding side (left on odd, right on even)\n    outer=2.5cm,  % Outer edge (right on odd, left on even)\n    top=3cm,\n    bottom=3cm\n}\n\n% Alternative: specify explicitly\n% \\geometry{\n%     left=2.5cm,   % Left margin on odd pages\n%     right=3.5cm,  % Right margin on odd pages\n%     bindingoffset=0.5cm,  % Extra space for binding\n%     top=3cm,\n%     bottom=3cm\n% }\n\n\\begin{document}\n\n\\section{Odd Page (1)}\n\\lipsum[1-2]\nNotice the larger inner margin for binding.\n\n\\newpage\n\\section{Even Page (2)}\n\\lipsum[3-4]\nThe margins are mirrored compared to odd pages.\n\n\\newpage\n\\section{Odd Page (3)}\n\\lipsum[5-6]\nBack to the odd page margin layout.\n\n\\end{document}"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-latex-formatting-document-sides-03/page-1.svg" alt="Compiled PDF page 1 from twoside-margins.tex" caption="Page 1 of 3. Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={612} height={792} />

  <LatexPreview src="/images/rendered/learn-latex-formatting-document-sides-03/page-2.svg" alt="Compiled PDF page 2 from twoside-margins.tex" caption="Page 2 of 3. Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={612} height={792} />

  <LatexPreview src="/images/rendered/learn-latex-formatting-document-sides-03/page-3.svg" alt="Compiled PDF page 3 from twoside-margins.tex" caption="Page 3 of 3. Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={612} height={792} />
</RenderedOutput>

## Page Layout Differences

### Headers and Footers

<LatexSource filename="headers-comparison.tex" source={"\\documentclass[twoside]{article}\n\\usepackage{fancyhdr}\n\\usepackage{lipsum}\n\n\\pagestyle{fancy}\n\\fancyhf{}\n\n% Single-sided approach (same on all pages)\n% \\fancyhead[L]{Document Title}\n% \\fancyhead[R]{\\thepage}\n\n% Double-sided approach (different for odd/even)\n\\fancyhead[LE,RO]{\\thepage}          % Page number on outer edge\n\\fancyhead[LO,RE]{Document Title}     % Title on inner edge\n\n% Footers can also vary\n\\fancyfoot[LE]{Even Page Footer}\n\\fancyfoot[RO]{Odd Page Footer}\n\\fancyfoot[C]{Center Footer on All Pages}\n\n\\begin{document}\n\n\\section{Headers Demo}\n\\lipsum[1]\n\n\\newpage\n\\section{Page 2}\n\\lipsum[2]\n\n\\newpage\n\\section{Page 3}\n\\lipsum[3]\n\n\\end{document}"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-latex-formatting-document-sides-04/page-1.svg" alt="Compiled PDF page 1 from headers-comparison.tex" caption="Page 1 of 3. 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-latex-formatting-document-sides-04/page-2.svg" alt="Compiled PDF page 2 from headers-comparison.tex" caption="Page 2 of 3. 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-latex-formatting-document-sides-04/page-3.svg" alt="Compiled PDF page 3 from headers-comparison.tex" caption="Page 3 of 3. Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={595.276} height={841.89} />
</RenderedOutput>

### Chapter Opening Pages

<LatexSource filename="chapter-openings.tex" source={"\\documentclass[twoside,openright]{book}\n\\usepackage{lipsum}\n\n% openright: chapters always start on odd pages (right-hand side)\n% openany: chapters can start on any page\n% Default: book uses openright, report uses openany\n\n\\begin{document}\n\n\\chapter{First Chapter}\n\\lipsum[1-3]\nThis chapter starts on an odd page.\n\n\\chapter{Second Chapter}\n\\lipsum[4-6]\nIf the previous chapter ended on an odd page,\na blank even page will be inserted before this chapter.\n\n\\chapter{Third Chapter}\n\\lipsum[7-9]\nConsistent odd-page chapter openings.\n\n\\end{document}"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-latex-formatting-document-sides-05/page-1.svg" alt="Compiled PDF page 1 from chapter-openings.tex" caption="Page 1 of 5. 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-latex-formatting-document-sides-05/page-2.svg" alt="Compiled PDF page 2 from chapter-openings.tex" caption="Page 2 of 5. 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-latex-formatting-document-sides-05/page-3.svg" alt="Compiled PDF page 3 from chapter-openings.tex" caption="Page 3 of 5. 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-latex-formatting-document-sides-05/page-4.svg" alt="Compiled PDF page 4 from chapter-openings.tex" caption="Page 4 of 5. 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-latex-formatting-document-sides-05/page-5.svg" alt="Compiled PDF page 5 from chapter-openings.tex" caption="Page 5 of 5. Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={595.276} height={841.89} />
</RenderedOutput>

## Practical Implementations

### Academic Paper Layout

<LatexSource filename="academic-layout.tex" source={"\\documentclass[12pt,letterpaper,twoside]{article}\n\\usepackage{fancyhdr}\n\\usepackage[inner=1.5in,outer=1in,top=1in,bottom=1in]{geometry}\n\n% Academic-style headers\n\\pagestyle{fancy}\n\\fancyhf{}\n\\fancyhead[LE]{\\textit{Author Name}}\n\\fancyhead[RO]{\\textit{Paper Title}}\n\\fancyfoot[LE,RO]{\\thepage}\n\n% Special style for first page\n\\fancypagestyle{firstpage}{%\n  \\fancyhf{}\n  \\fancyfoot[C]{\\thepage}\n  \\renewcommand{\\headrulewidth}{0pt}\n}\n\n\\begin{document}\n\n\\thispagestyle{firstpage}\n\\title{Academic Paper Title}\n\\author{Author Name}\n\\maketitle\n\n\\begin{abstract}\nPaper abstract content...\n\\end{abstract}\n\n\\section{Introduction}\nMain content begins here with regular headers.\n\n\\newpage\n\\section{Literature Review}\nContent continues with appropriate headers for even pages.\n\n\\end{document}"} />

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

  <LatexPreview src="/images/rendered/learn-latex-formatting-document-sides-06/page-2.svg" alt="Compiled PDF page 2 from academic-layout.tex" caption="Page 2 of 2. Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={612} height={792} />
</RenderedOutput>

### Book Layout

<LatexSource filename="book-layout.tex" source={"\\documentclass[11pt,twoside,openright]{book}\n\\usepackage{fancyhdr}\n\\usepackage[inner=1.25in,outer=0.75in,top=1in,bottom=1in,bindingoffset=0.25in]{geometry}\n\n% Book-style headers\n\\pagestyle{fancy}\n\\fancyhf{}\n\\fancyhead[LE]{\\leftmark}   % Chapter on left of even pages\n\\fancyhead[RO]{\\rightmark}  % Section on right of odd pages\n\\fancyfoot[LE,RO]{\\thepage}\n\n% Chapter pages use plain style\n\\fancypagestyle{plain}{%\n  \\fancyhf{}\n  \\fancyfoot[C]{\\thepage}\n  \\renewcommand{\\headrulewidth}{0pt}\n}\n\n\\begin{document}\n\n\\frontmatter\n\\tableofcontents\n\n\\mainmatter\n\\chapter{Introduction}\nBook content with professional layout.\n\n\\section{Overview}\nSections appear in headers on odd pages.\n\n\\chapter{Main Content}\nNew chapters start on odd pages with binding considerations.\n\n\\end{document}"} />

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

  <LatexPreview src="/images/rendered/learn-latex-formatting-document-sides-07/page-2.svg" alt="Compiled PDF page 2 from book-layout.tex" caption="Page 2 of 5. Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={612} height={792} />

  <LatexPreview src="/images/rendered/learn-latex-formatting-document-sides-07/page-3.svg" alt="Compiled PDF page 3 from book-layout.tex" caption="Page 3 of 5. Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={612} height={792} />

  <LatexPreview src="/images/rendered/learn-latex-formatting-document-sides-07/page-4.svg" alt="Compiled PDF page 4 from book-layout.tex" caption="Page 4 of 5. Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={612} height={792} />

  <LatexPreview src="/images/rendered/learn-latex-formatting-document-sides-07/page-5.svg" alt="Compiled PDF page 5 from book-layout.tex" caption="Page 5 of 5. Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={612} height={792} />
</RenderedOutput>

### Business Report Layout

<LatexSource filename="business-layout.tex" source={"\\documentclass[11pt,oneside]{article}\n\\usepackage{fancyhdr}\n\\usepackage[margin=1in]{geometry}\n\n% Business document typically uses oneside for simplicity\n\\pagestyle{fancy}\n\\fancyhf{}\n\\fancyhead[L]{\\textbf{Business Report}}\n\\fancyhead[R]{\\today}\n\\fancyfoot[L]{Company Name}\n\\fancyfoot[C]{Page \\thepage}\n\\fancyfoot[R]{Confidential}\n\n\\renewcommand{\\headrulewidth}{0.4pt}\n\\renewcommand{\\footrulewidth}{0.4pt}\n\n\\begin{document}\n\n\\title{Quarterly Business Report}\n\\author{Analysis Team}\n\\maketitle\n\n\\section{Executive Summary}\nBusiness reports often use single-sided layout for easier digital distribution.\n\n\\section{Financial Analysis}\nConsistent margins and headers work well for business documents.\n\n\\end{document}"} />

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

## Converting Between Layouts

### From Oneside to Twoside

<LatexSource filename="convert-to-twoside.tex" source={"% Original oneside document\n% \\documentclass[oneside]{article}\n\n% Convert to twoside\n\\documentclass[twoside]{article}\n\\usepackage{fancyhdr}\n\n% Update margins for binding\n\\usepackage[inner=1.5in,outer=1in,top=1in,bottom=1in]{geometry}\n\n% Update headers for two-sided layout\n\\pagestyle{fancy}\n\\fancyhf{}\n\n% Change from:\n% \\fancyhead[L]{Title}\n% \\fancyhead[R]{\\thepage}\n\n% To:\n\\fancyhead[LE,RO]{\\thepage}\n\\fancyhead[LO,RE]{Document Title}\n\n\\begin{document}\n\nContent that now works with two-sided layout...\n\n\\end{document}"} />

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

### From Twoside to Oneside

<LatexSource filename="convert-to-oneside.tex" source={"% Original twoside document\n% \\documentclass[twoside]{book}\n\n% Convert to oneside for digital distribution\n\\documentclass[oneside]{report}\n\n% Simplify margins\n\\usepackage[margin=1in]{geometry}\n\n% Simplify headers\n\\usepackage{fancyhdr}\n\\pagestyle{fancy}\n\\fancyhf{}\n\n% Change from:\n% \\fancyhead[LE,RO]{\\thepage}\n% \\fancyhead[LO,RE]{Title}\n\n% To:\n\\fancyhead[L]{Document Title}\n\\fancyhead[R]{\\thepage}\n\n\\begin{document}\n\nContent adapted for single-sided digital viewing...\n\n\\end{document}"} />

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

## Print Considerations

### Binding Offset

<LatexSource filename="binding-considerations.tex" source={"\\documentclass[twoside]{book}\n\\usepackage{geometry}\n\n% Account for binding in printed documents\n\\geometry{\n    paperwidth=8.5in,\n    paperheight=11in,\n    inner=1.5in,      % Space for binding\n    outer=1in,        % Outer margin\n    top=1in,\n    bottom=1in,\n    bindingoffset=0.25in  % Extra space for binding\n}\n\n% Alternative: specify total text area\n% \\geometry{\n%     textwidth=5.5in,\n%     textheight=8.5in,\n%     hoffset=0.5in,   % Adjust horizontal offset\n%     bindingoffset=0.25in\n% }\n\n\\begin{document}\n\n\\chapter{Binding Considerations}\nThis layout accounts for the space lost to binding in printed books.\n\nThe binding offset ensures text doesn't disappear into the spine.\n\n\\end{document}"} />

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

### Crop Marks and Bleed

<LatexSource filename="print-preparation.tex" source={"\\documentclass[twoside]{book}\n\\usepackage[cam,a4,center]{crop}  % Add crop marks\n\\usepackage{geometry}\n\n% Set up for commercial printing\n\\geometry{\n    paperwidth=8.5in,\n    paperheight=11in,\n    total={6in,9in},\n    inner=1.25in,\n    top=1in,\n    includefoot,\n    footskip=0.5in\n}\n\n% Ensure no content in bleed area\n\\setlength{\\topmargin}{0pt}\n\\setlength{\\headheight}{12pt}\n\\setlength{\\headsep}{25pt}\n\n\\begin{document}\n\n\\chapter{Print-Ready Layout}\nThis document is prepared for commercial printing with proper margins and crop marks.\n\n\\end{document}"} />

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

## Digital vs Print Optimization

### PDF Viewing Optimization

<LatexSource filename="digital-optimization.tex" source={"\\documentclass[oneside]{article}\n\\usepackage{hyperref}\n\n% Optimize for screen viewing\n\\hypersetup{\n    colorlinks=true,\n    linkcolor=blue,\n    citecolor=green,\n    filecolor=magenta,\n    urlcolor=cyan,\n    pdfpagemode=UseOutlines,\n    bookmarksopen=true\n}\n\n% Use comfortable margins for screen reading\n\\usepackage[margin=1in]{geometry}\n\n% Single-column layout works better on screens\n% Avoid multiple columns for digital documents\n\n\\begin{document}\n\n\\section{Digital Document}\nThis layout is optimized for comfortable screen reading.\n\nLinks are colored and clickable in PDF viewers.\n\n\\end{document}"} />

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

### Print Optimization

<LatexSource filename="print-optimization.tex" source={"\\documentclass[twoside,11pt]{book}\n\\usepackage{microtype}  % Better typography for print\n\n% Professional print margins\n\\usepackage[inner=1.5in,outer=1in,top=1.25in,bottom=1in]{geometry}\n\n% Print-friendly settings\n\\usepackage{hyperref}\n\\hypersetup{\n    colorlinks=false,  % Black links for print\n    pdfborder={0 0 0}  % No colored borders\n}\n\n% Optimize line spacing for print\n\\linespread{1.1}\n\n\\begin{document}\n\n\\chapter{Print Document}\nThis layout is optimized for high-quality print production.\n\nTypography and spacing are tuned for paper reading.\n\n\\end{document}"} />

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

## Troubleshooting Layout Issues

### Common Problems

<LatexSource filename="troubleshooting.tex" source={"\\documentclass[twoside]{article}\n\\usepackage{fancyhdr}\n\n% Problem: Headers not changing for odd/even pages\n% Solution: Use correct position specifiers\n\\pagestyle{fancy}\n\\fancyhf{}\n\\fancyhead[LE,RO]{\\thepage}  % Correct\n% \\fancyhead[L,R]{\\thepage}  % Wrong - same on all pages\n\n% Problem: Inconsistent margins\n% Solution: Use inner/outer instead of left/right\n\\usepackage[inner=1.5in,outer=1in,top=1in,bottom=1in]{geometry}\n% Not: left=1.5in,right=1in (doesn't flip for even pages)\n\n% Problem: Chapters not starting on odd pages\n% Solution: Use openright option\n% \\documentclass[twoside,openright]{book}\n\n% Problem: Text too close to binding\n% Solution: Add binding offset\n% \\geometry{bindingoffset=0.25in}\n\n\\begin{document}\nProperly configured two-sided document...\n\\end{document}"} />

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

## Best Practices

<Tip>
  **Layout decision guidelines:**

  1. **Choose oneside for:**
     * Digital-only documents
     * Simple reports and articles
     * Documents under 20 pages
     * Quick reference materials

  2. **Choose twoside for:**
     * Books and long documents
     * Academic papers and theses
     * Documents intended for binding
     * Professional publications

  3. **Consider your audience:**
     * Will they print single or double-sided?
     * How will they consume the document?
     * What are the formatting requirements?
</Tip>

### Decision Matrix

| Document Type     | Recommended Setting | Reason                     |
| ----------------- | ------------------- | -------------------------- |
| Email/Web article | `oneside`           | Digital viewing            |
| Academic paper    | `twoside`           | Professional formatting    |
| Business memo     | `oneside`           | Simple distribution        |
| Book/thesis       | `twoside`           | Binding considerations     |
| Technical manual  | `twoside`           | Professional appearance    |
| Quick reference   | `oneside`           | Easy single-sided printing |

## Quick Reference

### Document Class Options

| Option      | Effect                                       |
| ----------- | -------------------------------------------- |
| `oneside`   | Single-sided layout, consistent margins      |
| `twoside`   | Double-sided layout, mirrored margins        |
| `openright` | Chapters start on odd pages (with `twoside`) |
| `openany`   | Chapters can start on any page               |

### Geometry Package Options

| Option          | Purpose                     |
| --------------- | --------------------------- |
| `inner`         | Binding side margin         |
| `outer`         | Outer edge margin           |
| `bindingoffset` | Extra space for binding     |
| `left`/`right`  | Specific left/right margins |

### fancyhdr Position Codes

| Code | Meaning             |
| ---- | ------------------- |
| `LE` | Left on even pages  |
| `RO` | Right on odd pages  |
| `LO` | Left on odd pages   |
| `RE` | Right on even pages |

***

<Info>
  **Next**: Learn about [Multiple columns layout](/learn/latex/formatting/multiple-columns) for advanced page layouts, or explore [Headers and footers](/learn/latex/formatting/headers-footers) for comprehensive layout principles.
</Info>
