Hraban,

From what I understand, the marginal is an insert attached to a line, and |\placesidebyside| is a vertical block; without a reliable line anchor, ConTeXt pushes it away. A solution? Either force a line anchor (|\dontleavehmode ... \par|), or (better) encapsulate |\placesidebyside| in a box and apply a |voffset| calculated on |\ht| of the box (so the marginal follows the block, even if it jumps from page to page). I don't know if the following MWE is the most elegant or effective (or robust) approach, but it seems to work (at least for me, the test is functional, even though I haven't tested it beyond two pages). I don't know if that's really the goal you're looking for either...You'll tell me !

Best//JP

\starttext


\def\SideBySideWithInnerMarg#1#2#3{%

\begingroup

\setbox0\vbox{%

\placesidebyside{#2}{#3}%

}%

% On place le marginal "après", mais on le remonte d'une hauteur de box

\ininner[voffset=-\ht0]{#1}%

\box0

\endgroup

}


\input{ward}


\dorecurse{7}{%

\SideBySideWithInnerMarg

{MARG}

{\blackrule[width=3cm,height=3cm,color=orange]}

{\blackrule[width=3cm,height=2cm]}

\par

\input{ward}\par

}


\stoptext





Le 18/02/2026 à 18:33, Henning Hraban Ramm a écrit :
Hi,

if I call a marginal before a \placesidebyside (don’t know how to call that more generally), it gets placed only at the bottom, and sometimes on the next page (couldn’t reproduce that in the MWE).

If I use the voffset option, I can move it up, but only manually, since I don’t know the height of the following construct – in my book, that’s a code example beside the result. And voffset doesn’t help if the marginal moved to the next page.

Do you have a solution?


"""
\starttext

\ininner{MARG}
\input{ward}

\dorecurse{7}{
%\ininner[voffset=-3cm]{MARG}
\ininner{MARG}
\placesidebyside
{\blackrule[width=3cm,height=3cm,color=orange]}
{\blackrule[width=3cm,height=2cm]}

\input{ward}\par
}

\stoptext
"""
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!

maillist : [email protected] / 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
___________________________________________________________________________________
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : [email protected] / 
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
___________________________________________________________________________________

Reply via email to