4

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)

marked as duplicate by Caramdir, Jake, Thorsten, diabonas, doncherry Jul 8 '12 at 19:45

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 6
    Highlight the block of code and press the {} button (or CTRL+K). – kiss my armpit Jul 7 '12 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. – kiss my armpit Jul 8 '12 at 2:53
9

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 .