by kaiserkarl13 » Thu Aug 31, 2023 8:17 pm
Here's a reason for the percent sign (i.e., a comment, which has the effect of eating the spaces until the next line); compare the following:
Code: Select all
\documentclass{article}
\newcommand*{\hello}{
Hello, world!}
\newcommand*{\goodbye}{%
Goodbye, world!}
\begin{document}
\noindent
This is the \hello\ command. Saying\hello\ is what we are doing.
This is the \goodbye\ command. Saying\goodbye\ is what we are doing.
\end{document}
See how the first one has a space, even though I didn't put one in the text? That's why the % signs are used. I could also have ended the line with a command, like so:
Code: Select all
\newcommand*{\hello}{\relax
Hello, world!}
That would do the same thing. I could also have left off the end-of-line character, like this:
Code: Select all
\newcommand*{\hello}{Hello, world!}
Here's a reason for the percent sign (i.e., a comment, which has the effect of eating the spaces until the next line); compare the following:
[code]
\documentclass{article}
\newcommand*{\hello}{
Hello, world!}
\newcommand*{\goodbye}{%
Goodbye, world!}
\begin{document}
\noindent
This is the \hello\ command. Saying\hello\ is what we are doing.
This is the \goodbye\ command. Saying\goodbye\ is what we are doing.
\end{document}
[/code]
See how the first one has a space, even though I didn't put one in the text? That's why the % signs are used. I could also have ended the line with a command, like so:
[code]
\newcommand*{\hello}{\relax
Hello, world!}
[/code]
That would do the same thing. I could also have left off the end-of-line character, like this:
[code]
\newcommand*{\hello}{Hello, world!}
[/code]