{ "info": { "author": "Steve Kieffer", "author_email": "sk314159@runbox.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Topic :: Text Processing :: Markup :: LaTeX" ], "description": "# VerTeX: a prefilter for easier LaTeX\n\nDo you find anything cumbersome about TeX syntax? For example, \n\n| If instead of this... | you'd prefer to type this... |\n|:----------------------------|:-------------------------------|\n| a_0, a_1, \\ldots, a_{n-1} | a0, a1, ddd, an-1 |\n| \\alpha, \\beta, \\gamma, ... | alpha, beta, gamma, ... |\n| \\mathfrak{p} \\in \\mathbb{Z} | frp in bbZ |\n| n^\\mathrm{th} | n eth |\n| \\frac{2}{3} | frac 2 over 3; |\n| \\left\\| x \\right\\| | abs x; |\n| f^{(n)} | f supp n; |\n| f^{-1} | f inv |\n| \\sum_{n=0}^\\infty a_n | sum over n from 0 to infty; an |\n\n...then VerTeX may be for you!\n\nVerTeX is pronounced \"ver-tech,\" and stands for \"Verbal TeX,\" i.e. TeX\nin which what you type is often much closer to what you _say_ when you read\nmathematics aloud.\n\nI developed VerTeX while I was translating German mathematics into English,\nand I wanted to be able to type symbolic expressions as quickly as I could\ntype words.\n\nTherefore one of the goals of VerTeX is to help you keep your\nfingers over the home row. This leads to some verbal equivalents that may\nappeal to some, but not to others. Hey, suit yourself!\n\n# Usage\n\nThere are just two main functions that you'll make use of:\n`translate_snippet`, and `translate_document`.\n\nApply `translate_snippet` directly to math mode contents written in VerTeX,\nin order to translate them into plain TeX:\n\n >>> from vertex2tex import *\n >>> translate_snippet('bbQ(alp)')\n '\\\\mathbb{Q}(\\\\alpha)'\n\nWhen working on an entire document, use `translate_document`.\nThe default behavior of `translate_document` is to translate\nthe contents of math modes _only if they begin immediately with `@`_. (The `@` char is then omitted from the output.)\nThis allows you to be selective about where VerTeX is used, and where it isn't.\n\nFor example in the following application the text contains three occurrences of math mode, but only in the last do\nwe use VerTeX (we use the built-in keyword `times`), so only there do we begin the math mode with `@`. \n\n >>> text = 'Find integers $a, b, c$ such that the sum $a+b+c$ and the product $@a times b times c$ are equal.'\n >>> translate_document(text)\n 'Find integers $a, b, c$ such that the sum $a+b+c$ and the product $a\\\\times b\\\\times c$ are equal.'\n\nThis behavior can be controlled by using the `translate_document` function's keyword argument `keychar`.\nSetting `keychar=None` means that VerTeX translation will be applied in _all_ math modes.\nHowever, this requires some adaptation in our text.\nIf we try this with precisely the same text from the previous example, there will be two problems:\n\n >>> translate_document(text, keychar=None)\n 'Find integers $a, b, c$ such that the sum $a_{+ b+ c}$ and the product $@ a\\\\times b\\\\times c$ are equal.'\n\nThe first problem is that now VerTeX is being applied to `$a+b+c$`, which engages the auto-subscripting mechanism.\nWe must put spaces, as in `$a + b + c$` in order to avoid this.\nThe second problem is that now the character `@` at the beginning of the third math mode is no longer being interpreted\nas a keychar, and so simply passes through. Adapting for these two problems, we would have\n\n >>> text2 = 'Find integers $a, b, c$ such that the sum $a + b + c$ and the product $a times b times c$ are equal.'\n >>> translate_document(text2, keychar=None)\n 'Find integers $a, b, c$ such that the sum $a+ b+ c$ and the product $a\\\\times b\\\\times c$ are equal.'\n\nagain producing the desired result.\n\nAs a third possibility, you may even use a different \"key character\" instead of `@`, by setting\nthe keyword argument `keychar` equal to that character. However, this pattern is discouraged, for the sake of\ninteroperability. It is better that `@` be standard.\n\n\n\n# The VerTeX Language\n\n## Slash the Backslashes!\n\nWhen you are writing mathematics, how often do you want a Greek letter alpha, and how\noften do you want to multiply the variables a, l, p, h, and a together, in that\norder? Why then should `$alpha$` give you a sequence of Roman letters, while\nthe Greek letter requires a backslash?\n\nIn VerTeX, `$alpha$` yields the Greek letter, and if you really want the product of variables,\nsimply put spaces between the letters, as in `$a l p h a$`.\n\nIn general, VerTeX keywords are not strings of letters preceded by a backslash,\nbut simply strings of letters uninterrupted by whitespace.\nConceptually, the keywords in VerTeX may be divided into the following four\nkinds, according to the role they play in avoiding backslashes.\n\nTypes of VerTeX keywords:\n\n1. bsme\n2. built-in\n3. bracket word\n4. font prefix\n\nIf you want to see (and perhaps alter locally) the lists of keywords, just\nconsult the `config.py` module in the `vertex` package.\n\n### bsmes\n\n\"bsme\" stands for \"backslash me,\" and a bsme keyword is\none that is exactly the same as a keyword in TeX, except without the backslash.\nIt produces the exact same result as the corresponding TeX keyword.\nFor the list of all bsme keywords, consult the `config.py` module.\n\n### built-ins\n\nThe so-called \u201cbuilt-in\u201d keywords do not correspond to any existing TeX keywords.\nThey do not take any arguments, but simply translate directly into some\nstring of TeX, and their purpose is to in one way or another give an easier way\nto type certain commonly used TeX strings.\n\nIn particular, one of the goals of VerTeX is to give you the option to keep\nyour fingers over the home row while typing, and for this reason the built-in\nkeywords provide many alphabetical equivalents to TeX strings that ordinarily\ninvolve non-alphabetical characters. For example, `inv` (for \u201cinverse\u201d) produces\n`^{-1}`, and `squ` (for \u201csquared\u201d) produces `^2`.\n\nFor the list of all built-ins, consult the `config.py` module.\n\n#### Going Greek\n\nGreek letters are near and dear to our heart in mathematics. They should\nbe easy to type.\nIn VerTeX, _every_ Greek letter -- including the variants -- has a\n_three-letter name_. And yes, this even includes the letters whose names\nare ordinarily only two-letters long, like pi and mu!\n\nFor example, you may type `alp` for alpha, `lam` for lambda, or\n`Lam` for capital Lambda.\n\nYou may type `vep` for `varepsilon` (everybody's favorite epsilon),\nand `vph` for `varphi`.\n\nAs for pi, xi, mu, and nu, these letters have funny three-letter spellings\n(anyone for `pie`?) in order to get around the auto-subscripting mechanism\ndiscussed below.\n\nAs usual, consult `config.py` for the full lists.\n\nYou do **not** have to use these abbreviations if you don't want to.\nEvery Greek letter whose name is ordinarily _more_ than two letters long\nis also a `bsme` keyword, so just go right ahead and spell it out if you\nwant to, whether it's `alpha`, `lambda`, or `Omega`.\n\n### bracket words\n\nIn TeX there are many constructions in which a keyword takes arguments\nsurrounded by braces `{ }`. For example,\n\n \\frac{\\pi}{4}\n\nyields the sum of the Bhaskara-Leibniz Series. In VerTex, the same\nconstruction is achieved by\n\n frac pie over 4;\n\nIn this example, `frac`, `over`, and the final semicolon `;` serve as\n_bracket words_.\n\nIn general, when a construction takes arguments, then the arguments\nare to be surrounded by the appropriate bracket words. For the most part, the\nfinal bracket word will be a semicolon.\n\nThe list of all such constructions in VerTeX can be found in `config.py`,\nunder the `unarynodes`, `binarynodes`, `tertiarynodes`, and `rangenodes`\ndefinitions. It includes many popular constructions, such as\nsets, sequences, floors, ceilings, absolute values, \"mod\" expressions,\nLegendre symbols, binomial coefficients, sums, products, and more.\n\n### font (and decorator) prefixes\n\nTechnically font prefixes are not \u201ckeywords\u201d in and of themselves. They are\ntwo- or three-character prefixes which, when followed by a letter of the alphabet,\nproduce that letter in the appropriate font. The prefixes and the fonts that they\ncorrespond to can be found in `config.py`.\n\nFor example, instead of\n\n \\mathfrak{p} \\mathsf{M} \\mathbf{v} \\mathbb{Q} \\mathcal{O} \\mathscr{B}\n\nyou may type\n\n frp sfM bfv bbQ calO scrB\n\nto achieve the same thing.\n\nYou can also use prefixes to get things like hats and tildes. For example,\ninstead of `\\hat{x}` just type `hatx`.\n\n\n\n## Auto-Subscripts (and Superscripts)\n\nIn mathematics, subscripted variables are the coin of the realm, and therefore it\nought to be easy to type them. VerTeX makes it fast and easy to get subscripts\nand superscripts. For example,\n\n| Cumbersome TeX... | ...is easy in VerTeX |\n|:------------------------------------|:---------------------------|\n| `a_1, a_2, \\ldots, a_{n+1}` | `a1, a2, ddd, an+1` |\n| `x_{i_1}, x_{i_2}, \\ldots, x_{i_m}` | `xivv1, xivv2, ddd, xivvm` |\n| `a_{i j}^2` | `aijuu2` | \n\nThe _semiautomatic subscripting and superscripting_ (henceforth SSS) mechanism of\nVerTeX is very handy, and, as the examples in the table show, makes it\nmuch easier to type certain common kinds of subscripts and superscripts.\n\nWhile many subscript and superscript combinations can be achieved through\nSSS, some things are not possible. In such cases, you can use the `sub` and `sup`\nbracket words, or can even fall back on standard TeX syntax.\n\nThe complete description of the SSS process is a bit complex, but for most\ncommon purposes it is quite simple. Therefore before we give a detailed\nspecification of the process, we consider the main ideas.\n\nFirst we need some terminology. We all know what subscripts and superscripts\nare, but what do we call the letter they get attached to? Let's call it the \"base\".\n\n**In most cases, the process is simple**: VerTeX will take a word `w` and split it as\n`w = bs`, where `b` is the longest initial segment of `w` that matches as a letter\nname, and `s` is everything that remains. Then `b` will be the base, and `s`\nwill be the subscript.\n\nExamples (and one non-example):\n\n| VerTeX | TeX |\n|:-------|:-------------|\n| pi | p_i |\n| alphan | \\alpha_n |\n| bbZm | \\mathbb{Z}_m |\n| cn+1 | c_{n+1} |\n| ai,j | a_{i,j} |\n| zeta | \\zeta |\n\nThere are several things to note about these examples:\n\n1. It was so that `pi` could be available for automatic subscripting that we gave\nthe Greek letter pi the (admittedly somewhat silly) spelling `pie`. Writing `p_i`\nis a perhaps daily occurrence for anyone who works with prime numbers, and\nthis includes a lot of mathematicians.\n\n2. Letters with extended names, like `alpha`, and letters with a font prefix in\nfront of them, like `bbZ`, _will_ indeed be counted as initial letters.\n\n3. Commas, as well as plus and minus signs, are considered part of the word.\n\n4. What happened with `zeta`? Perhaps we were hoping this would translate\nto `z_\\eta`, but of course VerTeX instead matched the entire word zeta as the base.\nThere is a way to get around this, which we discuss below. Preview: You may type\n`zvveta` in order to get `z_\\eta`.\n\n#### The Details\n\nTo the VerTeX parser, a \"word\" consists of alphanumeric characters, as well\nas commas and the plus and minus symbols. It must begin with an alphabetical\ncharacter. (In other words a \u201cletter,\u201d but this means one of the ASCII letters in\nthe character class `[A-Za-z]`, and is not to be confused with all things\nthat may be considered \"letters\" in VerTeX, which includes, for example,\nGreek letters, and letters with font prefixes.)\n\nFor those familiar with regular expressions, this means that words\nare built on the character class\n\n [A-Za-z0-9+-,]\n\nThe last three symbols are included in the character class because they are\ncommon in subscripts.\n(**However**, this means that if you do not want to accidentally trigger a subscript,\nyou need to put whitespace on at least one side of these characters!)\n\nNow suppose that `w` is the next word that VerTeX has to process. If `w` fails\nto match as any kind of\nkeyword \u2013 bsme, built-in, bracket word, or font-prefix-letter combination -- then `w` is\nsubmitted to the SSS process.\n\nVerTeX first matches the longest possible letter name at the beginning of `w`,\nas discussed above. Let the word `w` consist of initial letter `b` followed by\nremainder `s`, that is, `w = bs`. Then `b` will be the base, and `s` will give one or\nmore subscripts and/or superscripts.\n\nIn the simplest case, `s` simply represents a subscript. It is possible however to\nswitch between subscripts and superscripts using the special character sequences\n`vv`, `uu`, and `UU`.\n\nA few examples illustrate all of the ways to use these control sequences:\n\n| VerTeX | TeX |\n|:---------|:----------|\n| auur | a^r |\n| aiuur | a_i^r |\n| auurvvk | a^{r_k} |\n| aivvj | a_{i_j} |\n| aivvjuur | a_{i^r_j} |\n| aivvjUUr | a_{i_j}^r |\n| zvveta | z_\\eta |\n\nThe rules are:\n\n* Sequence `vv` opens a deeper subscript. In TeX it is as though you typed `_{`.\n* Sequence `uu` closes a subscript and opens a superscript. In TeX it is as\n though you typed `}^{`.\n* Seuqnece `UU` closes _two_ subscripts and opens a superscript. In TeX it is as\n though you typed `}}^{`.\n* One special exception is that if `vv` is used at the very beginning of `s`,\n it merely keeps you at the first subscript level. Thus, `zvveta` provides a way\n to produce `z_\\eta`, while `zeta` simply gives `\\zeta`.\n\nAgain, use of these special control sequences may appeal to some, while to\nothers the above examples may just look like so much Icelandic\n(kinda does to me -- but then, I have no idea what Icelandic actually looks like).\nSuit yourself...which is the subject of the next section.\n\n\n## Use only what you want\n\nVerTeX is 99% transparent to ordinary TeX.\nThat means you can type (almost) any ordinary TeX you want, and it will pass\nthrough the VerTeX filter unaltered. So, use as many or as few of the features\nof VerTex as you wish.\n\n#### What are the gotchas?\n\nThe main gotchas are keywords and automatic subscripting; but the solution\nis always very simple: Add spaces!\n\nIf a sequence of characters has been matched as a VerTeX keyword but this\nis not what you wanted, just put one or more spaces between those characters.\n\nLikewise, if automatic subscripting is taking place when you don't want it,\nthe solution is the same: separate the characters with spaces.\n\n#### Safety net\n\nAs a \u201csafety net,\u201d any word whatsoever may be prefixed with a double\nbackslash `\\\\` in order to allow that word to pass through VerTeX unaltered.\nTo be precise, if there is any remainder `w` to the word, then this, minus the two\nbackslashes, is what will pass through. If just two backslashes alone are typed,\nthey will pass though unaltered (which is useful in TeX table environments).\nMeanwhile, any word beginning with a single backslash is passed through VerTeX\ncompletely unaltered, i.e. with the leading backslash still intact.\nIn summary:\n\n \\\\w --> w\n \\\\ --> \\\\\n \\w --> \\w\n\nwhere `w` is a word at least one character long.\n\nBut you probably won't need to use this anyway.\n\nEnjoy!\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/skieffer/VerTeX", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "vertex2tex", "package_url": "https://pypi.org/project/vertex2tex/", "platform": "", "project_url": "https://pypi.org/project/vertex2tex/", "project_urls": { "Homepage": "https://github.com/skieffer/VerTeX" }, "release_url": "https://pypi.org/project/vertex2tex/0.2.3/", "requires_dist": null, "requires_python": "", "summary": "VerTeX: a pre-filter for easier LaTeX", "version": "0.2.3" }, "last_serial": 5507940, "releases": { "0.2.0": [ { "comment_text": "", "digests": { "md5": "f60733eb60280a1efd8b91becec54513", "sha256": "b3649b1967c01d9dd0a3228448909d476ab6e1a29ad274cdd7d4d66b4fc5f097" }, "downloads": -1, "filename": "vertex2tex-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "f60733eb60280a1efd8b91becec54513", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 46117, "upload_time": "2019-06-23T21:23:44", "url": "https://files.pythonhosted.org/packages/b2/cc/e56459170f8a35ff38571309d59e4da22ec37d6eed244050bc32d70c8f5e/vertex2tex-0.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b67baced7bd79fdc57632a5d5a460c7b", "sha256": "8ca7d9f92ad6a9a819b396c412ca4d4d5de5d5c6564fc14e67f90b74306946ea" }, "downloads": -1, "filename": "vertex2tex-0.2.0.tar.gz", "has_sig": false, "md5_digest": "b67baced7bd79fdc57632a5d5a460c7b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22059, "upload_time": "2019-06-23T21:23:47", "url": "https://files.pythonhosted.org/packages/bb/1f/b61b2927cd1871cdc63ecaf9cafc4bd1ac929d1a4b9a591e9b67fabb0989/vertex2tex-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "b75e40728dab5c1d17d689dad2a3c804", "sha256": "9d7201eff662adf877e8f34c96dfbc2d576b3dc8770abec0da66a99b5d3b6320" }, "downloads": -1, "filename": "vertex2tex-0.2.1-py3-none-any.whl", "has_sig": false, "md5_digest": "b75e40728dab5c1d17d689dad2a3c804", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 32849, "upload_time": "2019-06-23T21:45:56", "url": "https://files.pythonhosted.org/packages/a4/f9/8aa8117373881851e5a71b321582aecb6b2b4ecd842ceea4cbf81853e24b/vertex2tex-0.2.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c5a78681768c3c52d076c1fac7b0dfdc", "sha256": "d6e16e49cad66410b497cf06f65955a4e48097bfee389c12b90d3e5e729c08a8" }, "downloads": -1, "filename": "vertex2tex-0.2.1.tar.gz", "has_sig": false, "md5_digest": "c5a78681768c3c52d076c1fac7b0dfdc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22058, "upload_time": "2019-06-23T21:45:57", "url": "https://files.pythonhosted.org/packages/c1/3f/f449f6740295daf00901bb72eba747d1a870d43f3da7459c0cc87e753c2b/vertex2tex-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "0c665175210ce9ae3031a27e374dc222", "sha256": "26718dad1da5a214f73dee96db733b2faa2901965f7ffc2b5fb23e476d18dbd1" }, "downloads": -1, "filename": "vertex2tex-0.2.2-py3-none-any.whl", "has_sig": false, "md5_digest": "0c665175210ce9ae3031a27e374dc222", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 32864, "upload_time": "2019-06-24T20:27:03", "url": "https://files.pythonhosted.org/packages/82/db/796756483f63dc2137d130308e4fb6286b073632d2f01abdd746e18e70ed/vertex2tex-0.2.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "caf94265c86db1c6f63525beffdb38ad", "sha256": "6756ad0f2ba98867abeab969010c3d867a34a03eccddb95838ce1e4ca05fe3b9" }, "downloads": -1, "filename": "vertex2tex-0.2.2.tar.gz", "has_sig": false, "md5_digest": "caf94265c86db1c6f63525beffdb38ad", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22048, "upload_time": "2019-06-24T20:27:04", "url": "https://files.pythonhosted.org/packages/01/42/3741d27eea1cbfca1d56907364b3e993af797b426c35a72e9023335e38d3/vertex2tex-0.2.2.tar.gz" } ], "0.2.3": [ { "comment_text": "", "digests": { "md5": "c85519ff30f313ab249fecc1e9fc7c4a", "sha256": "cc22452fdd51f39cd2f01dd3a331c128cca1ffbff665dc627b804e9c82058e7d" }, "downloads": -1, "filename": "vertex2tex-0.2.3-py3-none-any.whl", "has_sig": false, "md5_digest": "c85519ff30f313ab249fecc1e9fc7c4a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 33367, "upload_time": "2019-07-09T16:11:20", "url": "https://files.pythonhosted.org/packages/11/50/36829e6fed31d332515f3cae75a0f60b49f7eec50d35e8226ea4ffa4f243/vertex2tex-0.2.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "90ec0d7ed214adc9419e87bbf20dfe8f", "sha256": "3500f3f0ba6eb6ef9198c0598e6f922c688e9aa88f8a5009c2b30bfc235e8e7c" }, "downloads": -1, "filename": "vertex2tex-0.2.3.tar.gz", "has_sig": false, "md5_digest": "90ec0d7ed214adc9419e87bbf20dfe8f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23161, "upload_time": "2019-07-09T16:11:22", "url": "https://files.pythonhosted.org/packages/5f/48/8643d8c0aedb95495b7bb967a2787e47ab5cdb51dc5f7dcb1ba82206cdcf/vertex2tex-0.2.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c85519ff30f313ab249fecc1e9fc7c4a", "sha256": "cc22452fdd51f39cd2f01dd3a331c128cca1ffbff665dc627b804e9c82058e7d" }, "downloads": -1, "filename": "vertex2tex-0.2.3-py3-none-any.whl", "has_sig": false, "md5_digest": "c85519ff30f313ab249fecc1e9fc7c4a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 33367, "upload_time": "2019-07-09T16:11:20", "url": "https://files.pythonhosted.org/packages/11/50/36829e6fed31d332515f3cae75a0f60b49f7eec50d35e8226ea4ffa4f243/vertex2tex-0.2.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "90ec0d7ed214adc9419e87bbf20dfe8f", "sha256": "3500f3f0ba6eb6ef9198c0598e6f922c688e9aa88f8a5009c2b30bfc235e8e7c" }, "downloads": -1, "filename": "vertex2tex-0.2.3.tar.gz", "has_sig": false, "md5_digest": "90ec0d7ed214adc9419e87bbf20dfe8f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23161, "upload_time": "2019-07-09T16:11:22", "url": "https://files.pythonhosted.org/packages/5f/48/8643d8c0aedb95495b7bb967a2787e47ab5cdb51dc5f7dcb1ba82206cdcf/vertex2tex-0.2.3.tar.gz" } ] }