Giter Site home page Giter Site logo

Comments (5)

jgm avatar jgm commented on July 28, 2024

I agree on all these points. Transferring this to texmath, which actually does the conversion.

from texmath.

jgm avatar jgm commented on July 28, 2024

One issue should perhaps be addressed in the tex reader:

% texmath -t native         
-1
[ ESymbol Bin "\8722" , ENumber "1" ]

Ideally this would not be parsed as a symbol in category Bin (binary operator). But this would require a bit more sophistication than we currently have in the parser.

For the other issue we have

% texmath -t native         
2 + (2 + 3)
[ ENumber "2"
, ESymbol Bin "+"
, EDelimited
    "("
    ")"
    [ Right (ENumber "2")
    , Right (ESymbol Bin "+")
    , Right (ENumber "3")
    ]
]

which is fine, but something is going on in the pandoc writer, which adds the spacing around the binary operator in one context but not the other:

% texmath -t pandoc 
2+(2+3)
[ Str "2"
, Str "\8197"
, Str "+"
, Str "\8197"
, Str "("
, Str "2"
, Str "+"
, Str "3"
, Str ")"
]

from texmath.

jgm avatar jgm commented on July 28, 2024

Pushed a change that fixes the second issue. Not yet the first.

from texmath.

jgm avatar jgm commented on July 28, 2024

Looks like we already have code in the TeX reader to change some Bins to Ops. This code is too simple; we need to look at the atom before the symbol as well as the one after it.

from texmath.

jgm avatar jgm commented on July 28, 2024

https://tex.stackexchange.com/questions/392081/how-does-tex-figure-out-whether-a-should-be-typeset-as-unary-or-binary

Texbook says:

  1. If the current item is a Bin atom, and if this was the first atom
    in the list, or if the most recent previous atom was Bin, Op, Rel, Open,
    or Punct, change the current Bin to Ord and continue with Rule 14.
    Otherwise continue with Rule 17.

  2. If the current item is a Rel or Close or Punct atom, and if the most
    recent previous atom was Bin, change that previous Bin to Ord. Continue with Rule 17.

from texmath.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.