[NTG-context] Centering figures that extend into the margin
yann at yannherklotz.com
yann at yannherklotz.com
Wed Apr 20 11:39:11 CEST 2022
Hi,
I've been playing around with 'marginnote' layout similar to tufte's books. The
main thing that I can't figure out is how to centre figures that extend into the
margin. These should take over the whole page, but the content of the figure
should be centred, which is normally the case in normal figures.
Below is my try of defining a marginnote that does this, by calculating the
textarea size and setting the width to that. However, I can't seem to then
figure out how to center the externalfigure inside of the figure.
Thanks in advance!
Yann
\useMPlibrary[dum]
\setuplayout[
edgedistance=1cm,
backspace=2cm,
rightmargin=4.5cm,
leftmargin=0cm,
topspace=1cm,
header=1cm,
footer=1cm,
headerdistance=0.5cm,
width=fit,
height=fit,
]
\newdimen\LeftMarginSize
\LeftMarginSize=\dimexpr \backspace + \rightmarginwidth + \rightmargindistance \relax
\newdimen\TextAreaSize
\TextAreaSize=\dimexpr \textwidth + \rightmarginwidth + \rightmargindistance \relax
\definefloat[marginfigure][marginfigures][figure]
\setupfloat[marginfigure][location=inner,default=top,width=\TextAreaSize]
\setupcaptions[marginfigure][
leftmargin=\dimexpr \LeftMarginSize / 2 \relax,
location=bottom,
width=\textwidth,
]
\setuplabeltext[marginfigure=Figure~]
\showframe
\starttext
\startplacemarginfigure
\externalfigure[][width=13cm]
\stopplacemarginfigure
\stoptext
--
Yann Herklotz
https://yannherklotz.com
More information about the ntg-context
mailing list