Possible Duplicate:
How do I mark code blocks?

What is the shortcut for spacing a block of code, picked from some TeX editor, so that they are spaced four spaces? (as opposed to moving each line by four spaces)

  • 6
    Highlight the block of code and press the {} button (or CTRL+K). Jul 7, 2012 at 18:45
  • If highlighting a lengthy block of code is too cumbersome for you, then you should support me by upvoting the following proposoal. Jul 8, 2012 at 2:53

1 Answer 1


You can highlight the block of code and press the {} button or use Ctrl+K:

enter image description here

Note that code formatting requires additional formatting when used in conjunction with a list. For more on this, see

In short,

  • Insert an additional 4 spaces for each level inside the list that you want the code to be represented at;
  • Insert an HTML comment <!-- --> (or similar) to break the list-code structure.

For a general discussion on code in posts, see How do I mark code blocks?

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