scribble: how to put a bar above text?

38 views
Skip to first unread message

Jos Koot

unread,
Jun 16, 2020, 8:41:08 AM6/16/20
to us...@racket-lang.org

 

Hi,

Using scribble when writing a text containing Boolean expressions it would be nice to write ‘not(A+B)’ as ‘A+B’ with a bar above it. An expression like not(not(A)+not(B)) would need bars above the A and the B as well above the whole. Is this possible? I have found no solution in the scribble docs. I have looked into some HTML tutorials too, but did not find what I want. I am an ignorant with respect to HTML. And even when I would know how to do it in HTML, I also would need to know how to transfer the tool to scribble.

Thanks, Jos

Stephen De Gabrielle

unread,
Jun 16, 2020, 1:02:39 PM6/16/20
to Jos Koot, us...@racket-lang.org
Hi Jos

MathML support via the <math> tag is not good. 

I suspect the best option is to use Mathjax https://www.mathjax.org/#gettingstarted
 
I think you use `head-extra`[1] to add the required script tags[2] to your file. (not done this myself though so I'm not sure how)
 

[2]
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>

Jos Koot

unread,
Jun 16, 2020, 1:39:47 PM6/16/20
to Stephen De Gabrielle, us...@racket-lang.org

Hi,

Thanks for your prompt reply.

I’ll first look into Mathjax. It’s on github, so I suppose I can download it without charges.

Using head-extra seems straight forward, but I never used it before. I’ll see what happens.

I hope it works with the scribble HTML button in DrRacket, for it seems I do not have the required software to use the scribble PDF button. (I tried to download the required software, but it did not work. May be windows 10 poses a problem (well, it always does). It would be nice to have Unix as a subsystem within windows, but I don’t know whether or not that is possible.)

Thanks again, Jos

Kieron Hardy

unread,
Jun 16, 2020, 3:22:45 PM6/16/20
to Jos Koot, Stephen De Gabrielle, us...@racket-lang.org
FYI: As of Windows 10, you can install a full Linux distro in/on Windows. Here are the instructions:

--
You received this message because you are subscribed to the Google Groups "Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to racket-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/5ee903dd.1c69fb81.14578.f52a%40mx.google.com.

Ryan Kramer

unread,
Jun 16, 2020, 6:40:59 PM6/16/20
to Racket Users
Something things in scribble have a `#:style` argument. And most things in scribble can be contained inside a `nested` or `elem`, to which you could apply your custom #:style. You can use this as a hook to a custom CSS file, where you could maybe use "text-decoration: overline;" if that looks good to you. (Although if you anticipate needing more math typesetting capabilities, HTML+CSS will probably fail you. Mathjax sounds good.)

Basically, if you can hand-write HTML that looks good to you, you can probably get Scribble to do what you want. The relevant reading, I believe, is "styles" and `make-css-addition`, starting here: https://docs.racket-lang.org/scribble/config.html

Or, if you want to see a real example, I just did one: https://docs.racket-lang.org/plisqin/Refactoring_Recipes.html This uses a custom "PGreen" CSS class. You might be able to see how it all gets wired up by looking at these files: https://github.com/default-kramer/plisqin/search?q=PGreen&unscoped_q=PGreen

Hope this helps! But there no way to explain this with a little 10-line example, unfortunately.

Ryan Kramer

unread,
Jun 16, 2020, 6:52:39 PM6/16/20
to Racket Users
Oh my gosh, I almost forgot about Unicode tricks! (I wish I knew more about Unicode). Here is a macron: ā. And it seems there's a lot more you can do: https://qualityandinnovation.com/2014/11/22/typing-x-bar-y-bar-p-hat-q-hat-and-all-that/

These will work just fine inside a Racket source file.

On Tuesday, June 16, 2020 at 7:41:08 AM UTC-5, jos.koot wrote:

Jos Koot

unread,
Jun 17, 2020, 7:27:08 AM6/17/20
to Stephen De Gabrielle, Ryan Kramer, K H, us...@racket-lang.org

 

Thanks to all of you for your help.

I have tried some of your suggestions.

They are promising.

Meanwhile I have found out that I can do the following:

  • Create an equation in Word
  • Save it as a picture
  • Convert it to gif
  • Insert it with @image

Nevertheless I’ll look further into your suggestions.

Thanks, Jos

Reply all
Reply to author
Forward
0 new messages