I have a strange issue with some macros that are creating extra spaces between paragraphs. Note these macros shouldn’t create any content, as they define content that will be sent to registers and content that is used for page references. Its more like invisible data, perhaps the word is “metadata” and other parts of the document need to know it and refer to it, but nothing should be rendered there.


As best as I can understand, when ConTeXt sees one of these macros, it creates a vertical space after the paragraph, draws nothing, then creates another vertical space after that, before drawing the next paragraph, so the result is something close to three lines of space. When appearing after a section title, its also as if there is an empty line, then blank space, then the first paragraph of content appears.

Sample of what the rendered document looks like:

-----

Section Title

. <--if the macro is placed here, a huge empty space after the section title is there

. <-- I’m using these dots to represent empty lines

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\mymacro{}<--even if the macro is placed here, still in the paragraph, it creates a break

.

.<-- the macro appears here, there is an empty space above and before

.

Lorem ipsum odor amet, consectetuer adipiscing elit. Imperdiet suspendisse porttitor tempus arcu turpis cras posuere varius. Volutpat posuere semper nunc metus fermentum egestas? Aenean diam nisl tortor fusce facilisis hendrerit dolor penatibus. Lectus interdum platea rhoncus at leo; ut mi duis. Nisi vehicula morbi curabitur mus urna sodales suspendisse sodales. Viverra inceptos sem aenean ultricies congue ligula condimentum maecenas. Convallis in elementum risus nec taciti bibendum faucibus ac nascetur. Nulla ligula auctor placerat dignissim inceptos. Felis nulla quam viverra augue maximus hendrerit ipsum.

. <-- where the macro doesn’t appear, the spacing between paragraphs is fine (here, no macro, so one line of empty space, not three)

Lorem ipsum odor amet, consectetuer adipiscing elit. Turpis himenaeos conubia neque fringilla neque class. Elementum per fermentum nostra ullamcorper lacinia tortor pellentesque facilisis. Himenaeos sociosqu tellus aptent rhoncus dignissim himenaeos aliquam? Nisi sagittis euismod tincidunt penatibus eget tristique? Sed nam elit sapien tellus mus libero. Consectetur nascetur nec metus pretium hac molestie. Convallis lacinia quam efficitur convallis; metus purus aliquet.


-----


I’ve analyzed the macros carefully, even rebuilt them. Yet, no matter my attempts to recreate and rewrite the code from scratch, they always create this vertical space. They shouldn’t create any content, nor should any evidence of their existence be visible to readers.


I’ve tried for months to find a way to hide these macros, rewriting the code itself many times, as I can’t see any reason why its creating anything at all, and also trying to find ways to hide the “blank” content that gets rendered:


\starteffect[hidden]\mymacro{}\stopeffect

\color[white]{\mymacro}

\setbox\scratchbox=\vbox{\mymacro}

\startnointerference\mymacro\stopnointerference
\inmargin{\mymacro}


These solutions either entirely don’t remove the extra page break, or lead to the actual content within breaking: for instance, if there’s an \index{} entry inside the macro, its page number won’t render properly in the end-of-document index. Or if there’s a \reference, other code attempting to display the page number just shows “page, ??”.


Is there a way to completely hide content, such that nothing at all is rendered on the page and nothing occupies extra blank space, but that doesn’t brak indexes, cross-references, registers, etc.?


--Joel