

This is a nice remark which does not get processed by LaTeX. Besides this, while gathering the ⟨replacement text⟩ for \foobar, the phrase \end's catcode is not 14.\\ , you will have all the tokens that form the comment-environment within the ⟨replacement text⟩ of \foobar. comment.\fi or But all those approaches are not foolproof.Į.g., you cannot use them for whatsoever commenting inside macro-arguments or within the ⟨balanced text⟩ of a definition: E.g., the approach of using things like \iffalse. the approach of using the comment-package. There are approaches which aim at having (La)TeX read and tokenize things and then carry out the resulting tokens in a way where they vanish without yielding visible output.Į.g.

#Codebox latex comment code#
That's why usually an empty line/two consecutive line-breaks in the input yield the token \par because at the second of these two linebreaks, (La)TeX will encounter the endline-character of category code 5 while the reading apparatus is in state N.) Usually \endlinechar has the number 13 and 13 is the number of the code point of the return-character in (La)TeX's internal encoding (which either is ASCII or is UTF-8), and the return-character/character 13 has category code 5. Usually (La)TeX does remove space-characters (the space character's code-point has the number 32 both in ASCII and in UTF-8) from line-endings and then does attach a character whose code point's number in (La)TeX's internal encoding (which either is ASCII or is UTF-8) equals the number of the integer-parameter \endlinechar before further processing that line of input. (La)TeX reads input line by line and processes each line character by character. Afterwards (La)TeX will start tokenizing the next line and thus the reading-apparatus will be in state N. The subtle difference to using a character of category code 14(comment) is: If you use a character of category code 5 (end of line), depending on the state of the reading-apparatus you get (in state N=new line) a \par-token or (in state M=middle of line) a space-token or (in state S=skipping blanks) no token at all for this category-code-5-character. (You can also use characters of category-code 5(end of line) for having (La)TeX cease tokenizing the current line of input.

Endline-comments by means of % (or any other character whose category-code at the time of reading and tokenizing the input in question is 14(comment) ) are possible.
