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

# Bibliography Management with BibTeX - Complete Guide

> Master bibliography management in LaTeX using BibTeX. Learn citation styles, .bib files, and automated reference formatting with examples.

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

Master **professional bibliography management** in LaTeX using BibTeX. This comprehensive guide covers everything from basic citations to advanced bibliography customization for academic papers, theses, and publications.

<Info>
  **Quick start**: BibTeX automates bibliography formatting in LaTeX. Create a `.bib` file with your references, cite them with `\cite{key}`, and LaTeX handles the formatting based on your chosen style.

  **Prerequisites**: Basic LaTeX knowledge. For citations basics, see [Bibliography & Citations](/learn/latex/bibliography-citations).
</Info>

## What You'll Learn

* ✅ How BibTeX works with LaTeX
* ✅ Creating and managing .bib files
* ✅ Citation commands and variations
* ✅ Bibliography styles (plain, alpha, abbrv, etc.)
* ✅ Advanced customization techniques
* ✅ Best practices for reference management
* ✅ Troubleshooting common issues

## How BibTeX Works

BibTeX is a bibliography management tool that works alongside LaTeX to handle citations and references automatically. Here's the workflow:

<Card title="BibTeX Workflow" icon="eye">
  The BibTeX workflow follows four steps: (1) Create a .bib file to store your references in a structured format, (2) Cite references in your .tex document using \cite commands, (3) Compile using LaTeX followed by BibTeX and then LaTeX again, (4) Output shows your formatted bibliography with properly numbered or author-year citations matching your chosen style.
</Card>

## Basic Setup

### Step 1: Create Your Main Document

<LatexSource filename="main.tex" source={"\\documentclass{article}\n\\usepackage[utf8]{inputenc}\n\n\\title{Sample Article with Bibliography}\n\\author{Your Name}\n\\date{\\today}\n\n\\begin{document}\n\\maketitle\n\n\\section{Introduction}\nAccording to \\cite{einstein1905}, the theory of special relativity\nrevolutionized physics. Later work by \\cite{hawking1988} expanded\nour understanding of the universe.\n\n% Bibliography\n\\bibliographystyle{plain}  % Choose citation style\n\\bibliography{references}   % Link to .bib file (without extension)\n\n\\end{document}"} />

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

### Step 2: Create Your Bibliography File

<CodeGroup>
  ```bibtex references.bib theme={null}
  @article{einstein1905,
      author = {Einstein, Albert},
      title = {On the Electrodynamics of Moving Bodies},
      journal = {Annalen der Physik},
      year = {1905},
      volume = {17},
      pages = {891--921},
      doi = {10.1002/andp.19053221004}
  }

  @book{hawking1988,
      author = {Hawking, Stephen},
      title = {A Brief History of Time},
      publisher = {Bantam Books},
      year = {1988},
      address = {New York},
      isbn = {978-0553380163}
  }
  ```
</CodeGroup>

### Step 3: Compile Your Document

<Steps>
  <Step title="First LaTeX pass">
    `pdflatex main.tex` - Creates auxiliary files with citation information
  </Step>

  <Step title="Process bibliography">
    `bibtex main` - Reads .aux file, processes .bib file, creates .bbl file
  </Step>

  <Step title="Second LaTeX pass">
    `pdflatex main.tex` - Incorporates bibliography entries
  </Step>

  <Step title="Final LaTeX pass">
    `pdflatex main.tex` - Resolves all cross-references
  </Step>
</Steps>

**Expected output:**

<Card title="Expected output" icon="eye">
  The compiled document displays "Sample Article with Bibliography" as the centered title, followed by the author name and date. The Introduction section shows in-text citations as bracketed numbers \[1] and \[2]. The References section at the bottom lists the formatted bibliography entries: \[1] shows Einstein's article with author, title in sentence case, journal name in italics, volume, pages, and year; \[2] shows Hawking's book with author, title in italics, publisher, city, and year.
</Card>

## BibTeX Entry Types

### Common Entry Types

