tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
* Rendering of math symbols in ASCII mode
@ 2017-06-19  0:04 Anthony J. Bentley
  2017-06-19 17:06 ` Ingo Schwarze
  0 siblings, 1 reply; 4+ messages in thread
From: Anthony J. Bentley @ 2017-06-19  0:04 UTC (permalink / raw)
  To: tech

Hi,

This beauty shows up in erf(3):

.Bd -filled -offset indent
.if n \{\
erf(x) = 2/sqrt(pi)*\|integral from 0 to x of exp(\-t*t) dt. \}
.if t \{\
erf\|(x) :=
(2/\(sr pi)\|\(is\d\s8\z0\s10\u\u\s8x\s10\d\|exp(\-t\u\s82\s10\d)\|dt. \}
.Ed

My first instinct was to replace it with eqn(7), a pleasant way to write
non-trivial equations:

.EQ
roman erf ( x ) = 2 over {sqrt pi} int sub 0 sup x e sup {- t sup 2} dt
.EN

This looks great in groff -Tpdf and mandoc -Thtml, and is serviceable
enough in mandoc -Tutf8. Unfortunately, in ASCII it looks like this:

    erf ( x ) = 2/(sqrt(n)) I_0^x e^(- t^2) dt

As per mandoc_char(7), the integral symbol is replaced with I and pi
is replaced with n. Awful!

While I'm inclined to think that attempting to render equations in pure
ASCII is somewhat futile, the human-readable nature of eqn(7) suggests
the possibility of simply displaying the symbol name for certain symbols
like Greek letters and integrals.

    erf ( x ) = 2/(sqrt(pi)) int_0^x e^(- t^2) dt

I think it compares favorably with the current rendering:

    erf(x) = 2/sqrt(pi)*integral from 0 to x of exp(-t*t) dt

This would make it practical to use eqn(7) in certain libm manuals,
which I think could be a nice improvement. Viewing the math-heavy libGL
manuals on man.openbsd.org is a real pleasure.

Thoughts?

-- 
Anthony J. Bentley
--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-06-20 16:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-19  0:04 Rendering of math symbols in ASCII mode Anthony J. Bentley
2017-06-19 17:06 ` Ingo Schwarze
2017-06-20  4:27   ` Anthony J. Bentley
2017-06-20 16:44     ` Ingo Schwarze

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).