ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: yann--- via ntg-context <ntg-context@ntg.nl>
To: ntg-context <ntg-context@ntg.nl>
Cc: yann@yannherklotz.com
Subject: Centering figures that extend into the margin
Date: Wed, 20 Apr 2022 10:39:11 +0100	[thread overview]
Message-ID: <m2pmlcnlfk.fsf@Yanns-MacBook-Pro.local.mail-host-address-is-not-set> (raw)

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
___________________________________________________________________________________

             reply	other threads:[~2022-04-20  9:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-20  9:39 yann--- via ntg-context [this message]
2022-04-20 20:44 ` Willi Egger via ntg-context
2022-04-20 21:01   ` Yann Herklotz via ntg-context

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2pmlcnlfk.fsf@Yanns-MacBook-Pro.local.mail-host-address-is-not-set \
    --to=ntg-context@ntg.nl \
    --cc=yann@yannherklotz.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).