> On 16 Feb 2024, at 00:34, Bruce Horrocks <n...@scorecrow.com> wrote: > > The extra space is because you have a space between {first_name} and > {\xmlatt... on line 9 of xml.tex. > >> On 15 Feb 2024, at 20:28, Michael Guravage <gurav...@literatesolutions.com> >> wrote: >> >> Greetings, >> >> I'm typesetting an address book whose addresses are in XML. A typical entry >> has this structure: >> >> <family surname=""> >> <address street="" housenumber="" postcode="1" city="" telephone="" /> >> <members> >> <member first_name="" initials="" maiden_name="" birthday="" email="" >> mobile="" /> >> <member first_name="" initials="" birthday="" email="" mobile="" /> >> <member first_name="" initials="" birthday="" /> >> </members> >> </family> >> >> initials and birthday are required, first_name can be left blank and email, >> mobile and maiden_name are optional. >> >> I've written a macro (name) to compose the name, i.e. initials, first_name >> (maiden_name), and another macro (nameemaillink) to make the name a link >> associated with an email address. >> >> % Derive an individual's name >> \def\name#1% >> {\ifxmlattempty{#1}{first_name} {\xmlatt{#1}{initials}} \else >> {\xmlatt{#1}{initials}, \xmlatt{#1}{first_name}} \fi > %%%% Remove the space after {first_name} here >> \ifxmlattempty{#1}{maiden_name} {} \else { >> \tfxx(\xmlatt{#1}{maiden_name})} \fi}
I am fairly certain the “ {} “ before the \else introduces spaces. >> >> % Create a mailto:link that associates a individual's name with their email >> address. >> \def\nameemaillink#1% >> {\ifxmlattempty{#1}{email} {\name{#1}} \else {\goto{\name{#1}} >> [url(mailto:\xmlatt{#1}{email})]} \fi} >> >> I thought I was done when I noticed that a composed name with an empty first >> name, with or without an email address, is slightly indented. In the mwe Moe >> and Curly, without first names, are indented; while Shemp and Michael aren't. >> >> That the undesired indentation/alignment is dependent on the presence of a >> first name is baffling. After this long description, if someone would look >> at the code and tell me where I've gone wrong I would be very grateful. The >> interesting bits begin on lines 8 and 12 in xml.tex. > > — > Bruce Horrocks > Hampshire, UK > > ___________________________________________________________________________________ > If your question is of interest to others as well, please add an entry to the > Wiki! > > maillist : ntg-context@ntg.nl / > https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl > webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) > archive : https://github.com/contextgarden/context > wiki : https://wiki.contextgarden.net > ___________________________________________________________________________________ — Taco Hoekwater E: t...@bittext.nl genderfluid (all pronouns) ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________