4

I have difficulties working with TeX.SE. My OP system is Ubuntu and I use Firefox as my browser. Folk ask questions and and supply a MWE but I haven't found a way to get the MWE so I can try it out except by downloading the entire SE HTML file and deleting 90% of it. I can provide code as an answer but I have to do it by typing each line as code in my answer. I would like to just input my answer.tex file without having to retype it. I have also not come across a method of adding my answer.pdf file to my SE answer.

I have tried searching on SE in general for answers but not seen anything that I thought was helpful.

This is not directly related to TeX and friends but I'm increasingly inclined not to go to what is probably a lot of extra work to provide answers.

Before I could post this I had to supply a tag. I searched through the 54 pages of tags but found none suitable (I was after something like "answers") but then I was unable to create a new "answers" tag. In the end I had to settle with "code" as a tag.

12
  • 2
    I simply select with the mouse and then copy & paste. Jan 5, 2019 at 21:24
  • 6
    Section 3.1 here: tug.org/TUGboat/tb39-3/tb123duck-format.pdf is dedicated to you!
    – CarLaTeX
    Jan 5, 2019 at 21:36
  • 2
    Also since you've posted this on the main site, that's why you couldn't find appropriate tags, since this is really a question about the site, (so a meta question) not about TeX itself.
    – Alan Munn
    Jan 5, 2019 at 21:49
  • Can you use a mouse with a cursor to select content? There seems to be no reason to download raw HTML in order to access the code.
    – Werner Mod
    Jan 6, 2019 at 1:19
  • One progress would be that stackexchange adds a copy button that would copy the code. Because on a laptop without a mouse and with a touchpad, it is difficult to copy the code. With a mouse it's simple, without it's more complicated.
    – AndréC
    Jan 6, 2019 at 10:25
  • @AndréC I have copied literally thousands of example code sections just using a trackpad, I never use a mouse. Jan 6, 2019 at 15:57
  • @DavidCarlisle You are much more skillful than me, you could make a video so that I can see how you do in practice : -)
    – AndréC
    Jan 6, 2019 at 16:00
  • @AndréC how do you select text in any application? just click at one end and drag to the other, or sometimes click edit to get a text box then just type ctrl-a to select all of the text in that box. Jan 6, 2019 at 16:03
  • @DavidCarlisle The problem is for the long code page, when I click at the top left, scrolling down, it removes the click. I have to be very careful when manipulating not to inadvertently click where it doesn't belong. It's a fingering problem and certainly usually too.
    – AndréC
    Jan 6, 2019 at 16:33
  • @AndréC if it's very long, using the edit button and ctrl-a is simpler, but either way I would say it's no easier with a mouse than a trackpad (but it's so many years since I used a mouse regularly, I can't really say...) Jan 6, 2019 at 16:41
  • 1
    @CarLaTeX (and everybody else) I just want to thank you all for your inputs and help. I feel a lot more comfortable now but I'm horrified how much I have forgotten over the years. Jan 11, 2019 at 21:07
  • @PeterWilson Thank you for everything you did and will do for us!
    – CarLaTeX
    Jan 11, 2019 at 21:18

2 Answers 2

8

Adding a "copy code" button

To make copying code blocks easier I use an addon for my browser which adds a little "copy code to clipboard" button at the top left:

enter image description here

There are several different addon available for this, the one I'm currently using is available for firefox and chrome from https://github.com/zenorocha/codecopy and not only works for stackexchange, but also on sites like github etc.

12
  • 2
    This is great!!
    – Alan Munn
    Jan 6, 2019 at 17:19
  • 1
    I have a button "Answer TikZ question", which always produces codes that start with \documentclass[tikz,border=3.14mm]{standalone}. ;-)
    – user121799
    Jan 6, 2019 at 22:27
  • @marmot useful :) I wonder if David has a picture mode button to fill all the empty space from removing the "ask question" button Jan 6, 2019 at 23:02
  • I suspect he indeed has a picture mode button but it has a bug, i.e. the browser freezes when he pushes it. This is the only possible explanation why he usually does not answer TikZ questions.
    – user121799
    Jan 6, 2019 at 23:04
  • @marmot Isn't the TikZ part of your button name redundant in your case? :)
    – Alan Munn
    Jan 7, 2019 at 0:56
  • David has no need for buttons. He never leaves emacs.
    – Alan Munn
    Jan 7, 2019 at 0:57
  • @AlanMunn Why? It is right next to the "order honey liquor" button. These are very different tasks.
    – user121799
    Jan 7, 2019 at 2:20
  • 1
    @marmot I'm assuming that 'Answer question' for you always means 'Answer TikZ question' so the TikZ part is redundant.
    – Alan Munn
    Jan 7, 2019 at 4:16
  • @marmot I doubt that Davids picture mode button is broken - he has a tikz gold badge after all (surly not from posting tikz code :) Jan 7, 2019 at 9:27
  • @samcarter Yes, he can edit tags for that. ;-)
    – user121799
    Jan 7, 2019 at 19:46
  • @samcarter Amazing. It installed and worked for me the first time. Thank you. It solved 50% of my problems/forgetfulness. Jan 11, 2019 at 21:00
  • @PeterWilson Great to hear! Jan 11, 2019 at 21:12
7

How to use a MWE from a question

Simply select the code using your mouse and copy/paste it into your TeX editor to work on.

How to put code into your answer

Select the code from your TeX editor, copy it, and then paste it into the editor box of the answer. To format it as code, select it all and type Control-K or click on the {} icon above the editor window:

code icon

How to post an image of the output

There are various methods available. You can't upload a PDF file; instead you need to upload a PNG or JPG file. Many of us just use a screenshot (on a Mac, for example, I can take a screenshot of any region of the screen (like the image above)).

To upload the file, click on the Image icon:

enter image description here

For more ways to produce output images see:

6
  • On a laptop without a mouse and with a touchpad, it is difficult to copy the code. With a mouse it's simple, without it's more complicated. One progress would be that stackexchange adds a copy button that would copy the code.
    – AndréC
    Jan 6, 2019 at 10:29
  • 2
    @AndréC In case you are using firefox, there is a nice little addon, that adds a "copy code" button: github.com/zenorocha/codecopy Jan 6, 2019 at 12:01
  • @samcarter Thank you very much, this extension is also available for Chrome. You should make an answer because Peter Wilson uses Firefox!
    – AndréC
    Jan 6, 2019 at 14:27
  • 1
    @AndréC I only used 'mouse' in the conceptual sense. I rarely use a mouse in reality, just a touchpad. At least on the Mac, you can click on a beginning spot and then Shift-click on an ending spot and all the text between will be selected, which makes selecting large chunks of code very simple even with a touchpad.
    – Alan Munn
    Jan 6, 2019 at 14:31
  • @AlanMunn I can do this manipulation with the mouse but with the touchpad, I have a lot of difficulties. I must be clumsy: -((
    – AndréC
    Jan 6, 2019 at 14:53
  • 1
    @AndréC I added an answer Jan 6, 2019 at 15:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .