[tex4ht] unbalanced parentheses

William F Hammond hammond at csc.albany.edu
Wed Sep 7 16:32:04 CEST 2011


karl at freefriends.org (Karl Berry) writes:

>       http://www.albany.edu/~hammond/private/1108.5305.tex
>       http://www.albany.edu/~hammond/private/1108.5305.xhtml
>
> Thanks.  I will try to look.
>
>     for your example, \left(1,2\right]
>
> Well, \left...\right can change what the output looks like, not
> necessarily desirably.  But I take your point in general, certainly.

If this type of "change" is a concern, another approach, which
could provide a way forward for tex4ht --> mathml, would be
to put the mismatched balancers in their own groups, i.e.,

                  {(} 1,2 {]}

which could become (different from what it now becomes)

 <math>
  <mrow>
   <mrow>
    <mo>[</mo>
   </mrow>
   <mn>1</mn>
   <mo>,</mo>
   <mn>2</mn>
   <mrow>
    <mo>)</mo>
   </mrow>
  </mrow>
 </math>

with the idea that tex4ht should not look above current tree depth for
a matching balancer.  So if a balancer is solo at current depth, treat
it as an unpaired operator; otherwise, throw an error.

Gellmu presently has \bal{}, delimited by parentheses, \balbr,
delimited by braces, ... .  I intend to add an option for \bal where
explicit, not necessarily matched, left and right balancers can be
specified.  Aside from that its auto-matching code only comes in when
the user employs balancing characters as themselves, not when names
for them (e.g., \lpr and \rsb in this case) are used.

                                    -- Bill



More information about the tex4ht mailing list