TransWikia.com

Spurious space after command in ConTeXt

TeX - LaTeX Asked by dreamlax on July 6, 2021

Is it possible to define a macro in ConTeXt which gobbles space after the argument? For example, given this input:

defthing{dosingleargumentdothing}
defdothing[#1]{thing#1}

starttext

thing[hello]
thing[world]

stoptext

This produces the following output:

thinghello thingworld

But, ideally, I’d like it to run together, like this:

thinghellothingworld

I realise I can use thing[hello]%, but just wondering whether there’s something easy I may have missed here. These thing commands are currently being generated by a script. I could configure the script to output the %, but the TeX file is likely to be tweaked by hand afterwards, where it’s possible the % may end up missing, and then the space appears again, so I’d like to try and reduce this possible human error and keep the TeX file looking tidy.

One Answer

There may be a better way to do this in ConTeXt, but the spurious space was removed after placing ignorespaces as the end of the macro definition:

defthing{dosingleargumentdothing}
defdothing[#1]{thing#1ignorespaces}

Correct answer by dreamlax on July 6, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP