From: Aditya Mahajan <adityam@umich.edu>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: tikzpicture in margin
Date: Sun, 14 Feb 2021 16:43:13 -0500 (EST) [thread overview]
Message-ID: <nycvar.YAK.7.78.908.2102141639190.342737@nqv-guvaxcnq> (raw)
In-Reply-To: <534947008.1281700.1613315494023@mail.yahoo.com>
[-- Attachment #1: Type: text/plain, Size: 1354 bytes --]
On Sun, 14 Feb 2021, Jigé wrote:
> Hi all.
>
> I'm trying to place a TikZ picture in the margin.
> Here is a small example:
>
> \usemodule[tikz]
> \setuplayout[backspace=4cm, topspace=2cm, height=middle]
> \starttext
> \input{lorem}
> \margintext{I have discovered a truly
> marvelous proof ... but
> this margin is too narrow
> to contain it.}
> \input{lorem}
> \inmargin{\externalfigure[cow] [width=\marginwidth]}
> % The above works.
> % The following does not:
> \input{lorem}
> \inmargin{
> \starttikzpicture
> \draw[gray] (-2,0) grid (2,2) ;
> \draw plot [domain=-2:2, samples=50, smooth] (\x,{\x * \x});
> \stoptikzpicture
> }
> \stoptext
>
> -> Undefined control sequence
Most likely because the argument of \inmargin is scanned upfront and at that time \draw etc are undefined. One option is:
\startbuffer[picture]
\starttikzpicture
...
\stoptikzpicture
\stopbuffer
\inmargin{\getbuffer[picture]}
Another option (but better to do that in tikz module) is:
\let\draw\relax
\let\x\relax
\inmargin{\starttikzpicture ... \stoptikzpicture}
> Actually the command \startmarginblock ... \stop... described in the ConText reference works with a TikZ picture.
Because the \start ... \stop blocks don't scan the argument.
Aditya
[-- Attachment #2: Type: text/plain, Size: 493 bytes --]
___________________________________________________________________________________
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
___________________________________________________________________________________
next prev parent reply other threads:[~2021-02-14 21:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <534947008.1281700.1613315494023.ref@mail.yahoo.com>
2021-02-14 15:11 ` Jigé
2021-02-14 15:41 ` Henning Hraban Ramm
2021-02-14 21:43 ` Aditya Mahajan [this message]
2021-02-15 9:04 ` Hans Hagen
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=nycvar.YAK.7.78.908.2102141639190.342737@nqv-guvaxcnq \
--to=adityam@umich.edu \
--cc=ntg-context@ntg.nl \
/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).