emdash-tex

star 0

Converts literal em dashes (

r26D By r26D schedule Updated 2/5/2026

name: emdash-tex description: Converts literal em dashes (--- and Unicode —) to \textemdash in .tex files for correct display in EPUB, PDF, and other outputs. Use when fixing em dashes in LaTeX, preparing manuscripts for EPUB, or when dashes display incorrectly in exports.

Em Dash to \textemdash for LaTeX

Converts literal em dash forms to the LaTeX command \textemdash in .tex files so they render correctly in EPUB, PDF, Wikijs, and other output formats.

When to Apply

  • User asks to fix em dashes, convert --- to \textemdash, or prepare .tex for EPUB/other outputs
  • Em dashes appear as raw hyphens or wrong characters in built EPUB/PDF
  • Adding or editing .tex content and you want consistent, portable em dashes

Scope

  • Files: Only .tex files (e.g. under manuscript/content/ or project .tex paths)
  • Replace:
    1. Three hyphens --- (when used as an em dash, not in comments or commands)
    2. Unicode em dash character (U+2014) → \textemdash

Workflow

1. Identify target .tex file(s)

If the user names a file or directory, use that. Otherwise, common locations: manuscript/content/**/*.tex.

2. Replace literal em dashes

  • ---\textemdash
    Replace three consecutive hyphens when they act as an em dash (pause, aside, parenthetical).
    Do not replace when:

    • The line is a comment (after % on that line, or whole line is comment)
    • The hyphens are inside a LaTeX command name (e.g. \some---thing is not em dash)
    • They are part of a longer dash sequence (e.g. four or more hyphens in ASCII art / rules)
  • (Unicode U+2014) → \textemdash
    Replace every Unicode em dash character with \textemdash.

3. Preserve existing \textemdash and other formatting

  • Leave existing \textemdash unchanged.
  • Do not change en dashes -- (two hyphens) used for ranges/compounds.
  • Do not alter LaTeX commands, {}, math, or structure; only replace the two patterns above.

4. Save and optionally report

  • Write changes to the same .tex file(s).
  • Optionally report: file(s) updated and approximate count of replacements (--- and —).

Examples

Before (literal ---):

It was feasible---more than we thought---to provide a standard.

After:

It was feasible\textemdash more than we thought\textemdash to provide a standard.

Before (Unicode —):

Physics has found no straight lines—only waves.

After:

Physics has found no straight lines\textemdash only waves.

Do Not Change

  • Comment lines or content after %
  • En dashes: 10--20, east--west, 1950--1960
  • Hyphenated words: well-known, self-contained
  • LaTeX command names or arguments (except where the only change is replacing --- or in normal prose)

Notes

  • Conservative: Only replace --- when it clearly functions as an em dash in the sentence.
  • Consistent: After this skill, em dashes in prose should be \textemdash so EPUB/PDF/Wikijs all render them correctly.
Install via CLI
npx skills add https://github.com/r26D/yay-i --skill emdash-tex
Repository Details
star Stars 0
call_split Forks 0
navigation Branch main
article Path SKILL.md
More from Creator