# Scribble and plot/pict doesn't know about pi?

**URL:** <https://racket.discourse.group/t/scribble-and-plot-pict-doesnt-know-about-pi/3850>\
**Category:** Questions & Answers\
**Tags:** question, scribble, plot\
**Created:** [July 12, 2025, 2:17pm UTC](https://racket.discourse.group/t/scribble-and-plot-pict-doesnt-know-about-pi/3850 "2025-07-12T14:17:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ddrake](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/ddrake/32/2353_2.png) [@ddrake](https://racket.discourse.group/u/ddrake)\
**Post date:** [July 12, 2025, 2:17pm UTC](https://racket.discourse.group/t/scribble-and-plot-pict-doesnt-know-about-pi/3850/1 "2025-07-12T14:17:05Z")

</div>

I'm experimenting with Scribble and wanted to see about including function plots.

Something like this:

```scheme
#lang scribble/base
@(require scribble/manual)
@(require plot/pict)

@title{Plots in Scribble}

The sine function:

@(plot (function sin (- pi) pi #:label "y = sin(x)"))

```

gives me:

```scheme
scribble-plot-test.scrbl:9:24: pi: unbound identifier
  in: pi
  location...:
   scribble-plot-test.scrbl:9:24
  context...:
   /usr/share/racket/pkgs/scribble-lib/scribble/run.rkt:175:26: go
   .../private/map.rkt:40:19: loop
   .../racket/cmdline.rkt:191:51
   body of "/usr/share/racket/pkgs/scribble-lib/scribble/run.rkt"

```

In DrRacket, that works fine. It seems like the `pi` constant is defined in base Racket. I know I'm not using `#lang racket`, but I was expecting that to work.

I can of course define it, but it seems like I should be able to do import/require.

If I try to `(require math)`, I get:

```scheme
scribble-plot-test.scrbl:3:10: module: identifier already required
  at: ::
  in: math
  also provided by: scribble/manual

```

What should I do here?

---

<div class="post-metadata">

**Author:** ![LiberalArtist](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/liberalartist/32/151_2.png) [@LiberalArtist](https://racket.discourse.group/u/LiberalArtist)\
**Post date:** [July 12, 2025, 3:12pm UTC](https://racket.discourse.group/t/scribble-and-plot-pict-doesnt-know-about-pi/3850/2 "2025-07-12T15:12:46Z")

</div>

If you look at [the documentation for `pi`](https://docs.racket-lang.org/reference/generic-numbers.html#%28part._.Extra_.Constants_and_.Functions%29), you will see that it is “provided by the `racket/math` and `racket` libraries, but not `racket/base`”. (In addition to the note at the top of a section, you can find what libraries export a given binding by hovering over its name in the blue box or by looking at the search results page.)

Your example is using `#lang scribble/base`, which [is documented](https://docs.racket-lang.org/scribble/base.html) to extend `racket/base`, as opposed to `racket`, so it does not provide `pi`.

The simplest solution would be to add `(require racket/math)` (which is different from `math`!).

Also, it’s unusual to use `#lang scribble/base` together with `(require scribble/manual)`: `scribble/manual` [provides everything from](https://docs.racket-lang.org/scribble/manual.html) `scribble/base`, so typically you would just use `#lang scribble/manual`. (Strictly speaking, the one difference is that this would use the [manual rendering style](https://docs.racket-lang.org/scribble/manual-render-style.html), but that is generally an improvement.)

---

<div class="post-metadata">

**Author:** ![ddrake](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/ddrake/32/2353_2.png) [@ddrake](https://racket.discourse.group/u/ddrake)\
**Post date:** [July 12, 2025, 7:47pm UTC](https://racket.discourse.group/t/scribble-and-plot-pict-doesnt-know-about-pi/3850/3 "2025-07-12T19:47:16Z")

</div>

Thanks for the explanation -- I was basically cargo-culting my way through, trying random things. I have a better understanding of `require` and friends now.
