Skip to content

Can we use tex in labels / titles ? #58

Closed

Description

@BowenFu

Something like
(plot (function sin (- pi) pi #:label "y = \sin(x^2)"))?

untitled

Activity

  1. soegaard commented on Feb 15, 2020

    @soegaard
    Member
  2. alex-hhh commented on Jun 25, 2020

    @alex-hhh
    SponsorCollaborator

    You can use unicode characters for some math notation. this is not as flexible as using TeX, but can be useful in a lot of cases:

    #lang racket
    (require plot)
    (plot (function sin (- pi) pi #:label "y = sin(x²)"))

    Produces:

    i58

  3. alex-hhh commented on Jun 25, 2020

    @alex-hhh
    SponsorCollaborator

    As for the implementation, the #label argument to the plot functions can be extended to accept a pict argument in addition to a string. There is already a point-pict function which can display pict objects on a plot.

    This way, the latex-pict package suggested above could be used to render the labels.

  4. self-assigned this
    on Aug 7, 2020
  5. alex-hhh commented on Aug 28, 2020

    @alex-hhh
    SponsorCollaborator

    The plot package has been extended to support pictures for legend entries, names for axes and plot titles. This allows formatting these elements using pretty much anything that can be rendered. In particular it would allow the use of latex-pict to render LaTeX formulas.

    As I noted previously, you can also use Unicode for the strings, which allows some limited mathematical notation. E.g. you can use x² directly.

    This functionality will be available in the next Racket version (7.9).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions