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

# Creating Professional Tables in LaTeX

> Master advanced LaTeX tables with booktabs, multirow, multicolumn, longtable. Professional formatting for publication-quality results.

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

Create publication-quality tables with advanced formatting, proper alignment, and professional styling. This guide covers everything from basic tables to complex multi-page layouts with advanced features.

<Info>
  **Prerequisites**: Basic LaTeX knowledge\
  **Time to complete**: 30-35 minutes\
  **Difficulty**: Intermediate to Advanced\
  **Key packages**: booktabs, multirow, longtable, tabularx, array
</Info>

## Professional Table Design Principles

### Why Good Tables Matter

<Tip>
  **Golden rules for professional tables**:

  1. **Never use vertical lines** - They clutter the table
  2. **Use horizontal lines sparingly** - Only for structure
  3. **Add appropriate spacing** - Don't compress data
  4. **Align numbers properly** - Decimal alignment for data
  5. **Use consistent formatting** - Same style throughout
</Tip>

### Essential Packages

<LatexSource filename="table-packages.tex" source={"% Core packages for professional tables\n\\usepackage{booktabs}      % Professional horizontal lines\n\\usepackage{array}         % Enhanced column types\n\\usepackage{multirow}      % Cells spanning multiple rows\n\\usepackage{makecell}      % Line breaks in cells\n\\usepackage{tabularx}      % Tables with calculated widths\n\\usepackage{longtable}     % Multi-page tables\n\\usepackage{xcolor}        % Colored cells\n\\usepackage{colortbl}      % Colored columns\n\\usepackage{siunitx}       % Number alignment\n\\usepackage{threeparttable} % Tables with notes"} />

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

## Basic Professional Tables

### The Booktabs Approach