<CardGroup cols={2}>
  <Card title="@article" icon="newspaper">
    Journal articles, magazine articles

    ```bibtex theme={null}
    @article{key,
      author = {Author Name},
      title = {Article Title},
      journal = {Journal Name},
      year = {2023}
    }
    ```
  </Card>

  <Card title="@book" icon="book">
    Books with publisher

    ```bibtex theme={null}
    @book{key,
      author = {Author Name},
      title = {Book Title},
      publisher = {Publisher Name},
      year = {2023}
    }
    ```
  </Card>

  <Card title="@inproceedings" icon="users">
    Conference papers

    ```bibtex theme={null}
    @inproceedings{key,
      author = {Author Name},
      title = {Paper Title},
      booktitle = {Conference Name},
      year = {2023}
    }
    ```
  </Card>

  <Card title="@phdthesis" icon="graduation-cap">
    PhD dissertations

    ```bibtex theme={null}
    @phdthesis{key,
      author = {Author Name},
      title = {Thesis Title},
      school = {University Name},
      year = {2023}
    }
    ```
  </Card>
</CardGroup>

### Complete Entry Types Reference

<Accordion title="All BibTeX entry types with required and optional fields">
  #### @article

  **Required**: author, title, journal, year\
  **Optional**: volume, number, pages, month, doi, note

  #### @book

  **Required**: author/editor, title, publisher, year\
  **Optional**: volume/number, series, address, edition, month, isbn, note

  #### @booklet

  **Required**: title\
  **Optional**: author, howpublished, address, month, year, note

  #### @inbook

  **Required**: author/editor, title, chapter/pages, publisher, year\
  **Optional**: volume/number, series, type, address, edition, month, note

  #### @incollection

  **Required**: author, title, booktitle, publisher, year\
  **Optional**: editor, volume/number, series, type, chapter, pages, address, edition, month, note

  #### @inproceedings / @conference

  **Required**: author, title, booktitle, year\
  **Optional**: editor, volume/number, series, pages, address, month, organization, publisher, note

  #### @manual

  **Required**: title\
  **Optional**: author, organization, address, edition, month, year, note

  #### @mastersthesis

  **Required**: author, title, school, year\
  **Optional**: type, address, month, note

  #### @misc

  **Required**: none\
  **Optional**: author, title, howpublished, month, year, note, url

  #### @phdthesis

  **Required**: author, title, school, year\
  **Optional**: type, address, month, note

  #### @proceedings

  **Required**: title, year\
  **Optional**: editor, volume/number, series, address, month, publisher, organization, note

  #### @techreport

  **Required**: author, title, institution, year\
  **Optional**: type, number, address, month, note

  #### @unpublished

  **Required**: author, title, note\
  **Optional**: month, year
</Accordion>

## Citation Commands

### Basic Citation Commands

<LatexSource filename="citation-examples.tex" source={"% Basic citation\n\\cite{einstein1905}                    % Output: [1]\n\n% Multiple citations\n\\cite{einstein1905,hawking1988}        % Output: [1, 2]\n\n% Citation with page number\n\\cite[p.~42]{hawking1988}              % Output: [2, p. 42]\n\n% Citation with prefix\n\\cite[see][]{einstein1905}             % Output: [see 1]\n\n% Citation with prefix and page\n\\cite[see][p.~15]{einstein1905}        % Output: [see 1, p. 15]\n\n% Textual citations (with natbib package)\n\\usepackage{natbib}\n\\citet{einstein1905}                   % Output: Einstein (1905)\n\\citep{einstein1905}                   % Output: (Einstein, 1905)\n\\citeauthor{einstein1905}              % Output: Einstein\n\\citeyear{einstein1905}                % Output: 1905"} />

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

**Rendered output examples:**

<Card title="Expected output" icon="eye">
  Citation commands produce different outputs depending on the bibliography style. With the plain style: \cite produces \[1], multiple citations produce \[1, 2], and page references produce \[2, p. 42]. With author-year styles (natbib): \cite produces (Einstein, 1905), multiple citations produce (Einstein, 1905; Hawking, 1988), \citet produces Einstein (1905) for textual citations, and \citep produces (Einstein, 1905) for parenthetical citations.
