How to avoid the space inserted after a function call?

When I apply a function to a section, a space is inserted after the call. How do I get rid of this space?

#let noop(content) = [
  #content
]


// These two lines generate the same output:

#noop[abc]def

#noop[abc] def

The space is inserted because of the newline characters that are part of your function. If you only want to show the content, you have to remove the newline characters (and spaces) around the content. Alternatively you could use curly braces to use the code mode in your function. Newline characters and spaces would be ignored in that case.

#let noop(content) = [#content]
// or
#let noop(content) = {
  content
}
1 Like