# Save the answer in TEX?

Lot of answers here are excellent but there is no way to save it in LaTeX format. Even if we can put them in favorites or print them or save as pdf .

Also on meta : Save the answer in PDF? but this discussion is about saving to pdf, the best solution utilize https://stackedit.io/ but it only provides save to markdown, html, or pdf.

• click the edit button, copy the source into a tex file, add you favorite preamble Jul 9 '14 at 10:53
• Have to do this for every reply Jul 9 '14 at 10:57

The comment "click the edit button, copy the source into a tex file, add you favorite preamble" is a slight oversimplification. Consider bold and italic fonts, quotes and spoilers, links and images, strikethrough and colors, bulleted and numbered lists, HTML entities (accented letters, etc), underscores and ampersands in text, and the fact that MathJax tolerates some things that LaTeX will not (e.g., \begin{align} ... \end{align}).

But here is Save as LaTeX, anyway. Paste in the URL of any question (here or on another MathJax-enabled SE site, e.g., MathOverflow) and enjoy the result. Answers are ordered by votes. Inclusion of comments is optional. Images are converted into hyperlinks; you'd have to save them separately anyway.

Warning: this stuff is just something I made to learn regular expressions; it's still a work in progress. Please report bugs in comments. Yes, it parses HTML with regex... Sample output (taken from the script and ran through LaTeX compiler):

• Do I report errors here?(Nice name change btw) math.stackexchange.com/questions/906820/… "! Undefined control sequence. l.16 [\f =\1^2+\2^2+2\3^2]" Does it not take \def text?
– Tony
Aug 24 '14 at 0:33
• @user151558 The problem is that TeX processors require definitions to be in topmatter (before \begin{document}), while MathJaX (for lack of topmatter) is okay with them being in a formula within the document. I'll try to come up with a way to extract definitions and put them where they belong. For now, the fix is to copy-paste the \def manually to the beginning of file, removing the surrounding . Compiles after that.
– user147263
Aug 24 '14 at 0:40
• A very very useful tool! Thank you so much! Nov 16 '14 at 4:43
• The dropbox link doesn't seem to exist anymore Jan 25 '18 at 7:18
• @lucidbrot This link seems to be working now: normalhuman.github.io/savetex Feb 2 '19 at 11:31
• Both dl.dropboxusercontent.com/u/29863189/mse/savetex.html and normalhuman.github.io/savetex don't work right now
– JKHA
Sep 4 '19 at 9:44