As a side note, spaces shouldn’t be an issue and both double quotes and single quotes will be OK too as long as they are not formatted. By formatted quotes I mean the curly quotes in your posts versus the plain text quotes of my post. For anything but the simplest formulas I often bring in a code editor like Atom as it makes the process of forming the quote a lot easier and errors are easier to spot. Quote marks will be unformatted too.
Ah-ha! Now I understand. For convenience, I had been using an app called Drafts on my Mac to create the code and hadn’t noticed the formatted quotes. That all makes sense and I will be careful in future.