simtex-dev / engine

Convert your files into LaTeX/pdf with one command!
GNU General Public License v3.0
20 stars 0 forks source link

automatically replace basic unicode math symbols or ascii chars that represent math symbols with their respective latex command #12

Open iaacornus opened 2 years ago

iaacornus commented 2 years ago

there are some commonly used math symbols that can be processed easily for convenience since having to type the latex command for it is simply time consuming and hard to do especially if the prof speaks very fast. Some examples include:

--> to \longrightarrow a/b to \frac{a}{b} <-- to \longleftarrow

And some being able to replace unicode encoded math symbols would also be nice such as:

π to \pi ε to varepsilon

iaacornus commented 2 years ago

commit d56336fa9f0edc24d78b015dc305748d742b5fa7 is an experimental commit. In config file, starting at line 100, a third dictionary was introduced which holds a key-value pair of some symbols and their commands that the user may want to be replaced, some can be included and removed easily, by default it contains 31 keys and values:

{
    "-->": "\\longrightarrow",
    "<--": "\\longleftarrow",
    "===": "\\equiv",
    "~==": "\\approxeq",
    "<<": "\\ll",
    "<=": "\\leq",
    ">=": "\\geq",
    ".=": "\\doteq",
    "~~": "\\approx",
    "~=": "\\simeq",
    "~~=": "\\cong",
    ">>": "\\gg",
    "+-": "\\pm",
    "./.": "\\div",
    "-+": "\\mp",
    "|>": "\\triangleleft",
    "<|": "\\triangleright",
    "<-": "\\leftarrow",
    "->": "\\rightarrow",
    "<->": "\\leftrightarrow",
    "<==": "\\Leftarrow",
    "==>": "\\Rightarrow",
    "<=>": "\\Leftrightarrow",
    "|->": "\\mapsto",
    "===>": "\\Longrightarrow",
    "<===": "\\Longleftarrow",
    "<===>": "\\Longleftrightarrow",
    "~~>": "\\leadsto",
    "...": "\\dots",
    ":::": "\\vdots",
    "^...": "\\cdots",
    "^.": "\\cdots"
}

This feature can also be turned off by setting the "REPLACE" parameter in config to false, while currently inconvenient, there is a commandline argument that is underwork.