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

# Linguistics Notation

> Master linguistic notation in LaTeX. Learn phonetic symbols, syntax trees, morphological analysis, and specialized linguistics formatting.

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

Learn how to typeset linguistic notation, phonetic symbols, and syntactic structures professionally in LaTeX.

## Essential Linguistics Packages

<LatexSource filename="example.tex" source={"\\usepackage{tipa}           % Phonetic symbols (IPA)\n\\usepackage{linguex}        % Example numbering\n\\usepackage{gb4e}           % Alternative example numbering\n\\usepackage{qtree}          % Syntax trees\n\\usepackage{forest}         % Advanced tree diagrams\n\\usepackage{tikz-qtree}     % TikZ-based trees\n\\usepackage{covington}      % Linguistic examples\n\\usepackage{vowel}          % Vowel charts"} />

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

## Phonetic Symbols (IPA)

### Consonants

<LatexSource filename="example.tex" source={"% Stops\n\\textipa{p b t d \\:t \\:d c \\textbardotlessj k g q \\textscg ?}\n\n% Fricatives\n\\textipa{f v T D s z S Z s\\super h z\\super h C j\\super h x G X R h H}\n\n% Nasals\n\\textipa{m M n n\\super h \\:n N n\\super G}\n\n% Liquids\n\\textipa{l l\\super h \\:l L r r\\super h \\:r R}\n\n% Approximants\n\\textipa{B j M\\super j w \\textbeltl}"} />

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

### Vowels

<LatexSource filename="example.tex" source={"% Front vowels\n\\textipa{i I e E a}\n\n% Central vowels\n\\textipa{1 @\\super r @ 6 a}\n\n% Back vowels\n\\textipa{u U o O A Q}\n\n% Additional vowels\n\\textipa{y Y 2 9 O/ \\textbari \\textschwa}"} />

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

<Card title="Expected output" icon="eye">
  The TIPA package renders IPA phonetic symbols:

  **`\textipa{p}`** renders as **p** (voiceless bilabial stop)

  **`\textipa{T}`** renders as **θ** (voiceless dental fricative)

  **`\textipa{S}`** renders as **ʃ** (voiceless postalveolar fricative)

  **`\textipa{@}`** renders as **ə** (schwa)
</Card>

## Suprasegmentals and Prosodic Notation

### Stress and Tone

<LatexSource filename="example.tex" source={"% Stress\n\\textipa{\"kA:l@} % Primary stress\n\\textipa{%kA:l@} % Secondary stress\n\n% Tone markings\n\\textipa{\\`a}    % Low tone\n\\textipa{\\'a}    % High tone\n\\textipa{\\^a}    % Rising tone\n\\textipa{\\v a}   % Falling tone\n\\textipa{\\~a}    % Mid tone\n\n% Tone letters\n\\textipa{ma\\tone{51}}  % High falling\n\\textipa{ma\\tone{35}}  % Mid rising\n\\textipa{ma\\tone{214}} % Low falling-rising\n\n% Length\n\\textipa{a:}     % Long\n\\textipa{a\\super h} % Half-long"} />

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

### Syllable Structure

<LatexSource filename="example.tex" source={"% Syllable boundaries\n\\textipa{sI.l@.b@l}\n\n% Prosodic word boundaries\n\\textipa{|| wO:d || bawn.d@.ri ||}\n\n% Phonological phrases\n\\textipa{( f@\"nA.l@.dZI.k@l ) ( \"freI.z@z )}\n\n% Metrical feet\n\\textipa{(. \"stres.t@d .) (. sI\"la.b@l .)}"} />

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

## Linguistic Examples

### Numbered Examples with linguex

<LatexSource filename="example.tex" source={"\\ex. This is a simple example.\n\n\\ex. \\a. This is a subexample.\n     \\b. This is another subexample.\n     \\c. And yet another one.\n\n\\ex. \\label{important-ex}\n     This example has a label for referencing.\n\n% Referencing\nAs shown in (\\ref{important-ex}), we can reference examples.\n\n% Glossed examples\n\\ex. \\gll Mary-ga hon-o yonda.\n         Mary-NOM book-ACC read.PAST\n     \\glt 'Mary read a book.'"} />

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

