A very Spacemacs-specific question!
In Spacemacs, when you're in latex-mode (which is actually LaTeX-mode provided by AUCTeX), the shortcuts for commenting and uncommenting lines are not the default Emacs ones, but are instead overridden by Spacemacs' clever use of evil-mode (Vim emulation layer).
Here are the shortcuts you're looking for:
To comment multiple lines:
- Select the lines you want to comment using Visual Line mode (
V in evil-mode, or C-SPC and move your cursor to select in emacs-mode).
- Then press:
SPC c l (that's a lowercase L, not a 1).
To uncomment multiple lines:
- Again, select the lines (same way:
V and move, or C-SPC and move).
- Then press:
SPC c l (yep, the same shortcut works for both commenting and uncommenting!).
What's happening here:
SPC c is the leader key for "comment" related commands in Spacemacs.
l stands for "line" (comment/uncomment the line(s)).
This SPC c l works not just in LaTeX-mode, but in most programming modes supported by Spacemacs (for languages where commenting out lines makes sense, of course!).
Why not the usual M-;?
In vanilla Emacs (without evil-mode or Spacemacs), M-; (alt + semicolon) is the standard binding for comment-dwim (Do What I Mean), which tries to intelligently comment or uncomment the region or the current line. However, in Spacemacs, with evil-mode active (which it is, by default), this binding is shadowed by Vim-like bindings, hence SPC c l becomes your friend.
Extra tip: If you ever get lost, remember:
- Press
SPC ? (or C-h m) to see all major and minor mode bindings (this will list SPC c l among others).
- For line-wise operations in evil-mode,
V (capital V) is your friend to enter Visual Line mode.
- Whenever you select something (region active) and are unsure what to do,
SPC (leader key) will show you relevant actions in the which-key mini-buffer.
Happy LaTeXing in Spacemacs!