News for hackers. Stuff that matters.

kiwi0fruit

Re:The Wolfram Physics Project on Monday April 20, 2020 @03:21AM (#22921857)
I'm interested in research direction of using code-data dual algothms that modify each other and form natural selection process to formally abstract notion of evolutional open-endedness (like Turing completeness is an abstraction of algorithms notion). More details: https://www.reddit.com/r/DigitalPhilosophy/comments/dzghec/o...

Maybe you could advise some developed language or model for this task? The interesting part is to have code-data duality and enough rich language to kick start natural selection that would produce competing algorithms that would gradually become more and more complex (and gradually become closer to sentience).

Though the language might not even be Truring complete as it is. As natural assumption would be that the model should be finite in resources and it can get access to infinite time or memory only in time limit (assuming that the individual algorithms would survive for this to happen).

Examples of input to output conversion see in this PDF: https://github.com/kiwi0fruit/sugartex/blob/master/examples/...
Looks like it already have been implemented: https://tex.stackexchange.com/a/28033/133525

I mean having any macros name you want, even Unicode.

So you can even have \γ macros. But if you want to write \coercivenessSymbol (even on the blackboard) we cannot stop you - after all it gives you pleasure.

My conclusion about this feature: https://github.com/kiwi0fruit/sugartex/issues/1

SugarTeX is tweakable. You can write your own Panflute Pandoc filter that additionally defines new non-standard replacements alike yet defined in SugarTeX. But I dont know if you need it: LaTeX macroses are valid SugarTeX too after all and they are quite powerfull.
Is it that bad? Have you tried to debug Markdown + LaTeX MathJax? Is it the same of differs? As for me it seems enough easy to debug each single math object. But I only used Markdown + LaTeX insertions so I cannot compare.
NEW EXAMPLES ADDED ==================

Examples of input to output conversion see in this PDF:

https://github.com/kiwi0fruit/sugartex/blob/master/examples/...

I meant extension in sence that it's a LaTeX language extension to it's superset.

There's no LaTeX package and I myself will not port it. SugarTeX is Pandoc/Markdown oriented project in the first place.

You can use it as a command line prepocess text filter though. It should work as long as you use ˎ or ˎˎ to define SugarTeX.

Yep, this initially started as Pandoc filter that iterates over math elements and applies regex replacing. Then I switched to Panflute to iterate over math easier. And eventually added {, } counter with left, right and center regex patterns for binary math operators.
Yep, such examples are needed...

BTW: `mc\^2` gives mc²

I'd better call it 'TeX-Sugarer', though. And yes it's possible to create it to import LaTeX to SugarTeX.

SugarTeX completions is forked from latex-completions Atom package. I haven't seen something like this before.

Not really. With that package you can type in LaTeX. But it's inherited behavior.

I myself prefer type `\^:` to get vector superscript symbol, type `\^->` to get another vector superscript symbol. Type:.\rot`to get matrix superscript symbol. Type `\-->` to get long arrow.

But yes, type `\\` to get broken vertical bar that's a new newline symbol, type `\&` to get small sing below that later again converts to `&`.

My bad: I forget to tell about SugarTeX completions package for Atom. With it writing Unicode is lot faster and simple enough.

https://atom.io/packages/sugartex-completions

You are completely right. But I thought

``Both Python and Markdown are very readable languages. Unfortunately LaTeX is not like this. So I wrote SugaTeX extension+transpiler that is highly readable.``

means the same...

As about input. My bad: I forget to tell about SugarTeX completions package for Atom. There to write `` ⃗E`` you type ``\^->``(+E) this autocompletes to `` ⃗E``.

It needs indeed...

I guess Unicode Math is a part of SugarTeX as every valid LaTeX is a valid SugarTeX (unless it has new SugarTeX meaning, otherwise it's a bug). Or maybe there's something I do not know about Unicode Math? I thought it simply replaces/treats some Unicode characters with LaTeX commands. So I used this feature and didn't bother replacing some Unicode.

SugarTeX is a more readable LaTeX language extension and transcompiler to LaTeX. Designed to be used instead of $formula$ insertions to Markdown.

I use Markdown with Python code blocks for document programming via [Pandoctools](https://github.com/kiwi0fruit/pandoctools) (like R-Markdown).

Both Python and Markdown are very readable languages. Unfortunately LaTeX is not like this. So I wrote SugaTeX extension+transpiler that is highly readable. In order to achieve this it heavily uses Unicode so that SugarTeX install instructions even have recommended monospace font fallback chains.

[SugarTeX repo](https://github.com/kiwi0fruit/sugartex) with description.

Example of input to output conversion is at the end of [this PDF](https://github.com/kiwi0fruit/sugartex/blob/master/sugartex....).

Convenient and easily tweakable Atom+Markdown+Pandoc+Jupyter experience (can export to ipynb) ========================

(R Markdown alternative)

Assume you want Jupyter notebook experience but in IDE like Atom/Visual Studio Code.

So you either write markdown document with insertions of python code blocks. You can run these code blocks via Atom's Hydrogen package and instantly see their results.

Or you write Hydrogen .py file split by `# %%` separator into cells. You can run these cells via Hydrogen and instantly see results. You even can edit this file in PyCharm studio as it's a valid python (unless you use magics).

If you want to convert this document to some output format (html/pdf/ipynb) and send to other people then you use [Pandoctools](https://github.com/kiwi0fruit/pandoctools). It can convert both .md and .py files described above to valid mardown, or valid ipynb, or html, or pdf (but default pandoc templates are not what I like).

And Pandoctools not just converts - it gives you ability to tweak and tune the process of conversion the way you like. Then save this conversion algorithm as profile and reuse it. It's really convenient to use Pandoc with it's filters for this task - or even use simple CLI pipe text filters.

And you write conversion algorithm in bash script - the best language for this task as it can easily glue and combine text filters written in any language (as long as they have command line interface).

So in the proposed tool chain you:

* Write Markdown in Atom (with all available packages that help much), * Insert Jupyter code cells and deploy via Hydrogen, * Apply any Pandoc or text filters via [Pandoctools](https://github.com/kiwi0fruit/pandoctools) to convert to markdown/html/pdf/ipynb, * Pandoctools lets you define text filters pipelines ("profiles") and apply them to any file by simply adding two lines to markdown metadata section and opening the file with Pandoctools. You define text conversion algorithm once and then just use it with few 'Open with' clicks (or even with one short key with Atom package). * Collecting Jupyter cells outputs is also a Pandoc filter, * There are even working cross-references in exported ipynb, * Can convert markdown to markdown in order to post-convert with existing tools, * Optionally write math in SugarTeX that is a more readable LaTeX language extension and a transpiler to LaTeX.

[Example doc](https://github.com/kiwi0fruit/pandoctools/blob/master/exampl...): from markdown with Jupyter python code blocks, SugarTeX math and cross-references to ipynb notebook.

See more about all mentioned tools in [Pandoctools repo](https://github.com/kiwi0fruit/pandoctools).

There are also recommendations of nice Atom packages and even good open-source font fallback chains for Unicode-rich markdown documents (monospace for editor, serif/sans for output).

UPD

Worth noting that there is another way of joining plain markdown documents with Jupyter notebooks: storing Jupyter notebooks in markdown format - you still use Jupyter but have another content manager (or something). [notedown, podoc and ipymd](https://gist.github.com/mrtns/da998d5fde666d6da26807e1f24624...) go this way.

Another way is to abandon writing code in Jupyter (I myself find it frustrating) and write it in Atom editor with Hydrogen package. But then the question of export to ipynb arises. And Pandoctools solves this problem.

And even more! It's shell pipelines allow you to add custom text transformations and leverage pandoc filters. So for example I added SugarTeX filter because I didn't liked how LaTeX insertions look alien in Markdown (I guess it's because of low readability of LaTeX - both Python and Markdown are very readable languages).