</Card>

## Bibliography Styles

### Standard BibTeX Styles

<CardGroup cols={2}>
  <Card title="plain" icon="list-ol">
    `\bibliographystyle{plain}`

    Entries sorted alphabetically by author, numbered \[1], \[2], \[3]...

    **Example:**

    * \[1] A. Einstein. On the electrodynamics...
    * \[2] S. Hawking. A Brief History of Time...
  </Card>

  <Card title="alpha" icon="font">
    `\bibliographystyle{alpha}`

    Labels like \[Ein05], \[Haw88] based on author and year

    **Example:**

    * \[Ein05] A. Einstein. On the electrodynamics...
    * \[Haw88] S. Hawking. A Brief History of Time...
  </Card>

  <Card title="abbrv" icon="text-width">
    `\bibliographystyle{abbrv}`

    Like plain but with abbreviated first names, journal names

    **Example:**

    * \[1] A. Einstein. On the electrodynamics... *Ann. Phys.*
    * \[2] S. Hawking. A Brief History of Time...
  </Card>

  <Card title="unsrt" icon="arrow-down-1-9">
    `\bibliographystyle{unsrt}`

    Entries in order of citation, not alphabetically

    **Example:**

    * \[1] S. Hawking. A Brief History of Time...
    * \[2] A. Einstein. On the electrodynamics...
  </Card>
</CardGroup>

### Author-Year Styles (natbib)

<LatexSource filename="natbib-styles.tex" source={"\\usepackage{natbib}\n\n% Choose one of these styles:\n\\bibliographystyle{plainnat}    % Author-year version of plain\n\\bibliographystyle{abbrvnat}    % Author-year version of abbrv\n\\bibliographystyle{unsrtnat}    % Author-year version of unsrt\n\n% Popular journal styles:\n\\bibliographystyle{apalike}     % APA-like style\n\\bibliographystyle{chicago}     % Chicago Manual of Style\n\\bibliographystyle{harvard}     % Harvard citation style\n\\bibliographystyle{agsm}        % Australian Government Style Manual"} />

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

### Custom Bibliography Styles

<Tip>
  Many journals and institutions provide their own `.bst` files. Common examples:

  * **IEEEtran.bst** - IEEE Transactions
  * **ACM-Reference-Format.bst** - ACM publications
  * **apa.bst** - American Psychological Association
  * **vancouver.bst** - Biomedical journals
  * **nature.bst** - Nature journals
</Tip>

## Managing Large Bibliographies

### Organizing Your .bib File

<CodeGroup>
  ```bibtex organized-references.bib theme={null}
  % ==========================================
  % BOOKS
  % ==========================================

  @book{knuth1984tex,
      author = {Knuth, Donald E.},
      title = {The {\TeX}book},
      publisher = {Addison-Wesley},
      year = {1984},
      address = {Reading, Massachusetts},
      isbn = {0-201-13447-0},
      keywords = {tex, typography, typesetting}
  }

  @book{lamport1994latex,
      author = {Lamport, Leslie},
      title = {{\LaTeX}: A Document Preparation System},
      publisher = {Addison-Wesley},
      year = {1994},
      edition = {2nd},
      isbn = {0-201-52983-1},
      keywords = {latex, documentation}
  }

  % ==========================================
  % JOURNAL ARTICLES
  % ==========================================

  @article{shannon1948mathematical,
      author = {Shannon, Claude E.},
      title = {A Mathematical Theory of Communication},
      journal = {Bell System Technical Journal},
      year = {1948},
      volume = {27},
      number = {3},
      pages = {379--423},
      month = jul,
      doi = {10.1002/j.1538-7305.1948.tb01338.x},
      keywords = {information theory, communication}
  }

  % ==========================================
  % CONFERENCE PAPERS
  % ==========================================

  @inproceedings{turing1950computing,
      author = {Turing, Alan M.},
      title = {Computing Machinery and Intelligence},
      booktitle = {Mind},
      year = {1950},
      volume = {59},
      number = {236},
      pages = {433--460},
      keywords = {artificial intelligence, turing test}
  }
  ```
