1

I want to copy some good answers to my local tex editor in order to review sometimes future. There will be many errors since like ** ** means bold, space x 4 means writing codes, etc. And sometimes I want to write some answers in local tex editor, and after compile successfully then directly copy to tex.stackexchange.

I want to write following templates :

\documentclass{article}
%some packages or newcommand I need to import    


\begin{document}
%I can directly copy some answers in tex.stackexchange
\end{document}  

What environment(packages, newcommand,etc.) does tex.stachexchange uses? Or how to write an environment(preamble) in LaTeX such that it will be compatible from the syntax in tex.stackexchange?

  • 5
    TeX.SE doesn't use LaTeX for formatting, it uses Markdown syntax. – CarLaTeX Mar 02 '19 at 20:00
  • 4
    The contents here are not rendered in LaTeX. Posts are written in some kind of markdown/HTML flavour. (There are some ways to render markdown with TeX, e.g. https://ctan.org/pkg/markdown or Pandoc. But TeX itself does not really do that out of the box.) – moewe Mar 02 '19 at 20:00
  • See also here: https://tex.stackexchange.com/questions/101717/converting-markdown-to-latex-in-latex – CarLaTeX Mar 02 '19 at 20:02
  • @CarLaTeX Or how to write an environment in LaTeX such that it will be compatible from the syntax in tex.stackexchange? – maplemaple Mar 02 '19 at 20:02
  • @maplemaple See the answers to my previous link, it is not easy. – CarLaTeX Mar 02 '19 at 20:05
  • @Marijin I don't want to compile their codes. I just want to save their whole answer(what they are looking in the website) to a local tex file. – maplemaple Mar 02 '19 at 20:17
  • 1
    Ok I see, I misunderstood - but why would you want to save the full answer in LaTeX? – Marijn Mar 02 '19 at 20:19
  • @Marijin I want to combine many good answers and write a nontrivial example manual for several main topics in LaTeX (e.g. graph, table, beamer etc.) – maplemaple Mar 02 '19 at 20:25
  • @maplemaple: An admirable purpose! Hope you succeed. – murray Mar 02 '19 at 21:39
  • @maplemaple Well, you can always write your own! After having a preamble you only have to re-format questions and answers a bit more. But I'm afraid you can't import questions and answers here directly from a link, etc. –  Mar 03 '19 at 04:27

1 Answers1

1

If we look at the mwe you provided (pasted) in its native state we can see it is part of a web page and would need some serious decoding to restore it as you intended it to look.

<pre class="lang-tex prettyprint prettyprinted"><code><span class="kwd">\documentclass</span><span class="pun">{</span><span class="pln">article</span><span class="pun">}</span><span class="pln">
</span><span class="com">%some packages or newcommand I need to import    </span><span class="pln">


</span><span class="kwd">\begin</span><span class="pun">{</span><span class="pln">document</span><span class="pun">}</span><span class="pln">
</span><span class="com">%I can directly copy some answers in tex.stackexchange</span><span class="pln">
</span><span class="kwd">\end</span><span class="pun">{</span><span class="pln">document</span><span class="pun">}</span><span class="pln">  </span></code></pre>

However if we simply cut and paste as plain text to ANY editor from simple notepad to the most complex of systems then it will be compatible, compliable and compilable

\documentclass{article}
%some packages or newcommand I need to import
\begin{document}
%I can directly copy some answers in tex.stackexchange
Hello maplemaple
\end{document}

\pretend this is latex {class}
It may not be immediately apparent that in most browsers if you
double click the start or end of a structured code block like this  
it will be possible to copy to clipboard, try me at start \ or here >

So there is generally no need to alter / decode answers for use in your editor other than any related comments to a correct answer, assuming you know it is correct :-)

For wider discussions on how's and why's you could look at Feature request: Better support for copying code from question or answers and the related links at the side of that discussion.