I have a LaTeX file called testglister2.tex in my directory ~/GlisterBook. How do I import it into TeX.SE as an MWE? I use emacs as my text editor and from there I can copy the file, but how do I paste it as an MWE?
1 Answer
There is no file upload but you can paste the text from your editor then mark as a code region.
Select the text in emacs (eg M-w
to copy the current region) then (assuming you are using an emacs with bindings to your operating system GUI) that will be on the system clipboard so you can paste it into a text box in the browser (typically with Ctrl-V) then while it is highlighted, you can type Ctrl-K which will indent the text by four spaces which is (one of the) markdown syntax to mark it as a code block with preserved white space and line ends.
~\GlisterBook/trestglister2.tex
but SE responds with something likefile extension not recognised
.```latex
on a single line in the question or answer text box, then paste your code, then add```
on a single line. This is convenient if you later decide to update the code: you can then simply select everything between```latex
and```
, delete it and paste the new code at the same place (moreover, in most modern GUI programs, the delete operation is automatic when a selection is active and you perform the “paste” action). This syntax also works inside list items if you indent all such lines by four spaces.cat trestglister2.tex | curl -s -F "syntax=tex" -F "content=<-" http://dpaste.com/api/v2/
The resulting link you can then post on TeX.SX.