GeneralCommand split over > 1 line ending with comment marker %

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
pandammonium
Posts: 55
Joined: Thu Oct 30, 2008 4:12 pm

Command split over > 1 line ending with comment marker %

Post by pandammonium »

Hi, I've noticed in other people's Latex code that when they write a command that is split over more than one line, each broken line is ended by a comment marker, thus:

Code: Select all

\newenvironment{envname}{%
  % commands with %s after them
}{%
  % more commands with %s after them
}
I'm curious about this practice, but can't find anything about it on the Internet. Could someone explain it to me, please?

Cheers.
Last edited by pandammonium on Thu Feb 19, 2009 3:49 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
Stefan Kottwitz
Site Admin
Posts: 10360
Joined: Mon Mar 10, 2008 9:44 pm

Re: Command split over > 1 line ending with comment marker %

Post by Stefan Kottwitz »

Hi,

the % comments out the line break that would otherwise act like a blank and may produce unwanted horizontal space,

Stefan
LaTeX.org admin
pandammonium
Posts: 55
Joined: Thu Oct 30, 2008 4:12 pm

Re: Command split over > 1 line ending with comment marker %

Post by pandammonium »

Ah, that makes sense. Thanks, Stefan. I'll take up the practice myself!
Post Reply