</CodeGroup>

### Using Multiple .bib Files

<LatexSource filename="multiple-bibs.tex" source={"% You can use multiple bibliography files\n\\bibliography{books,articles,conferences}\n\n% Or keep project-specific references separate\n\\bibliography{general-refs,project-specific-refs}"} />

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

### String Definitions for Consistency

<CodeGroup>
  ```bibtex string-definitions.bib theme={null}
  % Define common strings to ensure consistency
  @string{ieee = "IEEE Transactions on"}
  @string{acm = "ACM Computing Surveys"}
  @string{springer = "Springer-Verlag"}
  @string{mit = "MIT Press"}

  % Use the strings in entries
  @article{example2023,
      author = {Example, Author},
      title = {Example Article},
      journal = ieee # " Software Engineering",  % String concatenation
      year = {2023},
      publisher = springer
  }
  ```
</CodeGroup>

## Advanced Features

### Cross-References

<CodeGroup>
  ```bibtex cross-references.bib theme={null}
  @book{edited-volume2023,
      editor = {Smith, Jane and Doe, John},
      title = {Advances in Computer Science},
      publisher = {Academic Press},
      year = {2023}
  }

  @incollection{chapter2023,
      author = {Johnson, Alice},
      title = {Machine Learning Applications},
      pages = {45--67},
      crossref = {edited-volume2023}  % Inherits book details
  }
  ```
</CodeGroup>

### Custom Fields and Notes

<CodeGroup>
  ```bibtex custom-fields.bib theme={null}
  @article{example2023custom,
      author = {Author, Example},
      title = {Article with Custom Fields},
      journal = {Example Journal},
      year = {2023},
      % Standard optional fields
      note = {Forthcoming},
      abstract = {This article discusses...},
      keywords = {keyword1, keyword2, keyword3},
      % URL and access information
      url = {https://example.com/article},
      urldate = {2023-11-28},
      % Modern identifiers
      doi = {10.1234/example.2023},
      eprint = {2301.00000},
      archivePrefix = {arXiv}
  }
  ```
</CodeGroup>

### Special Characters and Formatting

<CodeGroup>
  ```bibtex special-characters.bib theme={null}
  @article{special-chars2023,
      % Preserving capitalization
      title = {The {NASA} {M}ars {R}over: A Study of {AI} in Space},
      
      % Special characters
      author = {M{\"u}ller, Hans and Garc{\'\i}a, Jos{\'e}},
      
      % Math in titles
      title = {On the $\mathcal{O}(n\log n)$ Complexity of Sorting},
      
      % Preserving spaces and formatting
      title = {The {{\TeX}} and {{\LaTeX}} Companion},
      
      % Corporate authors
      author = {{Microsoft Corporation}},
      
      % Multiple authors with "and others"
      author = {First, A. and Second, B. and Third, C. and others},
      
      journal = {Example Journal},
      year = {2023}
  }
  ```
</CodeGroup>

## Best Practices

### 1. Consistent Key Naming

<Tip>
  **Good Key Naming Conventions**

  * `author2023keyword` - e.g., `einstein1905relativity`
  * `author2023a`, `author2023b` - for multiple papers same year
  * `conference2023author` - e.g., `icml2023smith`
</Tip>

<Warning>
  **Poor Key Names to Avoid**

  * `paper1`, `paper2` - not descriptive
  * `my-favorite-paper` - too subjective
  * `ref:2023/05/28` - uses special characters
</Warning>

### 2. Complete Information

Always include:

* **DOI** when available - for reliable access
* **URL** for online resources
* **ISBN** for books
* **Abstract** for searchability
* **Keywords** for organization

### 3. Version Control

<CodeGroup>
  ```bash git-workflow.sh theme={null}
  # Track your bibliography files
  git add references.bib
  git commit -m "Add quantum computing references"

  # Create backups before major changes
  cp references.bib references.bib.backup

  # Use meaningful commit messages
  git commit -m "Update author names to include middle initials"
  ```
</CodeGroup>

## Troubleshooting

