diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2017-07-06 00:19:54 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2017-07-06 00:19:54 +0000 |
commit | 8bfd46f38d1b15589e5ffa8b44915557a3030385 (patch) | |
tree | 02789eb4144757c270da344ddd007d37cb15d92a /eqn_term.c | |
parent | e0015d9facf740a96124938363ba25c3b6c09af8 (diff) | |
download | mandoc-8bfd46f38d1b15589e5ffa8b44915557a3030385.tar.gz |
Fix operator precedence according to Brian W. Kernighan and Lorinda
L. Cherry, "Typesetting Mathematics - User's Guide (Second Edition)",
August 15, 1978, paragraph 23; swarm of bugs pointed out by bentley@.
Diffstat (limited to 'eqn_term.c')
-rw-r--r-- | eqn_term.c | 17 |
1 files changed, 8 insertions, 9 deletions
@@ -113,15 +113,6 @@ eqn_box(struct termp *p, const struct eqn_box *bp) if (bp->font != EQNFONT_NONE) term_fontpop(p); - if ((bp->type == EQN_LIST && bp->expectargs > 1) || - (bp->type == EQN_PILE && (bp->prev || bp->next)) || - (bp->parent != NULL && bp->parent->pos == EQNPOS_SQRT)) { - p->flags |= TERMP_NOSPACE; - term_word(p, bp->right != NULL ? bp->right : ")"); - if (bp->parent->type == EQN_SUBEXPR && bp->next != NULL) - p->flags |= TERMP_NOSPACE; - } - if (bp->top != NULL) { p->flags |= TERMP_NOSPACE; term_word(p, bp->top); @@ -130,4 +121,12 @@ eqn_box(struct termp *p, const struct eqn_box *bp) p->flags |= TERMP_NOSPACE; term_word(p, "_"); } + if ((bp->type == EQN_LIST && bp->expectargs > 1) || + (bp->type == EQN_PILE && (bp->prev || bp->next)) || + (bp->parent != NULL && bp->parent->pos == EQNPOS_SQRT)) { + p->flags |= TERMP_NOSPACE; + term_word(p, bp->right != NULL ? bp->right : ")"); + if (bp->parent->type == EQN_SUBEXPR && bp->next != NULL) + p->flags |= TERMP_NOSPACE; + } } |