ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Gerben Wierda <gerben.wierda@rna.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Puzzle (for me)
Date: Wed, 1 Apr 2020 01:20:57 +0200	[thread overview]
Message-ID: <70E2F74B-F0F9-4A78-8EB0-006DE7467A9A@rna.nl> (raw)

I have a string with double quotes that needs to become a text in a box in METAPOST. METAPOST is used to create an image consisting of boxes and connections.

Basically, the approach is now something like this:

TeX: calls Lua code with \ctxlua{filename}
Lua: context.startMPpage
Lua: read XML. String in XML in filename read by Lua
  Here we know the dimensions in which the string must be typeset and wrapped around because that is also in the XML
Lua: A context() call contains METAPOST code that calls a METAPOST vardef (‘draw box’) with the string as argument
METAPOST: Draws box and call TeX to typeset string using textext(), returns picture object
TeX: Typeset string

In short:
TeX, calls
	Lua, reads XML and executes context( MP code) that gets executed on stopMPpage
		MP code calls TeX which typesets the string

But, if the string contains double quotes (”) this will fail in METAPOST because the double quotes in the string will be printed in METAPOST code that is created by Lua and thus mess up METAPOST.

So, what can I do?

G
___________________________________________________________________________________
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:[~2020-03-31 23:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-31 23:20 Gerben Wierda [this message]
2020-03-31 23:53 ` Henri Menke
2020-04-01 14:25   ` Gerben Wierda

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=70E2F74B-F0F9-4A78-8EB0-006DE7467A9A@rna.nl \
    --to=gerben.wierda@rna.nl \
    --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).