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

# Learn LaTeX in 30 minutes

> The quickest way to learn LaTeX. Create your first professional document in just 30 minutes with our beginner-friendly tutorial.

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

This tutorial gets you from zero to a working LaTeX document in about 30 minutes. You will create a document, add structure, format text, write equations, insert images, build tables, and finish with a practical next-step path.

<Tip>
  This is the main beginner tutorial we want search engines and new readers to find first. If you want a broader orientation to tools and learning workflow, use the companion guide [How to Start Learning LaTeX in 2026](/blog/getting-started-latex-2026).
</Tip>

<Info>
  **Time to complete**: 30 minutes\
  **Prerequisites**: None\
  **What you'll learn**: Document creation, formatting, images, math, and tables
</Info>

## What You Will Build

* A minimal LaTeX document that compiles cleanly
* A title block, sections, and basic text formatting
* Lists, equations, images, and tables
* A practical path into longer guides, templates, and project workflows

## What is LaTeX?

LaTeX (pronounced "LAH-tek" or "LAY-tek") is a document preparation system that produces professional-quality documents. Unlike word processors where you see the final result as you type, LaTeX uses plain text files with markup commands that get compiled into beautiful documents.

### Why use LaTeX?

Think of LaTeX like HTML for documents. You write structured text, and LaTeX handles all the formatting consistently and professionally. It's especially powerful for:

* Academic papers and theses
* Mathematical and scientific documents
* Books and long-form content
* Professional reports and presentations

## Your First LaTeX Document

Let's dive right in! Here's the simplest possible LaTeX document:

<LatexSource filename="basic-document.tex" source={"\\documentclass{article}\n\\begin{document}\nHello, LaTeX!\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_in_30_minutes">
  <LatexPreview src="/images/rendered/learn-latex-in-30-minutes-01/page-1.svg" alt="Compiled PDF page 1 from basic-document.tex" caption="Generated from the shown source with pdfLaTeX in the pinned LaTeXCloud TeX Live 2026 environment." width={595.276} height={841.89} />
</RenderedOutput>

### Understanding the Structure

Every LaTeX document has two main parts:

1. **Preamble** (before `\begin{document}`): Document settings and package imports
2. **Body** (between `\begin{document}` and `\end{document}`): Your actual content

<Tip>
  LaTeX commands always start with a backslash `\` and are case-sensitive.
</Tip>

## Adding Title and Author

Let's make our document more professional by adding metadata:

<LatexSource filename="document-with-title.tex" source={"\\documentclass{article}\n\\title{My First LaTeX Document}\n\\author{Your Name}\n\\date{\\today}\n\n\\begin{document}\n\\maketitle\n\nWelcome to my first LaTeX document! This is an exciting journey into professional document preparation.\n\n\\end{document}"} />

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

The `\maketitle` command creates a nicely formatted title block using the information you provided in the preamble.

## Text Formatting

LaTeX provides simple commands for text formatting:

<LatexSource filename="text-formatting.tex" source={"\\documentclass{article}\n\\begin{document}\n\n\\textbf{Bold text} is important.\n\n\\textit{Italic text} adds emphasis.\n\n\\underline{Underlined text} stands out.\n\n\\texttt{Monospace text} for code.\n\nYou can also \\textbf{\\textit{combine}} formats!\n\n\\end{document}"} />

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

### Paragraphs and Line Breaks

* Leave a blank line to start a new paragraph
* Use `\\` to force a line break within a paragraph
* Use `\newpage` to start a new page

## Creating Lists

LaTeX makes it easy to create both bullet points and numbered lists:

<LatexSource filename="lists.tex" source={"\\documentclass{article}\n\\begin{document}\n\n\\section{Shopping List}\n\\begin{itemize}\n    \\item Milk\n    \\item Eggs\n    \\item Bread\n    \\item LaTeX tutorials\n\\end{itemize}\n\n\\section{Recipe Steps}\n\\begin{enumerate}\n    \\item Mix ingredients\n    \\item Bake for 30 minutes\n    \\item Let cool\n    \\item Enjoy!\n\\end{enumerate}\n\n\\end{document}"} />

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

## Adding Math Equations

This is where LaTeX truly shines! You can add math inline with `$...$` or as display equations with `\[...\]`:

<LatexSource filename="math-examples.tex" source={"\\documentclass{article}\n\\begin{document}\n\nEinstein's famous equation is $E = mc^2$.\n\nThe quadratic formula is:\n\\[x = \\frac{-b \\pm \\sqrt{b^2 - 4ac}}{2a}\\]\n\nHere's a more complex example:\n\\[\\int_{0}^{\\infty} e^{-x^2} dx = \\frac{\\sqrt{\\pi}}{2}\\]\n\n\\end{document}"} />

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

<Info>
  LaTeX has hundreds of mathematical symbols and operators. Check our [math reference guide](/learn/reference/symbols) for a complete list.
</Info>

## Inserting Images

To add images to your document, you'll need the `graphicx` package:

<LatexSource filename="images.tex" source={"\\documentclass{article}\n\\usepackage{graphicx}\n\n\\begin{document}\n\n\\begin{figure}[h]\n    \\centering\n    \\includegraphics[width=0.5\\textwidth]{example-image}\n    \\caption{A sample image in LaTeX}\n    \\label{fig:sample}\n\\end{figure}\n\nAs we can see in Figure \\ref{fig:sample}, images are easy to add!\n\n\\end{document}"} />

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

### Image Positioning Options

* `[h]` - here (approximately)
* `[t]` - top of page
* `[b]` - bottom of page
* `[p]` - separate page for floats

## Creating Tables

Tables in LaTeX are powerful but need a bit of practice:

<LatexSource filename="simple-table.tex" source={"\\documentclass{article}\n\\begin{document}\n\n\\begin{table}[h]\n\\centering\n\\begin{tabular}{|l|c|r|}\n\\hline\n\\textbf{Item} & \\textbf{Quantity} & \\textbf{Price} \\\\\n\\hline\nApples & 5 & \\$2.50 \\\\\nBananas & 12 & \\$3.00 \\\\\nOranges & 8 & \\$4.20 \\\\\n\\hline\n\\textbf{Total} & \\textbf{25} & \\textbf{\\$9.70} \\\\\n\\hline\n\\end{tabular}\n\\caption{Fruit inventory}\n\\end{table}\n\n\\end{document}"} />

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

### Table Column Alignment

* `l` - left aligned
* `c` - centered
* `r` - right aligned
* `|` - vertical line

## Document Structure

For longer documents, use sections to organize your content:

<LatexSource filename="document-structure.tex" source={"\\documentclass{article}\n\\begin{document}\n\n\\tableofcontents\n\\newpage\n\n\\section{Introduction}\nThis is the introduction to my document.\n\n\\subsection{Background}\nSome background information here.\n\n\\subsection{Objectives}\nWhat we aim to achieve.\n\n\\section{Methods}\nHow we'll do it.\n\n\\section{Conclusion}\nWhat we learned.\n\n\\end{document}"} />

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

The `\tableofcontents` command automatically generates a table of contents based on your sections!

## Comments in LaTeX

Use `%` to add comments that won't appear in the output:

<LatexSource filename="example.tex" source={"\\documentclass{article}\n\\begin{document}\n\nThis text will appear. % This comment won't\n\n% You can also have full-line comments\n% They're great for:\n% - TODO notes\n% - Temporarily disabling content\n% - Explaining complex code\n\n\\end{document}"} />

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

## Common Packages

Extend LaTeX's functionality with packages. Here are essential ones:

<LatexSource filename="example.tex" source={"\\documentclass{article}\n% Essential packages\n\\usepackage{graphicx}  % Images\n\\usepackage{amsmath}   % Advanced math\n\\usepackage{hyperref}  % Clickable links\n\\usepackage{geometry}  % Page margins\n\\usepackage{enumitem}  % Better lists\n\\usepackage{xcolor}    % Colors\n\n\\begin{document}\n% Your content here\n\\end{document}"} />

<RenderedOutput title="Expected effect">
  <Info>
    This code performs setup or defines reusable behavior without producing visible page content on its own. It must be used inside a complete document to have a rendered result.
  </Info>
</RenderedOutput>

## Troubleshooting Common Errors

<Warning>
  LaTeX errors can be cryptic. Here are the most common ones and how to fix them:
</Warning>

### Missing \$ inserted

**Problem**: Math mode content outside math mode\
**Solution**: Wrap math symbols in `$...$`

### Undefined control sequence

**Problem**: Misspelled command or missing package\
**Solution**: Check spelling and load required packages

### Missing \begin{document}

**Problem**: Content before document begins\
**Solution**: Move content after `\begin{document}`

## Your Complete First Document

Let's put it all together! Here's a complete document showcasing everything you've learned:

<LatexSource filename="complete-document.tex" source={"\\documentclass{article}\n\\usepackage{graphicx}\n\\usepackage{amsmath}\n\\usepackage{hyperref}\n\n\\title{My LaTeX Journey}\n\\author{Your Name}\n\\date{\\today}\n\n\\begin{document}\n\\maketitle\n\\tableofcontents\n\\newpage\n\n\\section{Introduction}\nWelcome to my first complete LaTeX document! I've learned how to create professional documents with ease.\n\n\\section{What I've Learned}\n\n\\subsection{Text Formatting}\nI can make text \\textbf{bold}, \\textit{italic}, and \\underline{underlined}. I can even \\textbf{\\textit{combine}} them!\n\n\\subsection{Mathematics}\nLaTeX makes math beautiful. Here's the quadratic formula:\n\\[x = \\frac{-b \\pm \\sqrt{b^2 - 4ac}}{2a}\\]\n\n\\subsection{Lists and Tables}\n\\begin{itemize}\n    \\item Create bullet points\n    \\item Make numbered lists\n    \\item Build professional tables\n\\end{itemize}\n\n\\begin{table}[h]\n\\centering\n\\begin{tabular}{|l|c|}\n\\hline\n\\textbf{Feature} & \\textbf{Learned} \\\\\n\\hline\nBasic formatting & ✓ \\\\\nMathematics & ✓ \\\\\nImages & ✓ \\\\\nTables & ✓ \\\\\n\\hline\n\\end{tabular}\n\\caption{My LaTeX progress}\n\\end{table}\n\n\\section{Conclusion}\nIn just 30 minutes, I've gone from zero to creating professional documents with LaTeX. The journey continues!\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

Congratulations! You've just created your first LaTeX documents. Here's what to explore next:

<CardGroup cols={2}>
  <Card title="Document Classes" icon="file" href="/learn/reference/document-classes">
    Learn about article, report, book, and more
  </Card>

  <Card title="Advanced Math" icon="square-root-variable" href="/learn/latex/mathematics/basics">
    Matrices, theorems, and complex equations
  </Card>

  <Card title="Bibliography" icon="book" href="/learn/latex/bibliography-citations">
    Manage citations and references
  </Card>

  <Card title="Custom Styling" icon="paintbrush" href="/learn/latex/text-formatting">
    Fonts, colors, and page layouts
  </Card>
</CardGroup>

## Recommended Deep Dives

* [Sections and chapters](/learn/latex/document-structure/sections-and-chapters)
* [Table of contents](/learn/latex/document-structure/table-of-contents)
* [Hyperlinks](/learn/latex/document-structure/hyperlinks)
* [BibLaTeX guide](/learn/latex/bibliography/biblatex-guide)
* [Choosing citation styles](/learn/latex/bibliography/choosing-citation-styles)
* [LaTeX in French](/learn/latex/languages/french)
* [LaTeX in Chinese](/learn/latex/languages/chinese)
* [Align and multline environments](/learn/latex/mathematics/align-and-multline-environments)

## Quick Reference Card

Keep this handy as you write:

| Command      | Purpose      | Example                   |
| ------------ | ------------ | ------------------------- |
| `\textbf{}`  | Bold text    | `\textbf{Important}`      |
| `\textit{}`  | Italic text  | `\textit{emphasis}`       |
| `\section{}` | New section  | `\section{Introduction}`  |
| `$...$`      | Inline math  | `$E = mc^2$`              |
| `\[...\]`    | Display math | `\[x = \frac{a}{b}\]`     |
| `\\`         | Line break   | `First line\\Second line` |
| `%`          | Comment      | `% This is a comment`     |

***

<Tip>
  **Pro tip**: Save this page as a bookmark! You'll refer back to these basics often as you learn more advanced features.
</Tip>

Ready to dive deeper? Continue with our [comprehensive LaTeX basics guide](/learn/latex/basics/creating-first-document) or explore [specific topics](/learn/latex/how-to/first-project) that interest you!

## Start in LaTeX Cloud Studio

<CardGroup cols={2}>
  <Card title="Open in LaTeX Cloud Studio" icon="cloud" href="https://app.latex-cloud-studio.com/?utm_source=resources&utm_medium=card&utm_campaign=docs_open_app&utm_content=latex_in_30_minutes_open_app">
    Write, compile, and iterate directly in your browser.
  </Card>

  <Card title="Start from Article Template" icon="file-text" href="/templates/article">
    Use a ready-made template, then adapt it to your content.
  </Card>
</CardGroup>
