# Solutions for copy-n-paste text with LaTeX formulas in it

I had the idea to start copy-n-pasting some great answers from https://stats.stackexchange.com/ to my own notes. I quickly discovered that formulas aren’t quite copy-able along with the text - getting garbage when I do that.

This is a Wiki Post! Let’s compile a list of best solutions for this problem.

The complete solution involves two steps:

1. copy: being able to copy the source (usually you can’t just copy wysiwyg style)
2. paste: pasting it somewhere where it can be rendered back

Note: we don’t want just the Latex formulas - we want the whole text with some Latex in it. This is for quickly saving interesting/useful notes, not just for writing your own paper or post, where you want to inject some latex. So OCR solutions don’t quite fit here, since even if they get the rest of the text - most likely they will lose formatting.

# 1. How to copy text that has \LaTeX in it

Here is a list of main sources where the text with \LaTeX formulas copying is usually done from:

## Wikipedia

Say you want to copy a definition along with the formula from this page.

Step 1. Click on  link of the desired section (or the whole doc), which will take you to here.

Step 2. And now you can grab the formula and any text around it:

A regularization term (or regularizer) $R(f)$ is added to a [[Loss functions for classification|loss function]]:
: $\min_f \sum_{i=1}^{n} V(f(x_i), y_i) + \lambda R(f)$


# Wishlist: Direct Copy-n-Paste

Ideally, of course, one should be able to copy-n-paste directly from the web into an editor and have all the markup/markdown preserved, including latex formulas - if you find a direct way please share.

One advantage for example of using say OpenOffice/LibreOffice is that it can automatically save remote images locally - the markdown is not great that way, since the link rot is very high, as always, so it’s not a safe way to save notes if they involve images - we want them to be local.

This is a wikipost - Please contribute and enhance! Thank you!

1 Like

The best way to do this is Mathpix Snip

It allows you to just take a screenshot of the equation you want by just clicking and dragging over the equations you need and it will output it in LaTeX.

Here is the workflow (taken from the website):

Most likely using deep learning, so a great way to use deep learning to help take better deep learning notes!

1 Like

This is good, but it’s not addressing my need. There are many tools that let you copy the Latex - this is a very inefficient way if you want to copy the whole block of text with some latex in it.

What I’m after is a quick copy-n-paste of the whole text. I will clarify the first post.