### Glossed Examples with gb4e

<LatexSource filename="example.tex" source={"\\begin{exe}\n\\ex This is an example.\n\n\\ex \\begin{xlist}\n    \\ex First subexample\n    \\ex Second subexample\n    \\end{xlist}\n\n\\ex \\gll Dies ist ein Beispiel.\n        this is a example\n    \\glt 'This is an example.'\n\n\\ex \\glll María le-yó el libro.\n         María 3.DAT-read.3SG.PAST the book\n         Maria to.him-read the book\n    \\glt 'Maria read the book to him.'\n\\end{exe}"} />

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

## Morphological Analysis

### Morpheme Boundaries

<LatexSource filename="example.tex" source={"% Morpheme boundaries\nun-break-able\nre-write-ing\ncat-s\n\n% Allomorphs\n\\{Z\\} $\\rightarrow$ [s] / [+voiceless]\n\\{Z\\} $\\rightarrow$ [z] / [+voiced]\n\\{Z\\} $\\rightarrow$ [@z] / [+sibilant]\n\n% Morphological rules\n\\textsc{plural}: N $\\rightarrow$ N + \\{Z\\}\n\n% Feature structures\n\\begin{tabular}{l}\n[+animate] \\\\\n[+human] \\\\\n[-definite]\n\\end{tabular}"} />

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

### Autosegmental Representation

<LatexSource filename="example.tex" source={"% Tone spreading\n\\begin{tikzpicture}\n\\node at (0,0) {k};\n\\node at (1,0) {a};\n\\node at (2,0) {l};\n\\node at (3,0) {a};\n\\draw (0.5,1) node {H} -- (1,0);\n\\draw (0.5,1) -- (2,0);\n\\draw (2.5,1) node {L} -- (3,0);\n\\end{tikzpicture}\n\n% Multiple tiers\n\\begin{tikzpicture}[scale=0.8]\n% Segmental tier\n\\node at (0,0) {k};\n\\node at (1,0) {a};\n\\node at (2,0) {l};\n\\node at (3,0) {a};\n% Tonal tier\n\\node at (0,1) {H};\n\\node at (2,1) {L};\n% Association lines\n\\draw (0,1) -- (1,0);\n\\draw (2,1) -- (3,0);\n\\end{tikzpicture}"} />

<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_specialized_notation_linguistics">
  <LatexPreview src="/images/rendered/learn-latex-specialized-notation-linguistics-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. The visible fragment is compiled inside the documented minimal article wrapper." width={612} height={792} />
</RenderedOutput>

## Syntax Trees

### Simple Trees with qtree

<LatexSource filename="example.tex" source={"% Basic tree\n\\Tree [.S [.NP [.Det The ] [.N cat ] ]\n           [.VP [.V sat ] [.PP [.P on ] [.NP [.Det the ] [.N mat ] ] ] ] ]\n\n% With movement\n\\Tree [.CP [.C$'$ [.C that ]\n                  [.IP [.NP$_i$ Mary ]\n                       [.I$'$ [.I -ed ]\n                              [.VP [.V think ]\n                                   [.CP [.NP$_j$ what ]\n                                        [.C$'$ [.C ∅ ]\n                                               [.IP [.NP t$_i$ ]\n                                                    [.VP [.V bought ]\n                                                         [.NP t$_j$ ] ] ] ] ] ] ] ] ] ]"} />

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

### Advanced Trees with forest

<LatexSource filename="example.tex" source={"\\begin{forest}\n[S\n  [NP\n    [Det [the]]\n    [N [student]]\n  ]\n  [VP\n    [V [read]]\n    [NP\n      [Det [a]]\n      [N [book]]\n    ]\n  ]\n]\n\\end{forest}\n\n% With features\n\\begin{forest}\n[S\n  [NP,roof\n    [John]]\n  [VP\n    [V\n      [believes]]\n    [CP\n      [C\n        [that]]\n      [S\n        [NP,roof\n          [Mary]]\n        [VP\n          [V\n            [left]]]]]]]\n\\end{forest}"} />

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

## Phonological Rules