<Accordion title="Bibliography not appearing">
  **Common causes:**

  1. Missing `\bibliography{filename}` command
  2. Incorrect filename (don't include .bib extension)
  3. Didn't run BibTeX: `bibtex main`
  4. Need additional LaTeX passes

  **Solution:**

  ```bash theme={null}
  pdflatex main
  bibtex main
  pdflatex main
  pdflatex main
  ```
</Accordion>

<Accordion title="Citation shows as [?] or bold">
  **Common causes:**

  1. Typo in citation key
  2. Entry not in .bib file
  3. BibTeX compilation failed
  4. Multiple .bib files not all included

  **Debugging:**

  <LatexSource filename="example.tex" source={"% Check the .blg file for errors\n% Look for \"Warning--I didn't find a database entry for...\""} />

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

<Accordion title="Incorrect sorting or formatting">
  **Common causes:**

  1. Wrong bibliography style
  2. Missing required fields
  3. Special characters not escaped

  **Solutions:**

  * Verify all required fields are present
  * Use `{}` to preserve capitalization
  * Check .bst file compatibility
</Accordion>

<Accordion title="Encoding and special character issues">
  **For UTF-8 support:**

  <LatexSource filename="example.tex" source={"\\usepackage[utf8]{inputenc}  % For pdfLaTeX\n% or use XeLaTeX/LuaLaTeX for native UTF-8"} />

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

  **For special characters:**

  ```bibtex theme={null}
  author = {M{\"u}ller, J{\"o}rg}  % ü, ö
  author = {Garc{\'\i}a, Jos{\'e}}   % í, é
  ```
</Accordion>

## Modern Alternatives

### BibLaTeX (Advanced Users)

<Info>
  **BibLaTeX** is a modern replacement for BibTeX with more features:

  * Better Unicode support
  * More entry types and fields
  * Customizable citation styles
  * Multiple bibliographies in one document

  Learn more about advanced bibliography management in our comprehensive [Bibliography & Citations guide](/learn/latex/bibliography-citations).
</Info>

### Reference Managers

Popular tools that export to BibTeX:

* **Zotero** - Free, open-source
* **Mendeley** - Free with Elsevier account
* **JabRef** - BibTeX-specific manager
* **EndNote** - Commercial, widely used
* **Paperpile** - Modern web-based

## Quick Reference Card

<Card title="Expected output" icon="eye">
  BibTeX Quick Reference shows three key areas: Essential Commands include \bibliographystyle for setting the style, \bibliography for linking the .bib file, \cite for citations, and \nocite for including uncited references. Compilation Order requires running pdflatex, then bibtex, then pdflatex twice more. Common Styles include plain (numbered, alphabetical), alpha (author-year labels like \[Ein05]), abbrv (abbreviated names), unsrt (citation order), and apalike (APA format).
</Card>

## Next Steps

<CardGroup cols={2}>
  <Card title="Bibliography & Citations" icon="palette" href="/learn/latex/bibliography-citations">
    Explore different citation formats and journal requirements
  </Card>

  <Card title="Cross-Referencing" icon="rocket" href="/learn/latex/cross-referencing">
    Learn to reference figures, tables, and sections
  </Card>

  <Card title="Article Templates" icon="copy" href="/templates/article">
    Ready-to-use document templates with bibliographies
  </Card>

  <Card title="Thesis Guide" icon="graduation-cap" href="/learn/latex/how-to/thesis-dissertation">
    Managing references for large documents
  </Card>
</CardGroup>

## Related Pages

* [Bibliography hub](/learn/latex/bibliography)
* [BibLaTeX guide](/learn/latex/bibliography/biblatex-guide)
* [Natbib guide](/learn/latex/bibliography/natbib-guide)
* [Choosing citation styles](/learn/latex/bibliography/choosing-citation-styles)
* [Writing a research paper](/learn/latex/how-to/writing-research-paper)

<Warning>
  **LaTeX Cloud Studio** handles BibTeX compilation automatically! Simply upload your `.bib` file and cite your references - we take care of the compilation sequence for you.
</Warning>
