ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Fabrice Couvreur <fabrice1.couvreur@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: [NTG-context] Re: The graph is not visible.
Date: Thu, 25 Apr 2024 16:08:28 +0200	[thread overview]
Message-ID: <CACyK-epSvuDuavd3=K4UOT4Ukzt7jDGFg49MdPvrMm2Rj+JHaQ@mail.gmail.com> (raw)
In-Reply-To: <F5ACA1AB-EA56-4356-BFB0-214DDADD17AE@bittext.nl>


[-- Attachment #1.1: Type: text/plain, Size: 4764 bytes --]

Hi Taco,
I knew I wouldn't be able to explain what was happening.
The code works perfectly and the figure is clearly visible in the component
chapter-14 :

\startcomponent[chapter-14]
\startMPpage
...
\stopMPpage
\stopcomponent

But if I compile my project, it disappears !!

\startproduct[terminale-manual]
 \startbodymatter
      \component[chapter-1]
      \component[chapter-2]
      \component[chapter-3]
      \component[chapter-4]
      \component[chapter-5]
      \component[chapter-6]
      \component[chapter-7]
      \component[chapter-8]
      \component[chapter-9]
      \component[chapter-10]
      \component[chapter-11]
      \component[chapter-12]
      \component[chapter-13]
      \component[chapter-14]
    \stopbodymatter
\stopproduct

Le jeu. 25 avr. 2024 à 13:36, Taco Hoekwater <taco@bittext.nl> a écrit :

> H Fabrice,
>
> You did not provide a good minimum test because the graph by itself
> renders fine:
>
>
>
> Best wishes,
> Taco
> (if all else fails, you can replace \startMPcode with \startMPpage and
> generate a standalone graph that way)
>
> > On 25 Apr 2024, at 12:27, Fabrice Couvreur <fabrice1.couvreur@gmail.com>
> wrote:
> >
> > Hi,
> > I don't know if I can explain the problem I'm having. I made a project
> with 14 chapters. In each of them, there are graphics embedding metapost
> code. I proceed as follows : I compile each chapter alone with lmtx then I
> compile the project containing the 14 chapters. I didn't encounter any
> problems except with a graphic from the last chapter. It is indeed in
> chapter 14 but not in the project ! I give the code for this graph.
> > Thanks.
> > Fabrice
> >
> > \startMPcode
> >
> >                interim linejoin := mitered;
> >                interim ahangle := 30;
> >                numeric u, pi;
> >
> >                pi = 3.141592653589793;
> >                u = 1.5cm;
> >
> >                vardef graph_of_function (suffix f) (expr xmin, xmax,
> xsep) =
> >                   for x = xmin step xsep until xmax: (x, f(x)) .. endfor
> (xmax, f(xmax))
> >                enddef ;
> >
> >                vardef vline (suffix f, g) (expr x) = (x, min(f(x),
> g(x))) -- (x, max(f(x),g(x))) enddef;
> >
> >                vardef area_between_functions (suffix f, g)(expr a, b,
> xsep) =
> >                   buildcycle(graph_of_function(f, a, b, xsep), vline(f,
> g, b),
> >                   reverse graph_of_function(g, a, b, xsep), reverse
> vline(f, g, a))
> >                enddef;
> >
> >                vardef xaxis (expr xmin, xmax) = (xmin, 0) -- (xmax, 0)
> enddef ;
> >                vardef yaxis (expr ymin, ymax) = (0, ymin) -- (0, ymax)
> enddef ;
> >
> >
> >                xmin:=-pi/2; xmax := 3*pi/2;
> >                ymin := -1.5; ymax := 5;
> >
> >
> >                vardef f(expr x)= exp(-x)*(-cos(x)+sin(x)+1) enddef;
> >                vardef g(expr x)=-exp(-x)*cos(x) enddef;
> >                path C_f, C_g;
> >                C_f = graph_of_function(f,xmin, xmax, .1);
> >                C_g = graph_of_function(g, xmin, xmax, .1);
> >
> >                a := xpart(C_f intersectionpoint C_g);
> >                b := xpart(reverse C_f intersectionpoint reverse C_g);
> >
> >                fill (area_between_functions(f, g, a, b, 0.1)) scaled u
> withcolor 0.4[white, blue];
> >                draw C_f scaled u withcolor blue;
> >                draw C_g scaled u withcolor blue;
> >
> >
> >            \stopMPcode
> >
> ___________________________________________________________________________________
> > If your question is of interest to others as well, please add an entry
> to the Wiki!
> >
> > maillist : ntg-context@ntg.nl /
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> > webpage  : https://www.pragma-ade.nl / https://context.aanhet.net
> (mirror)
> > archive  : https://github.com/contextgarden/context
> > wiki     : https://wiki.contextgarden.net
> >
> ___________________________________________________________________________________
>
> —
> Taco Hoekwater              E: taco@bittext.nl
> genderfluid (all pronouns)
>
>
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive  : https://github.com/contextgarden/context
> wiki     : https://wiki.contextgarden.net
>
> ___________________________________________________________________________________
>

[-- Attachment #1.2: Type: text/html, Size: 7683 bytes --]

[-- Attachment #2: Type: text/plain, Size: 511 bytes --]

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

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2024-04-25 14:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-25 10:27 [NTG-context] " Fabrice Couvreur
2024-04-25 11:31 ` [NTG-context] " Taco Hoekwater
2024-04-25 14:08   ` Fabrice Couvreur [this message]
2024-04-25 14:31     ` Hans Hagen
2024-04-25 14:32     ` Taco Hoekwater
2024-04-25 14:55       ` Fabrice Couvreur
2024-04-25 21:12         ` Fabrice Couvreur
2024-04-26  7:20           ` Taco Hoekwater
2024-04-26  8:32             ` Aditya Mahajan
2024-04-26 10:22               ` Fabrice Couvreur

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='CACyK-epSvuDuavd3=K4UOT4Ukzt7jDGFg49MdPvrMm2Rj+JHaQ@mail.gmail.com' \
    --to=fabrice1.couvreur@gmail.com \
    --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).