### Rule Notation

<LatexSource filename="example.tex" source={"% Basic rule format\nA $\\rightarrow$ B / C \\_ D\n\n% Specific examples\n/t/ $\\rightarrow$ [t\\super h] / \\_ [+vowel]\n\n/n/ $\\rightarrow$ [N] / \\_ [+velar]\n\n% Feature-based rules\n[+consonant] $\\rightarrow$ [+voice] / [+voice] \\_ [+voice]\n\n% Syllable-based rules\nV $\\rightarrow$ V: / \\_ C\\$ (vowel lengthening before coda)\n\n% Optional rules\n/t/ $\\rightarrow$ (∅) / V \\_ V (optional /t/ deletion)\n\n% Multiple environments\n/k/ $\\rightarrow$ [c] / \\_ \\{i, e\\}"} />

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

## Optimality Theory

### Tableaux

<LatexSource filename="example.tex" source={"\\begin{tabular}{|l||c|c|c|}\n\\hline\nInput: /kata/ & \\textsc{NoCoda} & \\textsc{Max} & \\textsc{Dep} \\\\\n\\hline\\hline\na. [kata] & *! & & \\\\\n\\hline\nb. [kat] & & *! & \\\\\n\\hline\nc. ☞ [ka.ta] & & & * \\\\\n\\hline\n\\end{tabular}\n\n% Ranking\n\\textsc{NoCoda} $\\gg$ \\textsc{Max} $\\gg$ \\textsc{Dep}\n\n% Violation marks\n* violation\n*! fatal violation\n☞ optimal candidate"} />

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

## Historical Linguistics

### Sound Changes

<LatexSource filename="example.tex" source={"% Regular sound changes\nProto-Indo-European *p > Germanic f\n\n% Conditioned changes\nPIE *k > Latin c / \\_ [+front vowel]\nPIE *k > Latin qu / \\_ [+back vowel]\n\n% Merger and split\nMiddle English /a:/ > Modern English /eI/ (name)\nMiddle English /a:/ > Modern English /A:/ (father)\n\n% Comparative method\n\\begin{tabular}{lll}\n\\textbf{English} & \\textbf{German} & \\textbf{Proto-Germanic} \\\\\nfather & Vater & *faðer- \\\\\nmother & Mutter & *mo:ðer- \\\\\nbrother & Bruder & *broðer- \\\\\n\\end{tabular}"} />

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

## Sociolinguistics

### Variation and Variables

<LatexSource filename="example.tex" source={"% Variables\n(ing): [IN] vs. [In]\n(th): [T] vs. [f] vs. [d]\n\n% Variable rules\n(r) $\\rightarrow$ ∅ / V \\_ \\# (r-dropping)\nProbability: 0.8 (working class), 0.2 (middle class)\n\n% Correlation tables\n\\begin{tabular}{|l|c|c|}\n\\hline\n\\textbf{Social Class} & \\textbf{[IN]\\%} & \\textbf{[In]\\%} \\\\\n\\hline\nUpper Middle & 95 & 5 \\\\\nLower Middle & 75 & 25 \\\\\nWorking & 25 & 75 \\\\\n\\hline\n\\end{tabular}"} />

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

## Acoustic Phonetics

### Spectrograms and Formants

