Difference between revisions of "Command/MPdrawing"

From Wiki
Jump to navigation Jump to search
(Created page with "Documentation for \MPdrawing")
 
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
<cd:commandgroup name="MPdrawing" xmlns:cd="http://wiki.contextgarden.net/commanddoc/20200807">
 
<cd:commandgroup name="MPdrawing" xmlns:cd="http://wiki.contextgarden.net/commanddoc/20200807">
 
<cd:shortdesc><!-- a short command summary goes here -->
 
<cd:shortdesc><!-- a short command summary goes here -->
The command <tt>\MPdrawing</tt> is used for Metapost inline graphics.  
+
The command <tt>\MPdrawing</tt> is used for Metapost inline graphics.
 
</cd:shortdesc>
 
</cd:shortdesc>
 
<cd:variants>
 
<cd:variants>
Line 22: Line 22:
 
<context source="yes">
 
<context source="yes">
 
\startluacode
 
\startluacode
  context("text before")
 
 
   context.startMPdrawing()
 
   context.startMPdrawing()
 
   context("fill fullcircle scaled 2cm withcolor darkyellow;")
 
   context("fill fullcircle scaled 2cm withcolor darkyellow;")
 
   context.stopMPdrawing()
 
   context.stopMPdrawing()
 +
  context("text before")
 +
  context.MPdrawingdonetrue()
 +
  context.getMPdrawing()
 
   context("text after")
 
   context("text after")
 
\stopluacode
 
\stopluacode
 
</context>
 
</context>
 +
 +
Reminder: we call up the drawing with {{cmd|getMPdrawing}}, but first we have to inform the compiler that our METAPOST drawing is completed with {{cmd|MPdrawingdonetrue}}.
 +
  
 
With {{cmd|MPdrawing}} :
 
With {{cmd|MPdrawing}} :
 
<context source="yes">
 
<context source="yes">
 
\startluacode
 
\startluacode
  context.MPdrawingdonetrue()
 
 
   context.MPdrawing("fill fullcircle scaled 2cm withcolor darkgreen;")
 
   context.MPdrawing("fill fullcircle scaled 2cm withcolor darkgreen;")
 
   context("text before")
 
   context("text before")
 +
  context.MPdrawingdonetrue()
 
   context.getMPdrawing()
 
   context.getMPdrawing()
   context("text after")
+
   context("text after")
 
\stopluacode
 
\stopluacode
 
</context></cd:description>
 
</context></cd:description>

Latest revision as of 12:53, 8 May 2024


\MPdrawing

Summary

The command \MPdrawing is used for Metapost inline graphics.

Settings

\MPdrawing{...}
{...}content

Description

Similar to the environment \startMPdrawing.

It was introduced in 2010 to reduce needed calls with lua. Source: https://mailman.ntg.nl/archives/list/ntg-context@ntg.nl/message/AIAWMGBFQQ5QPKNPOPDKFE4U3P4DZJDY/


With \startMPdrawing :

\startluacode
  context.startMPdrawing()
  context("fill fullcircle scaled 2cm withcolor darkyellow;")
  context.stopMPdrawing()
  context("text before")
  context.MPdrawingdonetrue()
  context.getMPdrawing()
  context("text after")
\stopluacode

Reminder: we call up the drawing with \getMPdrawing, but first we have to inform the compiler that our METAPOST drawing is completed with \MPdrawingdonetrue.


With \MPdrawing :

\startluacode
  context.MPdrawing("fill fullcircle scaled 2cm withcolor darkgreen;")
  context("text before")
  context.MPdrawingdonetrue()
  context.getMPdrawing()
  context("text after")
\stopluacode

Examples

Notes

See also

Help from ConTeXt-Mailinglist/Forum

All issues with: