mbutterick / pollen-users

please use https://forums.matthewbutterick.com/c/typesetting/ instead
https://forums.matthewbutterick.com/c/typesetting/
52 stars 0 forks source link

(require pollen-tfl) fails #81

Closed primer-1 closed 3 years ago

primer-1 commented 3 years ago

Hello,

I'm trying to use pollen-tfl in order to take advantage of some of its helper functions like (numbered-list).

Based on the header at [https://docs.racket-lang.org/pollen-tfl/index.html]() I thought that I need to do a (require pollen-tfl) at the top of my "pollen.rkt" file. However, that fails with an error message essentially saying that the file "main.rkt" does not exist, which I verified is true. But all I did was install the pollen-tfl package under DrRacket, and it seemed to be OK.

What do I need to do to make this work?

mbutterick commented 3 years ago

I suggest that you just copy the functions you want and paste them into your own pollen.rkt. pollen-tfl was never intended to be an importable module like txexpr or hyphenate.

primer-1 commented 3 years ago

Cool, that's pretty much what I did as a workaround. But the fact that the documentation page prominently says (require pollen-tfl) threw me off. I'd suggest getting rid of that as it's misleading and confusing.

primer-1 commented 3 years ago

The other part that's confusing is that the "pollen.rkt" page says "The result is that if you require this file normally, you’ll get the usual functions and values; but if you run it with Scribble, it turns into the documentation you see here."

Based on what you're saying, it sounds like there's no real way to "require this file normally".

mbutterick commented 3 years ago

OK, I have adjusted it so you can do (require pollen-tfl). I strill don’t recommend this, however 😉

primer-1 commented 3 years ago

Just out of curiosity, why not? My original intention was to find some good conveniently loadable "helper routines" like (numbered-list) that really add a lot of value. It sounds like now we have that, kinda sorta, but it's not recommended to use them.

Perhaps some sort of additional "helpers" module in the standard pollen distribution would be a better place for this kind of thing? I'm not trying to make unnecessary work for you. Just a thought.

Thanks for Pollen!

sorawee commented 3 years ago

I can only guess, but pollen-tfl contains stuff beyond the utilities that you want, like the actual book content. So treating it as a library is pretty weird.

The result is that if you require this file normally, you’ll get the usual functions and values; but if you run it with Scribble, it turns into the documentation you see here.

I can only guess again, but it seems that the intent of @mbutterick is to explain that if you copy pollen.rkt to your own project, then you can require the pollen.rkt in your project. However, he doesn't intend that anyone will require it from his project.

sorawee commented 3 years ago

Just out of curiosity, why not? My original intention was to find some good conveniently loadable "helper routines" like (numbered-list) that really add a lot of value. It sounds like now we have that, kinda sorta, but it's not recommended to use them.

You can ask @mbutterick for a permission to copy it, and create a proper library and publish the library to https://pkg.racket-lang.org/, so that people can use it. However, as it exists right now, it's not meant to be use as a library.

mbutterick commented 3 years ago

Just out of curiosity, why not?

Because you can’t get very far with Pollen unless you learn how tag functions work. And the best way to do this is write your own. The purpose of pollen-tfl is to explain the tag functions in one project. For instance, The Local Yarn (by @otherjoel) shows another approach.

primer-1 commented 3 years ago

Cool, all of that makes sense. Thanks for the pointer to The Local Yarn.