ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Centering figures that extend into the margin
@ 2022-04-20  9:39 yann--- via ntg-context
  2022-04-20 20:44 ` Willi Egger via ntg-context
  0 siblings, 1 reply; 3+ messages in thread
From: yann--- via ntg-context @ 2022-04-20  9:39 UTC (permalink / raw)
  To: ntg-context; +Cc: yann

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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Centering figures that extend into the margin
  2022-04-20  9:39 Centering figures that extend into the margin yann--- via ntg-context
@ 2022-04-20 20:44 ` Willi Egger via ntg-context
  2022-04-20 21:01   ` Yann Herklotz via ntg-context
  0 siblings, 1 reply; 3+ messages in thread
From: Willi Egger via ntg-context @ 2022-04-20 20:44 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Willi Egger

Hi Yann,

I have not a solution for you  but I would like to point you to the “details” manual, where many of special placements of floats are discussed.

Kind regards

Willi

> On 20 Apr 2022, at 11:39, yann--- via ntg-context <ntg-context@ntg.nl> wrote:
> 
> 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
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Centering figures that extend into the margin
  2022-04-20 20:44 ` Willi Egger via ntg-context
@ 2022-04-20 21:01   ` Yann Herklotz via ntg-context
  0 siblings, 0 replies; 3+ messages in thread
From: Yann Herklotz via ntg-context @ 2022-04-20 21:01 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Yann Herklotz, Willi Egger

Hi Willi,

> I have not a solution for you but I would like to point you to the “details”
> manual, where many of special placements of floats are discussed.

Thanks a lot for the pointer, I'll have a look at that manual in more detail as
I had only had a cursory glance until now.

Kind regards,
Yann

-- 
Yann Herklotz
https://yannherklotz.com
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-04-20 21:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-20  9:39 Centering figures that extend into the margin yann--- via ntg-context
2022-04-20 20:44 ` Willi Egger via ntg-context
2022-04-20 21:01   ` Yann Herklotz via ntg-context

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).