Getting Complex Equations From One Place To Another Without Breaking Everything
Copied equations from one system to another and watched them turn into garbage? Happens constantly. The core issue is that math equation formats are not universal. What works perfectly in one environment breaks when you move it elsewhere. I have spent years dealing with this, mostly because people send each other equations through email, chat, and documents without thinking about format compatibility. Here is how to actually do it right. The process depends entirely on where the equation lives and where it needs to go. Start by identifying the source format. Most equations you encounter live in one of three places: LaTeX, MathML, or a proprietary editor like Microsoft Word's equation engine. If you are copying from a PDF or a scanned textbook, you are in a much harder category and should skip ahead to the section about OCR tools. The simplest case is copying from another LaTeX source. You select the equation, copy it, and paste it into your LaTeX editor. It usually works. The problem shows up when you copy from a web page or a document that uses inline LaTeX rendered as an image rather than raw code. You end up with a bitmap in your clipboard. Pasting that into a LaTeX file does nothing useful. You need the raw source code.
When working with Microsoft Word equations, the copy-paste workflow is slightly different. Word uses its own equation format based on OMML (Office Math Markup Language). If you copy an equation from Word and paste it into Google Docs, it typically converts to a simplified format that may drop subscripts, integrals, or fraction styling. The reverse is also true. Equations going from Google Docs back to Word often lose their editability and become static images.
The Tools That Actually Work
For LaTeX to LaTeX transfers, no special tool is needed. Just use the source code. For everything else, you need a converter. I use a few depending on the situation. Pandoc is the first tool I reach for. It converts between Markdown, LaTeX, HTML, and DOCX while preserving equation formatting in most cases. The command is straightforward. You point it at a source file and specify the output format. Equations in LaTeX double-dollar notation survive the conversion. Inline equations wrapped in single dollars sometimes get mangled if the input is not well-formed. I learned this the hard way when a collaborator sent me a ten-page document with inconsistent equation delimiters. About thirty percent of the equations broke during conversion. I had to go through and fix the broken ones manually. That took two hours. For copying individual equations from web pages, MathJax Context Menu is useful. It lets you copy the underlying LaTeX source from any page that renders MathJax. You right-click the equation and select copy LaTeX. This bypasses the problem of accidentally copying rendered output instead of the source code. The catch is that not every web page uses MathJax. Some use KaTeX, some use their own custom rendering, and some just serve the equation as an image. If the equation is an image, MathJax Context Menu will not help you.
Get the Full Details

When equations come from Springer or Elsevier journal articles, the PDF often contains embedded LaTeX or MathML in the metadata. You can extract it using tools like pdfplumber or by opening the PDF source directly if it is available. I once needed to copy a set of twelve coupled differential equations from an Elsevier paper for a replication study. The equations were typeset beautifully but the PDF had no selectable text for the math blocks. I used the Crossref API to find the supplementary material, which contained the LaTeX source. Without that, I would have had to retype all twelve equations by hand.
Converting Between Formats
The most common format conversion I deal with is LaTeX to MathML. This matters when you are publishing to a system that requires accessible math, like many academic journals now do. There are several tools for this. mhchem converts chemical notation within LaTeX equations to proper MathML. For general LaTeX to MathML conversion, latex2mathml is a Python library that handles most standard equation structures. It does not handle every edge case, but it covers the vast majority of what you will encounter in practice. Here is a practical example. You have a LaTeX equation with a piecewise function, integrals, and a matrix. You pass it through latex2mathml. The output is valid MathML that renders correctly in most browsers. But there is a known issue with nested fractions. The converter sometimes produces MathML that looks correct visually but fails accessibility tree validation. If you are working in a context where accessibility compliance matters, you need to validate the output separately. I use the WAVE evaluation tool for this. It flagged two of my converted equations as non-compliant even though they rendered fine visually. For Word to LaTeX conversion, the situation is less clean. Word's equation format does not map cleanly to LaTeX. pandoc can do the conversion, but complex equations often come out with incorrect bracketing or missing scaling commands. A fraction that displays as a tall stacked fraction in Word may come out as a horizontal sequence in LaTeX that looks wrong. You have to review every converted equation carefully. There is no automatic way around this.
When Copy Paste Fails Completely
Some equations simply cannot be copied. This happens most often with scanned documents, photographs of handwritten equations, or PDFs generated from old typesetting systems. In these cases, you need OCR with mathematical notation support. Mathpix is the tool people reach for here. You upload an image or a screenshot, and it returns LaTeX source. It is expensive for heavy use but accurate enough for occasional work. I ran into a situation last year where Mathpix failed on a specific type of equation. The source was a scanned economics paper from the 1990s with a particular font for summation symbols. Mathpix interpreted the summation notation as the letter S followed by a subscript. The resulting LaTeX was syntactically valid but semantically wrong. I caught it because the rendered output did not match the original. The workaround was to manually correct the few affected equations. There were only four of them out of roughly sixty in the paper, but missing that detail would have invalidated the replication. Another failure mode is equations that reference external notation defined elsewhere in the document. If you copy a single equation out of context, symbols like \Omega or \nabla may render correctly in isolation but break when pasted into a document that defines them differently or not at all. Always check that your target document has the necessary packages loaded. For LaTeX, that means verifying your preamble includes amsmath, amsfonts, and any other packages the equation depends on.

A Workflow That Saves Time
Most of the time wasted on equation copy-paste comes from ad hoc handling. I have a standard workflow now that reduces errors significantly. When I receive equations from a collaborator, I ask for the source format rather than the rendered output. LaTeX source is always preferred. If they send a Word document, I convert it with pandoc and then audit every equation against the original. I keep a checklist of common failure points: nested fractions, piecewise functions, matrix environments, and custom macro usage. For equations I need to pull from published papers, I first check whether the journal provides supplementary LaTeX files. Many do now. If not, I try MathJax Context Menu for web versions or Mathpix for PDFs. I never accept a rendered equation as final without verifying it against the source. Rendering artifacts are subtle. A missing comma in a fraction bar or an extra bracket can change the mathematical meaning entirely. The single biggest improvement in my workflow came from standardizing on LaTeX as the interchange format. When everyone on a project agrees to use LaTeX source for all equation exchange, the copy-paste problem largely disappears. The remaining issues are format mismatches within LaTeX itself, like different package versions or custom command definitions. Those are solvable with a shared preamble and a version pin in your requirements file.
If you are working in an environment where LaTeX is not an option and you are stuck with Word and HTML, pandoc remains your best intermediary. Convert everything through pandoc before final delivery. Do not copy equations directly between Word and HTML editors. The direct transfer loses information that pandoc preserves during its format transformation steps. This approach usually cuts equation handling time from an hour of manual fixing down to fifteen minutes of review.