Skip to main content
prompt GP ChatGPT

Fix LaTeX dollars — ChatGPT & Claude.ai prompt: escape $ in Markdown

This prompt sorts every $ in Markdown into currency, math or shell code and escapes only the currency ones. Useful when your build throws warnings.

Open on GitHub

What Fix LaTeX dollars does

The prompt splits every $ into three classes. Currency — $1, $2 billion, R$ 549 — is what triggers the warnings, so those get escaped. Real math such as $\rightarrow$ and $O(1)\text{ streaming}$ stays untouched. Shell code like $(curl…), ${ZSH_CUSTOM} and $HOME sits inside code blocks and is left alone too.

It runs in four steps. First the agent greps the content, classifies each $ and reports counts before changing anything. Then it checks the tree is clean, writes and runs a tested Python script that is aware of code fences, inline code, frontmatter and math spans; a (?<!\\) lookbehind makes it idempotent, so re-running never double-escapes. Step three is the safety net: greps for real math and shell variables must print nothing, and if anything legitimate was touched the prompt tells you to run git checkout -- . and stop. Finally it prints the build-verify and commit commands for you to run.

That last part matters. The prompt deliberately does not run builds, commits or pushes on its own, so the final move is yours.

What it helps with

  • clear build warnings caused by currency $ in Markdown
  • escape currency without touching LaTeX formulas
  • keep shell variables inside code blocks intact
  • re-run the script without double-escaping
  • roll back when a legitimate $ gets hit

Example prompts for the agent

  • Investigate every $ in docs/ and report counts per class without changing anything
  • Escape the currency $ in README.md and show me the diff
  • Run the verification: grep real math and shell vars, and roll back if anything was touched

How to install Fix LaTeX dollars

How to use

Paste the text at the start of a chat or into project instructions

Questions about Fix LaTeX dollars

How do I install Fix LaTeX dollars in Claude?

There is no install command: paste the prompt into the chat and describe your files.

What does Fix LaTeX dollars do?

It classifies every $ in Markdown as currency, math or shell code, escapes only the currency ones, and verifies the diff for touched formulas and variables.

Does the prompt commit and push by itself?

No. It prints the build and commit commands, and you run them.

Source text

prompts.csv · CC0-1.0
Investigate and fix the actual $ usages in Markdown content.

The $ fall into three classes:

- Currency (escape these) — $1, $2 billion, R$ 549 → these pairs cause all the warnings
- Real math (leave alone) — $\rightarrow$, $O(1)\text{ streaming}$ → valid, no warnings
- Shell code (leave alone) — $(curl…), ${ZSH_CUSTOM}, $HOME → inside code blocks


Execute in 4 steps:

- Investigate — greps the content, classifies every $ into currency / real math / shell code, and reports counts before changing anything.
- Apply — checks the tree is clean, then writes and runs the exact tested Python script (code-fence-, inline-code-, frontmatter-, and math-span-aware; idempotent via the (?<!\\) lookbehind so re-running never double-escapes).
- Verify the diff — the safety net: greps that must print nothing for real math ($\rightarrow$, \text) and shell vars ($HOME, $(…), ${VAR}). If anything legit was touched, it tells you to git checkout -- . and stops.
- Print instructions — outputs the build-verify and commit/push commands for user to run.

Do not autonomously run any build, commit, or push.

© [email protected] · CC0-1.0 · f/prompts.chat

Similar prompts

All prompts for Writing and docs →

From the same set77

The whole set →
Senior Code Reviewer (severity-ranked) A code review prompt that ranks findings from blockers down to nits and closes with a verdict. Useful when you need to know what in a patch actually breaks. GP ChatGPT ★ 174,597repo stars TypeScript Library taste A prompt that pins down conventions for a TypeScript library: pnpm, strict tsconfig, tsup, vitest, Changesets. Useful when a project needs one style from the first commit. GP ChatGPT ★ 174,597repo stars Claude Web Page Redesign Planning Prompt A prompt that makes the model audit the current markup and code first, then hand back a redesign plan in markdown. No edits get made. GP ChatGPT ★ 174,597repo stars Automated Text Typing Every 5 Minutes with Python This prompt turns the chat into a Python automation engineer that writes a script typing your text on a timer. Handy when the same line has to go into another window without you touching the keyboard. GP ChatGPT ★ 174,597repo stars Vector-Based Space Combat System A prompt that turns the chat into a game mechanics engineer: give it a high-speed combat concept, get movement and projectile logic back. GP ChatGPT ★ 174,597repo stars High-Velocity Dogfight A prompt that asks a model to build a 3D flight simulator: a cylindrical particle tunnel, 5,000 star particles, and speed-driven motion blur. GP ChatGPT ★ 174,597repo stars Gravity Shift: Low-Poly Physics Platformer A prompt that lays out the concept and the technical brief for a 3D puzzle-platformer where the whole world turns 90 degrees on a keypress. Useful as a starting skeleton for a Three.js and Cannon.js build. GP ChatGPT ★ 174,597repo stars Code Review Professional A prompt that turns a chat model into a code reviewer: it checks quality, coding standards and optimization spots. Handy when you want a second opinion on fresh code. GP ChatGPT ★ 174,597repo stars

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor