I would like to achieve, what in Adobe InDesign is called a paragraph rule over a figure's caption, i.e a line on top of the caption, while keeping the caption itself right-aligned (actually aligned to the inner edge).
Here's an MWE (note that this MWE is similar to what I posted for a previous question and will soon be reworked to incorporate the suggestions I received there):
\setuppapersize[A4][A4]
\setuplayout
[
backspace=11.67mm, width=131.25mm,
topspace=21.21mm, height=254.57mm,
headerdistance=13pt, header=13pt,
footerdistance=13pt, footer=13pt,
rightmargindistance=13pt, rightmargin=39.5mm,
]
\setuppagenumbering[alternative=doublesided, location=]
\setuphead[section][
page=right,
continue=no,
style=\ssb\bf,
]
\definefloat[pagefloat][pagefloats][graphic]
\setupfloat[pagefloat][
default={page,header,footer},
]
\setupcaption[pagefloat][
width=max,
location=top,
topframe=on,
toffset=\dimexpr 0.25\lineheight \relax,
headstyle=\ss\bf,
style=\tfx,
align=inner,
spaceinbetween=nowhite,
]
\def\PageFigure#1#2%
{
\placepagefloat[]{#2}{
\offset[
leftoffset=\dimexpr -\rightmarginwidth - \lineheight \relax,
]{
\externalfigure[#1][
width=\dimexpr \textwidth + \rightmarginwidth + \lineheight \relax,
height=\textheight,
factor=fit,
]
}
}
}
\starttext
\chapter{Testing Ruled Captions}
\dorecurse{3}{\input{knuth}}
\PageFigure{https://via.placeholder.com/1600x900.png?text=Wide+Test+Image}{First line\Second line of the caption}
\section{First Section}
\dorecurse{4}{\input{knuth}}
\stoptext
This is what it looks like, when I remove the line topframe=on,: This is how I would like to align the text.
But here's, what it looks like with the topframe on:
Why does merely adding the top frame change the alignment of the text? Can this be prevented or, better even, adjusted separately?
Any help would be much appreciated.




inner), as long as thetopframeis turned off (i.e. when the linetopframe=on,is commented out). But, as soon as I add the topframe, the text becomes left-aligned: see my second screenshot or your example. I'm not sure, how to keep the text right-aligned, while adding a line above the caption... – Marcus C. Feb 10 '23 at 19:44