Implicit Plot with tangent line

21 views
Skip to first unread message

Nick Bennett

unread,
Jul 13, 2026, 8:08:57 AMJul 13
to PreTeXt support
Hey Everyone, 

I am trying to draw an implicit plot with a tangent line through (3,4). I am new to PreFigure and this is what I came up with, but the code does not complile. Any help would be appreciated.


<diagram dimensions="(300,300)" margins="5">
<definition>f(x,y) = x^3+y^3-6*x*y</definition>

<!-- point of tangency -->
<definition>x0 = 3</definition>
<definition>y0 = 4</definition>
<definition>p0 = (x0, y0)</definition>

<!-- gradient of f, and a direction perpendicular to it -->
<definition>grad_f(x,y) = grad(f, (x,y))</definition>
<definition>g = grad_f(x0, y0)</definition>
<definition>dir = (-g[1], g[0])</definition>
<definition>p1 = p0 + dir</definition>

<coordinates bbox="[-5,-5,5,5]">
<grid-axes />
<implicit-curve function="f" k="f(x0,y0)" stroke="blue" />
<line endpoints="(p0,p1)" infinite="yes" stroke="red"/>
<point p="p0" size="6" fill="red"/>
</coordinates>
</diagram>

David Austin

unread,
Jul 13, 2026, 9:37:14 AMJul 13
to pretext...@googlegroups.com
Hi Nick,

That compiles for me (see below), but there seems to be a problem viewing it in the playground.  I'll investigate what's going on there.

Or are you having a problem embedding it in a PreTeXt document?  If so, we'll need to see the rest of the PreTeXt source.

David


image.png


--
You received this message because you are subscribed to the Google Groups "PreTeXt support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pretext-suppo...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pretext-support/7a246a15-2561-4226-9f3a-e642f897a2cdn%40googlegroups.com.

David Austin

unread,
Jul 13, 2026, 1:15:58 PMJul 13
to pretext...@googlegroups.com
Hi Nick,

The XML comments are what seem to be causing the problems with this PreFigure source in the playground.  I removed the comments (see below), restarted the playground, and things worked well.  Kudos for commenting your source, but the playground is not happy about it.

This is just an issue in the playground as comments are allowed in PreFigure source and won't cause a problem in other environments.  I'll have a look at this later, but I'm also in the middle of a couple of other things.

Thanks for the report.

David

<diagram dimensions="(300,300)" margins="5">
  <definition>f(x,y) = x^3+y^3-6*x*y</definition>

  <definition>x0 = 3</definition>
  <definition>y0 = 4</definition>
  <definition>p0 = (x0, y0)</definition>

  <definition>grad_f(x,y) = grad(f, (x,y))</definition>
  <definition>g = grad_f(x0, y0)</definition>
  <definition>dir = (-g[1], g[0])</definition>
  <definition>p1 = p0 + dir</definition>

  <coordinates bbox="[-5,-5,5,5]">
    <grid-axes />
    <implicit-curve function="f" k="f(x0,y0)" stroke="blue" />
    <line endpoints="(p0,p1)" infinite="yes" stroke="red"/>
    <point p="p0" size="6" fill="red"/>
  </coordinates>
</diagram>

David Austin

unread,
Jul 16, 2026, 2:40:18 PM (13 days ago) Jul 16
to pretext...@googlegroups.com
Thanks to Jason Siefken, this problem is fixed in the playground now.
Reply all
Reply to author
Forward
0 new messages