Re: [tex4ht] unbalanced parentheses

2011-09-07 Thread William F Hammond
k...@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
   mn1/mn
   mo,/mo
   mn2/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



Re: [tex4ht] unbalanced parentheses

2011-09-06 Thread William F Hammond
I wrote:

 It's not the business of the typesetter to detect math errors, so it
 really shouldn't complain.  Unbalanced parentheses are not always an
 error, for sure.  Just a simple interval open at one end and closed at
 the other ... (1,2]

 Unbalanced containers are a serious obstacle for translating LaTeX or
 LaTeX-like math to presentation MathML.  So sane processing under a
 LaTeX profile for this purpose would enforce the use of things like,
 for your example, \left(1,2\right]

I should say a bit more about my viewpoint.  A mathematical expression
has a semantic tree structure that ideally should be reflected in markup
used to represent it.

A more complicated case is presented by an expression that is carried
to a new line in a display, say with the following under amsart:

\[ \begin{aligned}
  a =  (b \\
   +c)
\end{aligned}   \]

In this case there is incompatibility between the structure of the
mathematical expression tree and the markup tree.  (It could, however,
some day I suppose, be lamely modeled for markup using something like
the transparent content model of html5.)

Tex4ht will be happy with \left( .. \right. on row 1 and
\left. .. \right) on row 2, but that stretches mathematical semantics.

Another work-around is to enter '(' and ')' in the source in a way
that will cause the translator toward xml to deal with them as
unrelated operators -- again contrary to mathematical semantics, but I
don't know how to do that with tex4ht.

-- Bill




Re: [tex4ht] unbalanced parentheses

2011-09-06 Thread Karl Berry
  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.

Thanks,
k


[tex4ht] unbalanced parentheses

2011-08-31 Thread William F Hammond
Dear Friends,

A recent item at arxiv.org -- 1108.5305 -- fails to run through
tex4ht targeted for xhtml+mathml, i.e., mk4ht xhmlatex, because
it has nearly 40 instances in its source of unbalanced parentheses.

Since the source will run correctly through pdflatex, there is
a sense in which it may be considered correct as LaTeX.  On the
other hand, the unbalanced parentheses represent mathematical
errors (typographical in nature), and I think it unreasonable
to view it as correct LaTeX and I see no reason to find fault
with tex4ht on this account.

Nonetheless it is a dilemma in the context of translation from
LaTeX to xhtml+mathml or, for that matter, html5+mathml, if the
source is understood as correct LaTeX.

This document presents a good case-in-point to support my idea of
formalizing LaTeX profiles,
https://www.tug.org/members/TUGboat/tb31-2/tb98hammond.pdf or
http://www.albany.edu/~hammond/presentations/Tug2010/, where such
author errors can, for suitable profiles, be trapped on the author's
platform.

-- Bill