# Latex Citation Intake Inserter

> Insert citations from a citation-intake Markdown sheet into a LaTeX draft. Use when Codex needs to read a citation-intake table, map paper titles to citation keys in an existing BibTeX file, insert `\cite{...}` commands into a `.tex` file according to the recorded order and placement notes, and verify that all inserted keys exist in the bibliography.

- Skill: `daughter-of-void/latex-citation-intake-inserter` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add daughter-of-void/latex-citation-intake-inserter`
- Raw SKILL.md: https://api.skillmd.com/api/skills/daughter-of-void/latex-citation-intake-inserter/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Docs & Writing
- Author: Daughter-of-Void (https://skillmd.com/u/daughter-of-void)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/daughter-of-void/latex-citation-intake-inserter

---


# LaTeX Citation Intake Inserter

## Overview

Use this skill after citation recommendations have been recorded in a Markdown intake sheet and the corresponding BibTeX entries are already present or have just been added. The goal is to update the LaTeX source cleanly without changing the prose beyond citation insertion.

## Workflow

1. Read the citation-intake Markdown file and preserve its row order.
2. Read the target `.tex` file and the target `.bib` file.
3. For each intake row, map `Paper title` to the BibTeX citation key by title-first matching in the `.bib` file.
   - Prefer an existing earlier key if the same title appears more than once.
   - If a title is missing from the `.bib` file, add it with the BibTeX reference-adder workflow before editing the `.tex` file.
4. Use the `Suggested insertion location` and `Source text anchor` fields to locate the target sentence or phrase in the `.tex` file.
5. Insert citations in intake-row order, using LaTeX nonbreaking citation style:
   - Sentence-end support: `... claim~\cite{key}.`
   - Phrase-level support before punctuation: `... phrase~\cite{key}, ...`
   - Existing citation group: merge keys into the existing `\cite{...}` instead of creating adjacent citations.
6. Keep citations close to the supported claim; do not move citations to the end of a paragraph unless the intake sheet says so.
7. Avoid duplicate citation commands for the same claim and key.
8. Validate the result:
   - Extract all `\cite{...}` keys from the `.tex` file.
   - Extract all entry keys from the `.bib` file.
   - Report any missing keys and fix them before finishing.

## Mapping Guidelines

- Match titles case-insensitively and ignore light differences in punctuation, braces, hyphenation, and capitalization.
- When multiple BibTeX entries match the same paper, use the key that best fits the existing chapter's citation style, usually the earliest non-duplicate key in the bibliography.
- Preserve all existing LaTeX commands, citation keys, labels, figures, and bibliography style.
- Do not edit unrelated grammar or content unless the user explicitly asks.
- After insertion, summarize the key mappings used and the validation result.

## Useful Validation Commands

PowerShell citation-key check:

```powershell
$tex = Get-Content -Raw -LiteralPath '<path-to-tex>'
$bib = Get-Content -Raw -LiteralPath '<path-to-bib>'
$citeKeys = [regex]::Matches($tex, '\\cite\{([^}]+)\}') | ForEach-Object { $_.Groups[1].Value -split '\s*,\s*' } | Sort-Object -Unique
$bibKeys = [regex]::Matches($bib, '@\w+\{([^,]+),') | ForEach-Object { $_.Groups[1].Value } | Sort-Object -Unique
$citeKeys | Where-Object { $_ -notin $bibKeys }
```