<LatexSource filename="booktabs-basic.tex" source={"\\documentclass{article}\n\\usepackage{booktabs}\n\n\\begin{document}\n\n% Bad example - what NOT to do\n\\begin{table}[htbp]\n    \\centering\n    \\caption{Poor table design (avoid this)}\n    \\begin{tabular}{|l|c|c|c|}\n        \\hline\n        Item & Quantity & Unit Price & Total \\\\\n        \\hline\n        Apples & 5 & \\$1.20 & \\$6.00 \\\\\n        \\hline\n        Oranges & 3 & \\$0.80 & \\$2.40 \\\\\n        \\hline\n        Bananas & 12 & \\$0.30 & \\$3.60 \\\\\n        \\hline\n        \\multicolumn{3}{|r|}{Total:} & \\$12.00 \\\\\n        \\hline\n    \\end{tabular}\n\\end{table}\n\n% Good example - professional design\n\\begin{table}[htbp]\n    \\centering\n    \\caption{Professional table design}\n    \\label{tab:good-example}\n    \\begin{tabular}{lccc}\n        \\toprule\n        Item & Quantity & Unit Price & Total \\\\\n        \\midrule\n        Apples & 5 & \\$1.20 & \\$6.00 \\\\\n        Oranges & 3 & \\$0.80 & \\$2.40 \\\\\n        Bananas & 12 & \\$0.30 & \\$3.60 \\\\\n        \\midrule\n        \\multicolumn{3}{r}{Total:} & \\$12.00 \\\\\n        \\bottomrule\n    \\end{tabular}\n\\end{table}\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_how_to_professional_tables">
  <LatexPreview src="/images/rendered/learn-latex-how-to-professional-tables-02/page-1.svg" alt="Compiled PDF page 1 from booktabs-basic.tex" caption="Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={595.276} height={841.89} />
</RenderedOutput>

<LatexSource filename="column-types.tex" source={"% Enhanced column types with array package\n\\usepackage{array}\n\n\\begin{table}[htbp]\n    \\centering\n    \\caption{Column type examples}\n    \\begin{tabular}{\n        >{\\bfseries}l  % Bold left-aligned\n        c              % Centered\n        >{\\ttfamily}r  % Monospace right-aligned\n        S[table-format=3.2] % siunitx number column\n    }\n        \\toprule\n        Name & Status & Code & {Value} \\\\\n        \\midrule\n        Alpha & Active & A001 & 123.45 \\\\\n        Beta & Inactive & B002 & 67.89 \\\\\n        Gamma & Pending & C003 & 234.56 \\\\\n        \\bottomrule\n    \\end{tabular}\n\\end{table}"} />

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

### Column Specifications

<LatexSource filename="advanced-columns.tex" source={"\\usepackage{array}\n\\usepackage{ragged2e}\n\n% Define custom column types\n\\newcolumntype{L}[1]{>{\\raggedright\\arraybackslash}p{#1}}\n\\newcolumntype{C}[1]{>{\\centering\\arraybackslash}p{#1}}\n\\newcolumntype{R}[1]{>{\\raggedleft\\arraybackslash}p{#1}}\n\\newcolumntype{M}[1]{>{\\centering\\arraybackslash}m{#1}}\n\n\\begin{table}[htbp]\n    \\centering\n    \\caption{Custom column types}\n    \\begin{tabular}{L{3cm} C{2cm} R{2cm} M{2cm}}\n        \\toprule\n        Left aligned with fixed width &\n        Centered fixed width &\n        Right aligned width &\n        Middle aligned \\\\\n        \\midrule\n        This text will wrap and align to the left &\n        Center &\n        Right &\n        Vertically centered \\\\\n        \\bottomrule\n    \\end{tabular}\n\\end{table}"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-latex-how-to-professional-tables-04/page-1.svg" alt="Compiled PDF page 1 from advanced-columns.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>

## Numeric Tables

### Aligning Numbers

<LatexSource filename="numeric-alignment.tex" source={"\\usepackage{siunitx}\n\\usepackage{booktabs}\n\n\\begin{table}[htbp]\n    \\centering\n    \\caption{Scientific data with proper alignment}\n    \\begin{tabular}{\n        l\n        S[table-format=3.2(2)]  % 3 digits.2 decimals (2 uncertainty)\n        S[table-format=4.3e2]   % Scientific notation\n        S[table-format=2.1, table-space-text-post={\\%}]  % Percentage\n    }\n        \\toprule\n        Sample & {Measurement} & {Concentration} & {Efficiency} \\\\\n        & {(\\si{\\milli\\gram})} & {(\\si{\\mole\\per\\liter})} & {(\\%)} \\\\\n        \\midrule\n        A & 123.45(23) & 1.234e-3 & 95.2\\% \\\\\n        B & 67.89(12) & 5.678e-4 & 87.5\\% \\\\\n        C & 234.56(34) & 9.012e-3 & 92.1\\% \\\\\n        D & 12.34(5) & 3.456e-5 & 78.9\\% \\\\\n        \\midrule\n        Mean & 109.56 & 2.794e-3 & 88.4\\% \\\\\n        \\bottomrule\n    \\end{tabular}\n\\end{table}\n\n% Configure siunitx globally\n\\sisetup{\n    round-mode = places,\n    round-precision = 2,\n    group-separator = {,},\n    group-minimum-digits = 4\n}"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-latex-how-to-professional-tables-05/page-1.svg" alt="Compiled PDF page 1 from numeric-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={612} height={792} />
</RenderedOutput>

<LatexSource filename="financial-tables.tex" source={"\\usepackage{siunitx}\n\\usepackage{booktabs}\n\n\\begin{table}[htbp]\n    \\centering\n    \\caption{Financial report}\n    \\sisetup{\n        table-format = 7.2,\n        group-separator = {,},\n        group-minimum-digits = 4\n    }\n    \\begin{tabular}{\n        l\n        S[table-format=7.2]\n        S[table-format=7.2]\n        S[table-format=3.1, table-space-text-post={\\%}]\n    }\n        \\toprule\n        Department & {2022 (\\$)} & {2023 (\\$)} & {Change} \\\\\n        \\midrule\n        Sales & 1234567.89 & 1456789.12 & 18.0\\% \\\\\n        Marketing & 234567.89 & 267890.23 & 14.2\\% \\\\\n        Operations & 3456789.01 & 3789012.34 & 9.6\\% \\\\\n        R\\&D & 567890.12 & 678901.23 & 19.5\\% \\\\\n        \\midrule\n        \\textbf{Total} & \\textbf{5493814.91} & \\textbf{6193592.92} & \\textbf{12.7\\%} \\\\\n        \\bottomrule\n    \\end{tabular}\n\\end{table}"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-latex-how-to-professional-tables-06/page-1.svg" alt="Compiled PDF page 1 from financial-tables.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={612} height={792} />
</RenderedOutput>

## Multi-row and Multi-column Tables

### Spanning Cells

<LatexSource filename="multirow-multicolumn.tex" source={"\\usepackage{multirow}\n\\usepackage{booktabs}\n\n\\begin{table}[htbp]\n    \\centering\n    \\caption{Complex table with merged cells}\n    \\begin{tabular}{lccccc}\n        \\toprule\n        \\multirow{2}{*}{Region} &\n        \\multicolumn{2}{c}{Q1 2023} &\n        \\multicolumn{2}{c}{Q2 2023} &\n        \\multirow{2}{*}{Total} \\\\\n        \\cmidrule(lr){2-3} \\cmidrule(lr){4-5}\n        & Sales & Profit & Sales & Profit & \\\\\n        \\midrule\n        North & 120 & 24 & 135 & 28 & 307 \\\\\n        South & 98 & 18 & 102 & 20 & 238 \\\\\n        East & 156 & 31 & 162 & 33 & 382 \\\\\n        West & 134 & 26 & 141 & 29 & 330 \\\\\n        \\midrule\n        \\textbf{Total} & \\textbf{508} & \\textbf{99} & \\textbf{540} & \\textbf{110} & \\textbf{1257} \\\\\n        \\bottomrule\n    \\end{tabular}\n\\end{table}\n\n% More complex example\n\\begin{table}[htbp]\n    \\centering\n    \\caption{Product comparison matrix}\n    \\begin{tabular}{lcccc}\n        \\toprule\n        \\multirow{3}{*}{\\textbf{Feature}} &\n        \\multicolumn{4}{c}{\\textbf{Product Models}} \\\\\n        \\cmidrule{2-5}\n        & \\multicolumn{2}{c}{Standard} & \\multicolumn{2}{c}{Premium} \\\\\n        \\cmidrule(lr){2-3} \\cmidrule(lr){4-5}\n        & Basic & Plus & Pro & Elite \\\\\n        \\midrule\n        Storage & 100GB & 500GB & 1TB & 5TB \\\\\n        \\multirow{2}{*}{Support} & Email & Email & 24/7 & 24/7 \\\\\n        & -- & Chat & Phone & Priority \\\\\n        API Access & \\multicolumn{2}{c}{Limited} & \\multicolumn{2}{c}{Unlimited} \\\\\n        \\midrule\n        Price/month & \\$9 & \\$19 & \\$49 & \\$99 \\\\\n        \\bottomrule\n    \\end{tabular}\n\\end{table}"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-latex-how-to-professional-tables-07/page-1.svg" alt="Compiled PDF page 1 from multirow-multicolumn.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>

### Nested Tables

<LatexSource filename="nested-tables.tex" source={"\\usepackage{makecell}\n\n\\begin{table}[htbp]\n    \\centering\n    \\caption{Table with nested content}\n    \\begin{tabular}{lcc}\n        \\toprule\n        Parameter & Configuration & Result \\\\\n        \\midrule\n        Algorithm &\n        \\begin{tabular}[c]{@{}c@{}}\n            Method: SVM \\\\\n            Kernel: RBF \\\\\n            C: 1.0\n        \\end{tabular} &\n        \\begin{tabular}[c]{@{}c@{}}\n            Accuracy: 95.2\\% \\\\\n            F1: 0.94\n        \\end{tabular} \\\\\n        \\midrule\n        Dataset &\n        \\makecell{Training: 80\\% \\\\ Validation: 10\\% \\\\ Test: 10\\%} &\n        \\makecell{Total: 10,000 \\\\ Features: 25} \\\\\n        \\bottomrule\n    \\end{tabular}\n\\end{table}"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-latex-how-to-professional-tables-08/page-1.svg" alt="Compiled PDF page 1 from nested-tables.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>

## Wide Tables

### Tables Wider Than Text

<LatexSource filename="tabularx-example.tex" source={"\\usepackage{tabularx}\n\\usepackage{booktabs}\n\n% Table that automatically fits text width\n\\begin{table}[htbp]\n    \\centering\n    \\caption{Table fitting text width with tabularx}\n    \\begin{tabularx}{\\textwidth}{lXXr}\n        \\toprule\n        ID & Description & Comments & Score \\\\\n        \\midrule\n        001 & This is a long description that would normally overflow & Additional comments here & 95 \\\\\n        002 & Another lengthy text entry & More commentary & 87 \\\\\n        003 & Short & Brief & 92 \\\\\n        \\bottomrule\n    \\end{tabularx}\n\\end{table}\n\n% Custom column types for tabularx\n\\newcolumntype{Y}{>{\\centering\\arraybackslash}X}\n\\newcolumntype{Z}{>{\\raggedleft\\arraybackslash}X}\n\n\\begin{table}[htbp]\n    \\centering\n    \\caption{Centered and right-aligned X columns}\n    \\begin{tabularx}{\\textwidth}{lYYZ}\n        \\toprule\n        Item & Center 1 & Center 2 & Right \\\\\n        \\midrule\n        A & Text & More text & 123 \\\\\n        B & Centered & Also centered & 456 \\\\\n        \\bottomrule\n    \\end{tabularx}\n\\end{table}"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-latex-how-to-professional-tables-09/page-1.svg" alt="Compiled PDF page 1 from tabularx-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>

<LatexSource filename="adjustbox-tables.tex" source={"\\usepackage{adjustbox}\n\n% Scale table to fit\n\\begin{table}[htbp]\n    \\centering\n    \\caption{Scaled table to fit page width}\n    \\adjustbox{width=\\textwidth}{%\n    \\begin{tabular}{lcccccccc}\n        \\toprule\n        Category & Jan & Feb & Mar & Apr & May & Jun & Jul & Aug \\\\\n        \\midrule\n        Revenue & 1234 & 2345 & 3456 & 4567 & 5678 & 6789 & 7890 & 8901 \\\\\n        Expenses & 987 & 876 & 765 & 654 & 543 & 432 & 321 & 210 \\\\\n        Profit & 247 & 1469 & 2691 & 3913 & 5135 & 6357 & 7569 & 8691 \\\\\n        \\bottomrule\n    \\end{tabular}\n    }\n\\end{table}\n\n% Rotate wide table\n\\begin{table}[htbp]\n    \\centering\n    \\caption{Rotated wide table}\n    \\adjustbox{angle=90}{%\n    \\begin{tabular}{lccccccccccc}\n        \\toprule\n        Metric & M1 & M2 & M3 & M4 & M5 & M6 & M7 & M8 & M9 & M10 & M11 \\\\\n        \\midrule\n        Value A & 12 & 23 & 34 & 45 & 56 & 67 & 78 & 89 & 90 & 101 & 112 \\\\\n        Value B & 21 & 32 & 43 & 54 & 65 & 76 & 87 & 98 & 109 & 120 & 131 \\\\\n        \\bottomrule\n    \\end{tabular}\n    }\n\\end{table}"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-latex-how-to-professional-tables-10/page-1.svg" alt="Compiled PDF page 1 from adjustbox-tables.tex" caption="Page 1 of 2. 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={612} height={792} />

  <LatexPreview src="/images/rendered/learn-latex-how-to-professional-tables-10/page-2.svg" alt="Compiled PDF page 2 from adjustbox-tables.tex" caption="Page 2 of 2. 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={612} height={792} />
</RenderedOutput>

## Multi-page Tables

### Long Tables

<LatexSource filename="longtable-example.tex" source={"\\usepackage{longtable}\n\\usepackage{booktabs}\n\n\\begin{longtable}{lccr}\n    \\caption{Multi-page data table} \\label{tab:long} \\\\\n\n    % First header\n    \\toprule\n    Item & Quantity & Unit Price & Total \\\\\n    \\midrule\n    \\endfirsthead\n\n    % Continued header\n    \\multicolumn{4}{c}{\\tablename\\ \\thetable{} -- continued from previous page} \\\\\n    \\toprule\n    Item & Quantity & Unit Price & Total \\\\\n    \\midrule\n    \\endhead\n\n    % Footer except last page\n    \\midrule\n    \\multicolumn{4}{r}{Continued on next page} \\\\\n    \\endfoot\n\n    % Last footer\n    \\bottomrule\n    \\multicolumn{3}{r}{Grand Total:} & \\$12,345.67 \\\\\n    \\bottomrule\n    \\endlastfoot\n\n    % Table data\n    Product A & 10 & \\$12.50 & \\$125.00 \\\\\n    Product B & 25 & \\$8.75 & \\$218.75 \\\\\n    Product C & 15 & \\$15.00 & \\$225.00 \\\\\n    % ... many more rows ...\n    Product Z & 100 & \\$5.00 & \\$500.00 \\\\\n\n\\end{longtable}"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-latex-how-to-professional-tables-11/page-1.svg" alt="Compiled PDF page 1 from longtable-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>

<LatexSource filename="longtabu-example.tex" source={"\\usepackage{longtabu}\n\n% Combination of longtable and tabularx\n\\begin{longtabu} to \\textwidth {X[l] X[2,c] X[r]}\n    \\caption{Flexible multi-page table} \\\\\n    \\toprule\n    Left Column & Center Column (2x width) & Right Column \\\\\n    \\midrule\n    \\endhead\n\n    Data 1 & This column gets more space & Value 1 \\\\\n    Data 2 & Automatically distributed & Value 2 \\\\\n    % ... more rows ...\n\n\\end{longtabu}"} />

<RenderedOutput title="Expected effect">
  <Info>
    This excerpt depends on project files such as images, bibliography data, or included TeX sources that are not part of this standalone code box. Its exact output is project-specific, so no fabricated preview is shown.
  </Info>
</RenderedOutput>

## Colored Tables

### Row and Column Colors

<LatexSource filename="colored-tables.tex" source={"\\usepackage{xcolor}\n\\usepackage{colortbl}\n\n% Define colors\n\\definecolor{headerblue}{RGB}{20, 100, 200}\n\\definecolor{rowgray}{RGB}{240, 240, 240}\n\n\\begin{table}[htbp]\n    \\centering\n    \\caption{Table with colored rows}\n    \\begin{tabular}{lccr}\n        \\rowcolor{headerblue}\n        \\textcolor{white}{\\textbf{Product}} &\n        \\textcolor{white}{\\textbf{Q1}} &\n        \\textcolor{white}{\\textbf{Q2}} &\n        \\textcolor{white}{\\textbf{Total}} \\\\\n        \\rowcolor{rowgray}\n        Widget A & 120 & 135 & 255 \\\\\n        Widget B & 98 & 102 & 200 \\\\\n        \\rowcolor{rowgray}\n        Widget C & 156 & 162 & 318 \\\\\n        Widget D & 134 & 141 & 275 \\\\\n        \\midrule\n        \\textbf{Total} & \\textbf{508} & \\textbf{540} & \\textbf{1048} \\\\\n    \\end{tabular}\n\\end{table}\n\n% Alternating row colors\n\\usepackage{array}\n\\rowcolors{2}{rowgray}{white}\n\n\\begin{table}[htbp]\n    \\centering\n    \\caption{Alternating row colors}\n    \\begin{tabular}{lccc}\n        \\toprule\n        \\rowcolor{headerblue}\n        \\textcolor{white}{Name} &\n        \\textcolor{white}{Score} &\n        \\textcolor{white}{Grade} &\n        \\textcolor{white}{Pass} \\\\\n        \\midrule\n        Alice & 95 & A & Yes \\\\\n        Bob & 87 & B & Yes \\\\\n        Charlie & 78 & C & Yes \\\\\n        David & 92 & A & Yes \\\\\n        Eve & 68 & D & Yes \\\\\n        Frank & 55 & F & No \\\\\n        \\bottomrule\n    \\end{tabular}\n\\end{table}"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-latex-how-to-professional-tables-13/page-1.svg" alt="Compiled PDF page 1 from colored-tables.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={612} height={792} />
</RenderedOutput>

<LatexSource filename="cell-colors.tex" source={"% Individual cell coloring\n\\begin{table}[htbp]\n    \\centering\n    \\caption{Heat map style table}\n    \\begin{tabular}{lccc}\n        \\toprule\n        Metric & Low & Medium & High \\\\\n        \\midrule\n        Risk & \\cellcolor{green!30}2.1 & \\cellcolor{yellow!30}5.4 & \\cellcolor{red!30}8.9 \\\\\n        Cost & \\cellcolor{green!30}Low & \\cellcolor{yellow!30}Moderate & \\cellcolor{red!30}High \\\\\n        Impact & \\cellcolor{red!30}Major & \\cellcolor{yellow!30}Minor & \\cellcolor{green!30}None \\\\\n        \\bottomrule\n    \\end{tabular}\n\\end{table}"} />

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

## Tables with Notes

### Three-part Tables

<LatexSource filename="threeparttable.tex" source={"\\usepackage{threeparttable}\n\\usepackage{booktabs}\n\n\\begin{table}[htbp]\n    \\centering\n    \\begin{threeparttable}\n        \\caption{Results with footnotes}\n        \\begin{tabular}{lccc}\n            \\toprule\n            Method & Accuracy\\tnote{a} & Precision & Recall\\tnote{b} \\\\\n            \\midrule\n            SVM & 95.2 & 94.1 & 96.3 \\\\\n            Random Forest & 93.8 & 92.5 & 95.1 \\\\\n            Neural Network\\tnote{c} & 97.1 & 96.8 & 97.4 \\\\\n            \\bottomrule\n        \\end{tabular}\n        \\begin{tablenotes}\n            \\small\n            \\item[a] Average over 10-fold cross-validation\n            \\item[b] Weighted average across all classes\n            \\item[c] 3-layer architecture with dropout\n        \\end{tablenotes}\n    \\end{threeparttable}\n\\end{table}\n\n% With source note\n\\begin{table}[htbp]\n    \\centering\n    \\begin{threeparttable}\n        \\caption{Economic indicators}\n        \\begin{tabular}{lrrr}\n            \\toprule\n            Country & GDP\\tnote{*} & Growth & Inflation \\\\\n            \\midrule\n            USA & 21,433 & 2.3\\% & 1.8\\% \\\\\n            China & 14,343 & 6.1\\% & 2.9\\% \\\\\n            Japan & 5,082 & 0.7\\% & 0.5\\% \\\\\n            \\bottomrule\n        \\end{tabular}\n        \\begin{tablenotes}\n            \\small\n            \\item[*] In billions USD\n            \\item[Source:] World Bank, 2023\n        \\end{tablenotes}\n    \\end{threeparttable}\n\\end{table}"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-latex-how-to-professional-tables-15/page-1.svg" alt="Compiled PDF page 1 from threeparttable.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 Formatting

### Custom Rules and Spacing

<LatexSource filename="custom-formatting.tex" source={"\\usepackage{booktabs}\n\\usepackage{array}\n\n% Custom rule thickness\n\\begin{table}[htbp]\n    \\centering\n    \\caption{Custom rule thickness}\n    \\begin{tabular}{@{}lcc@{}}\n        \\toprule[1.5pt]\n        Category & Value A & Value B \\\\\n        \\midrule[0.8pt]\n        First & 123 & 456 \\\\\n        Second & 789 & 012 \\\\\n        \\cmidrule[0.5pt](lr){2-3}\n        Total & 912 & 468 \\\\\n        \\bottomrule[1.5pt]\n    \\end{tabular}\n\\end{table}\n\n% Custom spacing\n\\begin{table}[htbp]\n    \\centering\n    \\caption{Custom spacing}\n    \\setlength{\\tabcolsep}{10pt} % Column separation\n    \\renewcommand{\\arraystretch}{1.5} % Row stretch\n    \\begin{tabular}{lcc}\n        \\toprule\n        Item & Quantity & Price \\\\\n        \\midrule\n        Apple & 5 & \\$2.50 \\\\\n        Orange & 3 & \\$1.80 \\\\\n        \\bottomrule\n    \\end{tabular}\n\\end{table}\n\n% Remove space around table\n\\begin{table}[htbp]\n    \\centering\n    \\caption{Compact table}\n    \\begin{tabular}{@{}lcc@{}}\n        \\toprule\n        Compact & No Space & Edges \\\\\n        \\midrule\n        Data & 123 & 456 \\\\\n        \\bottomrule\n    \\end{tabular}\n\\end{table}"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-latex-how-to-professional-tables-16/page-1.svg" alt="Compiled PDF page 1 from custom-formatting.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>

### Professional Examples

<LatexSource filename="publication-table.tex" source={"\\documentclass{article}\n\\usepackage{booktabs}\n\\usepackage{siunitx}\n\\usepackage{threeparttable}\n\n\\begin{document}\n\n\\begin{table}[htbp]\n    \\centering\n    \\begin{threeparttable}\n        \\caption{Comparison of machine learning algorithms on benchmark datasets}\n        \\label{tab:ml-comparison}\n        \\begin{tabular}{\n            l\n            S[table-format=2.1(2)]\n            S[table-format=2.1(2)]\n            S[table-format=2.1(2)]\n            S[table-format=3.1]\n            S[table-format=4.0]\n        }\n            \\toprule\n            Algorithm &\n            \\multicolumn{3}{c}{Accuracy (\\%)} &\n            {Time} &\n            {Memory} \\\\\n            \\cmidrule(lr){2-4}\n            & {MNIST} & {CIFAR-10} & {ImageNet} & {(s)} & {(MB)} \\\\\n            \\midrule\n            SVM & 94.5(5) & 68.2(8) & 45.3(12) & 12.3 & 1024 \\\\\n            Random Forest & 96.8(3) & 75.4(6) & 52.1(9) & 8.7 & 2048 \\\\\n            CNN\\tnote{a} & 99.2(1) & 92.1(2) & 76.8(4) & 45.6 & 4096 \\\\\n            ResNet-50\\tnote{b} & 99.5(1) & 94.5(2) & 82.3(3) & 123.4 & 8192 \\\\\n            Transformer\\tnote{c} & 99.1(1) & 95.8(1) & 87.6(2) & 234.5 & 16384 \\\\\n            \\midrule\n            \\textbf{Best} & \\textbf{99.5} & \\textbf{95.8} & \\textbf{87.6} & \\textbf{8.7} & \\textbf{1024} \\\\\n            \\bottomrule\n        \\end{tabular}\n        \\begin{tablenotes}\n            \\small\n            \\item[a] Custom 5-layer architecture\n            \\item[b] Pre-trained on ImageNet\n            \\item[c] Vision Transformer (ViT-B/16)\n            \\item Numbers in parentheses indicate standard deviation\n        \\end{tablenotes}\n    \\end{threeparttable}\n\\end{table}\n\n\\end{document}"} />

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

## Best Practices

### Table Design Checklist

<Tip>
  ✅ **Professional table checklist**:

  * [ ] Use booktabs for rules (no vertical lines)
  * [ ] Align numbers properly (decimal alignment)
  * [ ] Add appropriate spacing (not too cramped)
  * [ ] Use consistent formatting throughout
  * [ ] Include clear captions and labels
  * [ ] Add units in column headers, not cells
  * [ ] Use table notes for clarifications
  * [ ] Consider readability over decoration
  * [ ] Test table appearance in final document
  * [ ] Ensure tables fit within margins
</Tip>

### Common Mistakes to Avoid

<Warning>
  **Avoid these common table mistakes**:

  1. **Too many rules** - Less is more
  2. **Vertical lines** - Almost never needed
  3. **Colored cells for data** - Use sparingly
  4. **Inconsistent alignment** - Pick one style
  5. **Missing captions** - Every table needs one
  6. **Poor number formatting** - Use siunitx
  7. **Cramped layout** - Add breathing room
  8. **Overwide tables** - Consider rotation or splitting
</Warning>

## Complete Example

<LatexSource filename="complete-table-document.tex" source={"\\documentclass[11pt]{article}\n\\usepackage{booktabs}\n\\usepackage{siunitx}\n\\usepackage{multirow}\n\\usepackage{xcolor}\n\\usepackage{colortbl}\n\\usepackage{threeparttable}\n\\usepackage{tabularx}\n\\usepackage{array}\n\n% Setup\n\\sisetup{\n    round-mode = places,\n    round-precision = 2,\n    table-format = 3.2\n}\n\n\\definecolor{headercolor}{RGB}{70, 130, 180}\n\\newcolumntype{Y}{>{\\centering\\arraybackslash}X}\n\n\\begin{document}\n\n\\title{Professional Tables in LaTeX}\n\\author{Your Name}\n\\date{\\today}\n\\maketitle\n\n\\section{Introduction}\nThis document demonstrates professional table creation techniques.\n\n\\section{Basic Professional Table}\n\n\\begin{table}[htbp]\n    \\centering\n    \\caption{Quarterly sales report}\n    \\label{tab:sales}\n    \\begin{tabular}{lS[table-format=4.0]S[table-format=4.0]S[table-format=3.1]}\n        \\toprule\n        Region & {Q1 Sales} & {Q2 Sales} & {Growth (\\%)} \\\\\n        \\midrule\n        North & 1234 & 1456 & 18.0 \\\\\n        South & 2345 & 2678 & 14.2 \\\\\n        East & 3456 & 3890 & 12.6 \\\\\n        West & 4567 & 5234 & 14.6 \\\\\n        \\midrule\n        \\textbf{Total} & \\textbf{11602} & \\textbf{13258} & \\textbf{14.3} \\\\\n        \\bottomrule\n    \\end{tabular}\n\\end{table}\n\n\\section{Complex Multi-level Table}\n\n\\begin{table}[htbp]\n    \\centering\n    \\caption{Product performance metrics}\n    \\begin{tabular}{lccccc}\n        \\toprule\n        \\multirow{2}{*}{Product} &\n        \\multicolumn{2}{c}{Customer Satisfaction} &\n        \\multicolumn{2}{c}{Market Share} &\n        \\multirow{2}{*}{Revenue} \\\\\n        \\cmidrule(lr){2-3} \\cmidrule(lr){4-5}\n        & 2022 & 2023 & 2022 & 2023 & (Million \\$) \\\\\n        \\midrule\n        Product A & 4.2 & 4.5 & 23\\% & 26\\% & 45.6 \\\\\n        Product B & 3.8 & 4.1 & 18\\% & 19\\% & 34.2 \\\\\n        Product C & 4.5 & 4.6 & 31\\% & 29\\% & 67.8 \\\\\n        Product D & 3.9 & 4.3 & 28\\% & 26\\% & 52.4 \\\\\n        \\midrule\n        \\textbf{Average} & \\textbf{4.1} & \\textbf{4.4} & \\textbf{25\\%} & \\textbf{25\\%} & \\textbf{200.0} \\\\\n        \\bottomrule\n    \\end{tabular}\n\\end{table}\n\n\\section{Scientific Data Table}\n\n\\begin{table}[htbp]\n    \\centering\n    \\begin{threeparttable}\n        \\caption{Experimental results with statistical analysis}\n        \\begin{tabular}{\n            l\n            S[table-format=3.2(2)]\n            S[table-format=2.1(1)]\n            S[table-format=1.4]\n            c\n        }\n            \\toprule\n            Sample &\n            {Measurement} &\n            {Error (\\%)} &\n            {$p$-value} &\n            Significant \\\\\n            & {(\\si{\\micro\\gram\\per\\milli\\liter})} & & & \\\\\n            \\midrule\n            Control & 100.00(0) & 0.0(0) & -- & -- \\\\\n            Treatment A & 145.67(23) & 2.3(4) & 0.0012 & *** \\\\\n            Treatment B & 132.45(18) & 1.8(3) & 0.0089 & ** \\\\\n            Treatment C & 118.23(15) & 1.5(2) & 0.0234 & * \\\\\n            Treatment D & 108.90(12) & 1.2(2) & 0.1234 & ns \\\\\n            \\bottomrule\n        \\end{tabular}\n        \\begin{tablenotes}\n            \\small\n            \\item Significance levels: *** $p < 0.001$, ** $p < 0.01$, * $p < 0.05$, ns = not significant\n            \\item Values shown as mean(SD) for n=10 replicates\n        \\end{tablenotes}\n    \\end{threeparttable}\n\\end{table}\n\n\\section{Wide Table}\n\n\\begin{table}[htbp]\n    \\centering\n    \\caption{Comprehensive comparison across multiple criteria}\n    \\small % Reduce font size for wide table\n    \\begin{tabularx}{\\textwidth}{lYYYYYY}\n        \\toprule\n        \\rowcolor{headercolor}\n        \\textcolor{white}{Method} &\n        \\textcolor{white}{Speed} &\n        \\textcolor{white}{Accuracy} &\n        \\textcolor{white}{Precision} &\n        \\textcolor{white}{Recall} &\n        \\textcolor{white}{F1-Score} &\n        \\textcolor{white}{AUC-ROC} \\\\\n        \\midrule\n        \\rowcolor{gray!10}\n        Baseline & Fast & 85.2\\% & 83.1\\% & 87.4\\% & 0.852 & 0.891 \\\\\n        Method A & Medium & 91.3\\% & 90.2\\% & 92.5\\% & 0.913 & 0.942 \\\\\n        \\rowcolor{gray!10}\n        Method B & Slow & 93.7\\% & 92.8\\% & 94.6\\% & 0.937 & 0.961 \\\\\n        Method C & Fast & 89.5\\% & 88.3\\% & 90.8\\% & 0.895 & 0.923 \\\\\n        \\rowcolor{gray!10}\n        \\textbf{Proposed} & \\textbf{Medium} & \\textbf{95.8\\%} & \\textbf{95.1\\%} & \\textbf{96.5\\%} & \\textbf{0.958} & \\textbf{0.978} \\\\\n        \\bottomrule\n    \\end{tabularx}\n\\end{table}\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>

## Next Steps

Master more advanced LaTeX techniques:

<CardGroup cols={2}>
  <Card title="Managing Large Documents" icon="folder-tree" href="/learn/latex/how-to/large-documents">
    Organize tables in multi-file projects
  </Card>

  <Card title="Creating Figures" icon="image" href="/learn/latex/how-to/working-with-images">
    Combine tables with figures
  </Card>

  <Card title="TikZ Diagrams" icon="draw-polygon" href="/learn/latex/how-to/tikz-diagrams">
    Create diagram-table combinations
  </Card>

  <Card title="Research Papers" icon="chart-line" href="/learn/latex/how-to/writing-research-paper">
    Tables in research papers
  </Card>
</CardGroup>

***

<Info>
  **Remember**: The best table is one that clearly communicates information without unnecessary decoration. Focus on clarity, consistency, and professional appearance.
</Info>
