On the main site of TeX-LaTeX-StackExchange within comments1 you can use backticks `code` for writing code.

Seems this does not work when the piece of code has a leading sequence of spaces.

E.g., typing ` code` within a comment1 does not work out.

How to write code which has a leading sequence of spaces within a comment1?

1Comment—the kind of short message which you can write after clicking on "Add a comment".


1 Answer 1


You can use a zero width space (eg U+200b) at the start

​ abc xyz 123

That looks the nicest, but if you are expecting someone to copy the code as code it will have the unicode space character and give errors or warnings most likely.

So it is probably best to use a visible marker and tell the user to omit it as in

the code between the two |.     | abc xyz 123|

Note this is network wide (and been asked for and rejected on the network meta), eg

Preserving white space in comments

so nothing that can be changed here.


You must log in to answer this question.

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