summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--man.c2
-rw-r--r--man_term.c2
-rw-r--r--mdoc.c2
-rw-r--r--mdoc_term.c2
-rw-r--r--roff.c14
5 files changed, 11 insertions, 11 deletions
diff --git a/man.c b/man.c
index a233f01e..ca4d0973 100644
--- a/man.c
+++ b/man.c
@@ -345,6 +345,8 @@ man_addeqn(struct man *man, const struct eqn *ep)
n = man_node_alloc(man, ep->ln, ep->pos, MAN_EQN, MAN_MAX);
n->eqn = ep;
+ if (ep->ln > man->last->line)
+ n->flags |= MAN_LINE;
if ( ! man_node_append(man, n))
return(0);
diff --git a/man_term.c b/man_term.c
index 17753c62..9329fbba 100644
--- a/man_term.c
+++ b/man_term.c
@@ -987,6 +987,8 @@ print_man_node(DECL_ARGS)
goto out;
case MAN_EQN:
+ if ( ! (n->flags & MAN_LINE))
+ p->flags |= TERMP_NOSPACE;
term_eqn(p, n->eqn);
return;
case MAN_TBL:
diff --git a/mdoc.c b/mdoc.c
index c05834ae..cdaff456 100644
--- a/mdoc.c
+++ b/mdoc.c
@@ -205,6 +205,8 @@ mdoc_addeqn(struct mdoc *mdoc, const struct eqn *ep)
n = node_alloc(mdoc, ep->ln, ep->pos, MDOC_MAX, MDOC_EQN);
n->eqn = ep;
+ if (ep->ln > mdoc->last->line)
+ n->flags |= MDOC_LINE;
if ( ! node_append(mdoc, n))
return(0);
diff --git a/mdoc_term.c b/mdoc_term.c
index a7266724..2ca44541 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -344,6 +344,8 @@ print_mdoc_node(DECL_ARGS)
p->flags |= TERMP_NOSPACE;
break;
case MDOC_EQN:
+ if ( ! (n->flags & MDOC_LINE))
+ p->flags |= TERMP_NOSPACE;
term_eqn(p, n->eqn);
break;
case MDOC_TBL:
diff --git a/roff.c b/roff.c
index c68c88ff..d5bc54e2 100644
--- a/roff.c
+++ b/roff.c
@@ -1872,19 +1872,11 @@ roff_eqndelim(struct roff *r, char **bufp, size_t *szp, int pos)
if (cp2 == NULL)
return(ROFF_CONT);
- /* Found a delimiter; get rid of surrounding blanks. */
-
- cp1 = cp2++;
- while (cp2[0] == ' ')
- cp2++;
- while (cp1[-1] == ' ')
- cp1--;
- *cp1 = '\0';
-
/* Replace the delimiter with an equation macro. */
- *szp = mandoc_asprintf(&cp1, "%s\n.E%s%s", *bufp,
- r->eqn == NULL ? "Q\n" : "N\n\\&", cp2) + 1;
+ *cp2++ = '\0';
+ *szp = mandoc_asprintf(&cp1, "%s%s%s", *bufp,
+ r->eqn == NULL ? "\\&\n.EQ\n" : "\n.EN\n\\&", cp2) + 1;
free(*bufp);
*bufp = cp1;