Friday, April 20, 2007

Latex: how to comment out lines in emacs

If you are editing a latex file by using emacs, then how to comment out lines and uncomment out lines? As you know, commenting out is just add '%' before the lines and uncommenting is remove '%' before the lines.

People said:
It is often necessary to comment out temporarily a region of TeX or LaTeX code. This can be done with the commands C-c ; and C-c %. C-c ; will comment out all lines in the current region, while C-c % will comment out the current paragraph. To uncomment, simply type C-u - C-c ; to uncomment all lines in the region, or C-u - C-c % uncomment all comment lines around point.

But I find an easier way: just use C-c ; to switch. For example, you have 3 lines without '%', then use C-c ; to add '%', then to uncomment, just use C-c ; again! Remember, before using the keys, to mark your region which you wanna (un)comment.

No comments:

Locations of visitors to this page