ChatGPT Click Equation to Copy LaTeX

Klik equation ChatGPT untuk otomatis menyalin LaTeX

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

Аўтар
afrzlfaiz
Усталяванняў за дзень
0
Усяго ўсталяванняў
0
Рэйтынг
0 0 0
Версія
1.2.0
Створаны
01.09.2026
Абноўлены
01.09.2026
Памер
3.8 КБ
Ліцэнзія
MIT
Ужываецца на

ChatGPT Copy Equation as LaTeX


This UserScript adds a dedicated copy button next to mathematical equations displayed in ChatGPT.
It is designed for users who frequently copy equations from ChatGPT into
Microsoft Word, Overleaf, LaTeX editors, Markdown documents, academic reports, or other applications that support LaTeX notation.

Features

  • Adds a copy button next to ChatGPT equations.
  • Supports equations rendered with KaTeX.
  • Copies the original LaTeX source instead of the visually rendered equation.
  • Automatically wraps copied equations with $...$.
  • Removes existing delimiters such as $...$, $$...$$, and \[...\].
  • Converts multiline LaTeX into a single line without breaking matrix row separators such as \\.
  • Improves simple fraction notation for better Microsoft Word compatibility.
  • Uses a large and clearly visible copy icon instead of the text label “LaTeX”.
  • Prevents button text from being copied when selecting the entire ChatGPT response.
  • Shows a checkmark after an equation has been successfully copied.
  • Automatically detects equations generated dynamically while ChatGPT is streaming a response.
  • Works with both ChatGPT light mode and dark mode.

Example


An equation such as:

\frac{x+1}{x-1}


will be copied as:

$\frac{x+1}{x-1}$


The script also converts compact fraction notation such as:

\frac12


into:

\frac{1}{2}


This format is generally safer when pasting equations into Microsoft Word.

How to Use

  1. Install a UserScript manager such as Tampermonkey, Violentmonkey, or Greasemonkey.
  2. Install this script from Greasy Fork.
  3. Open ChatGPT.
  4. Ask ChatGPT to generate a mathematical equation.
  5. A copy icon will automatically appear next to the equation.
  6. Click the icon to copy the LaTeX source to your clipboard.

Using the Copied Equation in Microsoft Word

  1. Open Microsoft Word.
  2. Create a new equation using Alt + =, or use Insert → Equation.
  3. Paste the copied LaTeX equation.
  4. If necessary, set the Word equation input format to LaTeX.


This workflow is especially useful for academic writing, reports, assignments, theses, and documents containing many mathematical expressions.

Supported Websites

https://chatgpt.com/*
https://chat.openai.com/*

How It Works


The script detects mathematical expressions using the following selectors:

[data-math-source], .katex


It attempts to retrieve the original LaTeX source from the
data-math-source attribute.
If that source is unavailable, it reads the KaTeX annotation:

<annotation encoding="application/x-tex">


A MutationObserver monitors newly generated page content, allowing the script to detect equations that appear while ChatGPT is generating a response.
No page refresh is required.

Copy Button Behavior


The copy control uses an SVG icon instead of visible text.
This avoids adding labels such as “LaTeX” to the selected text when a user highlights and copies an entire ChatGPT response.


The button is also configured with:

user-select: none;
-webkit-user-select: none;


This makes the button itself less likely to interfere with normal text selection.

Privacy


This script does not send data to external servers and does not use third-party APIs.

  • No conversation data is uploaded.
  • No external analytics are used.
  • No account information is collected.
  • No network requests are performed by the script.
  • The script only reads equation data already rendered on the current ChatGPT page.
  • Clipboard access is used only when the user clicks the copy button.


The only special UserScript permission used is:

@grant GM_setClipboard


This permission is required solely for copying the formatted LaTeX equation to the clipboard.

Compatibility Notes


ChatGPT's page structure may change over time.
If OpenAI changes the way mathematical equations are rendered, the script may require updates.


If you find an equation that is not detected correctly or a LaTeX expression that is copied incorrectly,
please report the issue through the Greasy Fork feedback section and include an example equation whenever possible.

Changelog

Version 1.1.0

  • Replaced the “LaTeX” text button with a copy icon.
  • Increased the button size for better visibility.
  • Prevented button labels from being included when copying selected ChatGPT text.
  • Added a temporary checkmark indicator after successful copying.
  • Improved button appearance for both light and dark themes.

Version 1.0.0

  • Initial release.
  • Added LaTeX copy buttons to ChatGPT equations.
  • Added dynamic equation detection using MutationObserver.
  • Added basic LaTeX formatting for improved Microsoft Word compatibility.