3

This answer explains very well how to get text on context's grid and floats to align nicely. I have the same requirement for aligning, but I need it for the caption beside the figure.

Considering the following example (adapted from the same answer) how could I get

  • the caption to be on the top line of the grid?
  • the figure's top to align with the x-height of the first grid line?

```

\useMPlibrary        [dum]
\setuplayout         [grid=yes]
\setupinterlinespace [line=20pt]

\setupfloats   [figure] [sidealign=line]
\setupcaptions [figure] [location={left, high},
%                        inbetween={\blank[-\strutdepth]}
                        ]

\starttext
\showgrid

\startplacefigure
  [title={There is not so much basic instruction, as of now, as there was in the old days, showing the differences between good and bad typographic design.},
  ]
\externalfigure [dummy] [width=.6\textwidth]
\stopplacefigure
\input zapf

\stoptext

```

  • 2
    Judging from the source there once seemed to be a mechanism \setupfloatcaption[figure][location=grid], but it seems to be not implemented (anymore?) and the caption is just not displayed at all. – Henri Menke Apr 6 '17 at 2:28
  • Thank you for going into depth with this! I had thought this might be solved by some simple instructions which I just couldn't figure out. But by what you found out it looks like I should take this problem to the developers. – Florian Apr 6 '17 at 7:42
  • Crosspost on ntg-context mailman.ntg.nl/pipermail/ntg-context/2017/088502.html – Henri Menke Apr 7 '17 at 9:35
  • oh yes, I should have mentioned that I have linked to this question on the mailing list to bring Henri's conclusion to the attention of the context-developers and/or possibly get hints for a workaround. – Florian Apr 7 '17 at 10:29
1

By trial-and-error I've come to the following that works for my documents. It seems a bit hacky to me -- I think there should be a way to put all grid-handling in the preamble -- but it meets my requirements for the result.

Without the offset, the picture aligns to the top of the text box, not of the actual ascender height. The length has to be adjusted to fit the font and spacing.

\useMPlibrary        [dum]
\setuplayout         [grid=yes]
\setupinterlinespace [line=20pt]


\setupcaption [figure] [
                        location={left,high}, 
                        number=no,
                        inbetween={\blank[-.01mm]}, %picture top-aligned, caption on grid
                        ]


\starttext


\showgrid


\startplacefigure
    [location=top,none,title={There is not so much basic instruction, as of now, as there was
    in the old days, showing the differences between good and bad typographic design.},
    ]
  \placeongrid[max]{\offset[y=2mm]{
  \externalfigure [dummy] [width=.6\textwidth]%
  }}
\stopplacefigure

\input zapf


\stoptext

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.