Hi Wolfgang, Von: Wolfgang Schuster Gesendet: Samstag, 15. Januar 2022 20:28 An: mailing list for ConTeXt users ; Denis Maier via ntg-context Cc: Maier, Denis Christian (UB) Betreff: Re: [NTG-context] XML, dealing with whitespace Denis Maier via ntg-context schrieb am 15.01.2022 um 13:04: Hi all, I have sources that look like this: %%%%%%%%%%%%%%%%%%%%%

Bla Bla Bla

Bla , Bla Bla.

%%%%%%%%%%%%%%%%%%%%% Typesetting this with context gives me a spurious space after the underlined Bla in italics. There is no spurious space, the line break is just converted to a space and I see no reason why this shouldn't happen. To remove space before or after certain parts of text within a paragraph you can use the \removeunwantedspace and \ignorespaces commands. Yes, it's absolutely true. From tex's point of view, the space is not spurious. It's absolutely adaquate to treat the newline as a space here. As I've outlined in my original post the problem occurs because xslt adds these indentations here. FWIW, I finally found this solution, which seems has been added to xslt 3.0 (after being available as a saxon extension: there's a new attribute on xsl:output that can be used to control this: (https://www.saxonica.com/documentation9.5/xsl-elements/output.html) So, the solution to my problem is this: Denis %%%% begin example \starttexdefinition RemovePreceding #1 \removeunwantedspaces #1 \stoptexdefinition \starttexdefinition RemoveFollowing #1 #1 \ignorespaces \stoptexdefinition \starttext Bla \RemovePreceding{Bla} Bla Bla \RemoveFollowing{Bla} Bla \stoptext %%%% end example When only following spaces are a problem a better alternative to \ignorespace is \autoinsertnextspace which checks the following token which ensures there is space when the next character is punctuation. %%%% begin example \starttexdefinition Italic #1 \emphasized{#1} \autoinsertnextspace \stoptexdefinition \starttexdefinition Underbar #1 \underbar{#1} \stoptexdefinition \starttext Bla Bla Bla \Underbar{\Italic{Bla} , Bla Bla.} \stoptext %%%% end example Wolfgang