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 <[email protected]> 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 <[email protected]>
> 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 : [email protected] /
> 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: [email protected]
> genderfluid (all pronouns)
>
>
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : [email protected] /
> 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
>
> ___________________________________________________________________________________
>
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : [email protected] /
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
___________________________________________________________________________________