<LatexSource filename="example.tex" source={"% Formant notation\nF1 = \\SI{500}{Hz}, F2 = \\SI{1500}{Hz}, F3 = \\SI{2500}{Hz}\n\n% Vowel formant space\n\\begin{tikzpicture}[scale=0.8]\n\\draw[->] (0,0) -- (4,0) node[right] {F2 (Hz)};\n\\draw[->] (0,0) -- (0,3) node[above] {F1 (Hz)};\n\\node at (0.5,0.5) {i};\n\\node at (3.5,0.5) {u};\n\\node at (2,2.5) {a};\n\\node at (1.5,1) {e};\n\\node at (2.5,1) {o};\n\\end{tikzpicture}\n\n% VOT measurements\nVOT = \\SI{+15}{ms} (aspirated)\nVOT = \\SI{+5}{ms} (unaspirated)\nVOT = \\SI{-85}{ms} (voiced)"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-latex-specialized-notation-linguistics-16/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. The visible fragment is compiled inside the documented minimal article wrapper." width={612} height={792} />
</RenderedOutput>

## Language Typology

### Typological Features

<LatexSource filename="example.tex" source={"% Word order typology\n\\begin{tabular}{ll}\n\\textbf{Type} & \\textbf{Example} \\\\\nSOV & Japanese, Turkish \\\\\nSVO & English, Mandarin \\\\\nVSO & Welsh, Irish \\\\\nVOS & Malagasy \\\\\nOVS & Hixkaryana \\\\\nOSV & Warao \\\\\n\\end{tabular}\n\n% Implicational universals\nIf a language has dual number, then it has plural number.\nIf SOV $\\rightarrow$ then postpositions (generally)\n\n% Morphological typology\n\\textbf{Analytic}: Vietnamese, Chinese\n\\textbf{Synthetic}: Latin, Russian\n\\textbf{Agglutinative}: Turkish, Finnish\n\\textbf{Polysynthetic}: Mohawk, Inuktitut"} />

<RenderedOutput title="Rendered output">
  <LatexPreview src="/images/rendered/learn-latex-specialized-notation-linguistics-17/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. The visible fragment is compiled inside the documented minimal article wrapper." width={595.276} height={841.89} />
</RenderedOutput>

## Writing Systems

### Grapheme-Phoneme Correspondences

<LatexSource filename="example.tex" source={"% English spelling\n\\textipa{/naIt/} $\\leftrightarrow$ \\textit{night, knight}\n\\textipa{/tu:/} $\\leftrightarrow$ \\textit{two, too, to}\n\n% Arabic transliteration\n\\textarabic{kitAb} ← k-t-b (root)\n\\textarabic{kAtib} ← writer (active participle)\n\n% Chinese characters\n汉字 hànzì (Chinese characters)\n人 rén (person) + 木 mù (tree) = 休 xiū (rest)"} />

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

## Best Practices

<CardGroup cols={2}>
  <Card title="Consistent IPA Usage" icon="language" color="#FF6037">
    Use the same IPA conventions throughout your document
  </Card>

  <Card title="Clear Example Formatting" icon="list-ol" color="#FF6037">
    Number and format linguistic examples consistently
  </Card>

  <Card title="Proper Glossing" icon="tags" color="#FF6037">
    Follow Leipzig Glossing Rules for morpheme-by-morpheme translation
  </Card>

  <Card title="Tree Readability" icon="sitemap" color="#FF6037">
    Keep syntax trees simple and well-spaced for clarity
  </Card>
</CardGroup>

## Common Abbreviations

| Abbreviation | Meaning               |
| :----------- | :-------------------- |
| **NOM**      | Nominative            |
| **ACC**      | Accusative            |
| **DAT**      | Dative                |
| **GEN**      | Genitive              |
| **1SG**      | First person singular |
| **3PL**      | Third person plural   |
| **PAST**     | Past tense            |
| **PRES**     | Present tense         |
| **PERF**     | Perfect aspect        |
| **PROG**     | Progressive aspect    |

## Troubleshooting

<Warning>
  **Common issues**:

  * Missing TIPA fonts: Install the `tipa` package properly
  * Tree alignment: Use appropriate tree packages for complex structures
  * IPA rendering: Some symbols require special font handling
  * Example numbering: Don't mix linguex and gb4e in the same document
</Warning>

## Further Reading

<CardGroup cols={2}>
  <Card title="Music Notation" icon="music" href="/learn/latex/specialized-notation/music" color="#FF6037">
    Musical symbols and notation
  </Card>

  <Card title="TikZ Diagrams" icon="diagram-project" href="/learn/latex/how-to/tikz-diagrams" color="#FF6037">
    Advanced TikZ diagrams for syntax trees
  </Card>

  <Card title="Symbol Reference" icon="book" href="/learn/reference/symbols" color="#FF6037">
    General symbol reference
  </Card>

  <Card title="Fonts Guide" icon="palette" href="/learn/latex/fonts" color="#FF6037">
    Text formatting techniques
  </Card>
</CardGroup>
