From 5c2a309a34544b8ce4a9f64845f876bc1bc560f3 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Tue, 2 Oct 2018 12:18:33 +0000 Subject: [PATCH] Render the eqn(7) "sqrt" function as U+221A in UTF-8 output. This also agrees with what groff does. Suggested by an attendee of EuroBSDCon 2018 in Bucuresti. Written on the plane Bucuresti-Frankfurt returning from EuroBSDCon. --- TODO | 7 ++----- eqn_term.c | 4 ++-- regress/eqn/over/precedence.out_ascii | 4 ++-- regress/eqn/unary/sqrt.out_ascii | 4 ++-- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/TODO b/TODO index d0421733..25f8f10f 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,6 @@ ************************************************************************ * Official mandoc TODO. -* $Id: TODO,v 1.270 2018/09/23 05:34:58 schwarze Exp $ +* $Id: TODO,v 1.271 2018/10/02 12:18:33 schwarze Exp $ ************************************************************************ Many issues are annotated for difficulty as follows: @@ -209,9 +209,6 @@ are mere guesses, and some may be wrong. --- missing eqn features ----------------------------------------------- -- Use a Unicode character for sqrt() in eqn output? - Suggested by an attendee during EuroBSDCon 2018. - - In a matrix, break the output line after each matrix line. Found in the discussion at CDBUG 2015. Suggested by Avi Weinstock. @@ -396,7 +393,7 @@ are mere guesses, and some may be wrong. - table of content at the top of HTML (and perhaps ps/pdf) pages only if there are at least two (or three?) non-standard sections only if the new option -O toc is given - suggested by an attendee during EuroBSDCon 2018 + suggested by Adam Kalisz during EuroBSDCon 2018 - support -O man with two arguments, typically using the first for a local tree (like the release pages on mandoc.bsd.lv) and the diff --git a/eqn_term.c b/eqn_term.c index 669c3c56..b1a438d9 100644 --- a/eqn_term.c +++ b/eqn_term.c @@ -1,4 +1,4 @@ -/* $Id: eqn_term.c,v 1.17 2017/08/23 21:56:20 schwarze Exp $ */ +/* $Id: eqn_term.c,v 1.18 2018/10/02 12:18:33 schwarze Exp $ */ /* * Copyright (c) 2011 Kristaps Dzonsons * Copyright (c) 2014, 2015, 2017 Ingo Schwarze @@ -106,7 +106,7 @@ eqn_box(struct termp *p, const struct eqn_box *bp) /* Special box types. */ if (bp->pos == EQNPOS_SQRT) { - term_word(p, "sqrt"); + term_word(p, "\\(sr"); if (bp->first != NULL) { p->flags |= TERMP_NOSPACE; eqn_box(p, bp->first); diff --git a/regress/eqn/over/precedence.out_ascii b/regress/eqn/over/precedence.out_ascii index 0dc9e747..2a7f61be 100644 --- a/regress/eqn/over/precedence.out_ascii +++ b/regress/eqn/over/precedence.out_ascii @@ -4,7 +4,7 @@ NNAAMMEE oovveerr--pprreecceeddeennccee - precedence of the fraction operator DDEESSCCRRIIPPTTIIOONN - initial text 1 + _x + (_x^2)/2 + (_x^3)/(2 * 3); _a^/_c~; aa/cc; sqrt(_a)/sqrt(_c) - final text + initial text 1 + _x + (_x^2)/2 + (_x^3)/(2 * 3); _a^/_c~; aa/cc; + (_a)/(_c) final text OpenBSD July 6, 2017 OpenBSD diff --git a/regress/eqn/unary/sqrt.out_ascii b/regress/eqn/unary/sqrt.out_ascii index 72b7047d..c6d19d20 100644 --- a/regress/eqn/unary/sqrt.out_ascii +++ b/regress/eqn/unary/sqrt.out_ascii @@ -4,7 +4,7 @@ NNAAMMEE uunnaarryy--ssqqrrtt - square root DDEESSCCRRIIPPTTIIOONN - initial text _r = sqrt(_x^2 + _y^2) + sqrt(_a + _b) + sqrt(_x^) + sqrt() + sqrt - final text + initial text _r = (_x^2 + _y^2) + (_a + _b) + (_x^) + + () + final text OpenBSD July 6, 2017 OpenBSD -- 2.47.1