Skip to content

Comment on Author interactive math equations and diagrams online using LATEX and PSTricks

Comments

LaTeX newbie here:

Can someone explain how this works (from a user standpoint)? How does userline below map mouse pointer coordinates to the line? It seems (2,2) is what is getting substituted with the (x,y) from the mouse (after adjusting for the origin).

\begin{pspicture}(-2,-2)(2,2)

\psframe(-2,-2)(2,2)

\userline[linewidth=1.5 pt]{->}(0,0)(2,2)

\end{pspicture}

I am totally lost on the following example. The lightblue line below behaves the same way as the line in the above example. But the code below is quite different, including sin and -y.

\begin{pspicture}(-2,-2)(2,2)

\psframe(-2,-2)(2,2)

\userline[linewidth=2pt,linecolor=green]{->}(0,0)(2,2){-x}{-y}

\userline[linewidth=2pt,linecolor=red]{->}(0,0)(2,2){0}{y}

\userline[linewidth=2pt,linecolor=purple]{->}(0,0)(2,2){-x}{cos(y)}

\userline[linewidth=2pt,linecolor=lightblue]{->}(0,0)(2,2)(sin(x)}{-y}

\end{pspicture}

I am fairly sure that's not the source that produces the interaction. Apart from the incorrect expression, the mismatched brackets in (sin(x)} indicate that.

Yes, I noted the mismatch too. So what is producing the interaction then (and how does it know what changes with the interaction). It must have something to do with "user" in "userline", that is, "userline" is some primitive that includes interactions. How exactly, I cannot find.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.