# DJ Chase’s Blog

## Re: Subscripts And Superscripts In Gemtext

From dj-chase.com

Math formulas are especially challenging, not only because they can have so many symbols (such as sigma 'Σ'), but those symbols must be rendered in a certain layout (e.g. Σ used to sum a series has the variable and its starting value, as well as the value its going to, arranged in 2 different rows to the right of the Σ).

As a further example, sigma notation only behaves that way when it’s inline. ‘Block-level’ sigma notation places one row above the sigma and the other below, and makes the sigma like twice as large as the rest of the text. This holds true for a lot of other operations as well, such as integrals (∫), sequential products (∏), and sometimes unions (∪). Limits also follow the same rules, except they’re not extra-large because they don’t have their own symbol.

In fact, text layout of formulas and symbols is such a complicate domain that Donald Knuth literally created TeX, an entire digital typesetting system, while he was writing “The Art of Computer Programming.”

Given all this complexity, I didn't even try to represent math formulas in gemtext.

This is what made me reply to this post. You see, I quite like math, so I envision writing some here at times. So as part of working on the back-end, I needed to think about how to typeset math in Gemtext, and I think I’ve come up with a workable solution.

Basically, we can use preformatted blocks to approximate block-level mathematics and put plaintext math using unicode’s extensive set of math symbols in the alt-text as a accessible fallback.

### Examples

For these examples, I have written the alt-text in italics.

Σᵢ₌₃⁷ i²

`````` ₇
Σ 𝑖²
ᶤ⁼³
``````

∫ _(π/6) ^π sin θ dθ = [−cos θ] _(π/6) ^π = 1 + (√3)/2

`````` π
⌠               ⎡         ⎤ π
⌡  sin 𝜃 d𝜃  =  ⎢ − cos 𝜃 ⎥
π/6              ⎣         ⎦ π/6

√3
=  1  +  ──
2
``````

Dₓ cos(xy) = Dₓ (1 + sin y)

``````     Dₓ cos(𝑥𝑦)  =  Dₓ (1 + sin 𝑦)
``````

−sin(xy)yy' = y' cos y

``````    −sin(𝑥𝑦)𝑦𝑦′  =  𝑦′ cos 𝑦
``````

– [sin(xy)yy'] / (y' cos y) = 1

``````     sin(𝑥𝑦)𝑦𝑦′
− ──────────  =  1
𝑦′ cos 𝑦
``````

– [sin(xy)y / cos y] (y'/y') = 1

``````   sin(𝑥𝑦)𝑦  𝑦′
−  ────────  ──  =  1
cos 𝑦    𝑦′
``````

y' (1 × 1¹) = − cos y / [sin(xy)y]

``````                       cos 𝑦
𝑦′ (1 × 1¹)  =  - ────────
sin(𝑥𝑦)𝑦
``````

y' = − cos y / [sin(xy)y]

``````                       cos 𝑦
𝑦′  =  - ────────
sin(𝑥𝑦)𝑦
``````

## Equally Serving Gemini & The Web

I’ll be writing a series of posts detailing issues I have while setting up my server and site to serve Gemini and HTTPS without sacrificing the quality of either one. It will be fairly technical, but I’ll try to make it somewhat understandable for nontechnical* people without boring hackers.

For those unaware, Gemini is a newish internet protocol that aims to be simpler, more accessible, and less obtrusive than the web. As such, it lacks many of the features and semantics of HTTPS & HTML (the web’s protocol and document format, respectively), which makes it challenging to serve the same content without sacrificing the user’s experience on at least one protocol.

## Using mutt & cron To Text Yourself The Weather

I have a flip phone (it’s much less distracting than a smartphone), so I cannot use an app or a browser to check the weather when getting dressed in the morning. I tried NOAA’s dial-a-forecast, but the number for my state is out of service.

So, I decided to make a script that texts me the weather. This was surprisingly simple. It broke down into three steps:

1. Get the weather
2. Text it to myself
3. Automate that

This post assumes that you have email working on a system-level. Since setting that up is out-of-scope for this post, you can either do it yourself or get an account on a pubnix.