{"action":"created","issue":{"url":"https://api.github.com/repos/typora/typora-issues/issues/339","repository_url":"https://api.github.com/repos/typora/typora-issues","labels_url":"https://api.github.com/repos/typora/typora-issues/issues/339/labels{/name}","comments_url":"https://api.github.com/repos/typora/typora-issues/issues/339/comments","events_url":"https://api.github.com/repos/typora/typora-issues/issues/339/events","html_url":"https://github.com/typora/typora-issues/issues/339","id":181580861,"number":339,"title":"Improper syntax for LaTeX Equation Environment (and the related ones)","user":{"login":"ickc","id":10970208,"avatar_url":"https://avatars.githubusercontent.com/u/10970208?v=3","gravatar_id":"","url":"https://api.github.com/users/ickc","html_url":"https://github.com/ickc","followers_url":"https://api.github.com/users/ickc/followers","following_url":"https://api.github.com/users/ickc/following{/other_user}","gists_url":"https://api.github.com/users/ickc/gists{/gist_id}","starred_url":"https://api.github.com/users/ickc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ickc/subscriptions","organizations_url":"https://api.github.com/users/ickc/orgs","repos_url":"https://api.github.com/users/ickc/repos","events_url":"https://api.github.com/users/ickc/events{/privacy}","received_events_url":"https://api.github.com/users/ickc/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/typora/typora-issues/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2016-10-07T04:02:51Z","updated_at":"2016-10-10T05:10:40Z","closed_at":null,"body":"In a old, messy document I wrote in [ickc/mathjax-latex-md-mmd-pandoc: Testing LaTeX Environments Usage in MathJax From Markdown Convertion (including mmd and pandoc)](https://github.com/ickc/mathjax-latex-md-mmd-pandoc), there's a bunch of LaTeX environments that MathJax also support are expected to be bare (without `$$`).\r\n\r\nCurrently in typora, it has to be typed in\r\n\r\n```md\r\n$$\r\n\\begin{equation}\r\nE=mc^2\r\n\\end{equation}\r\n$$\r\n```\r\n\r\nwhich will resulted in an error in LaTeX output."},"comment":{"url":"https://api.github.com/repos/typora/typora-issues/issues/comments/252538826","html_url":"https://github.com/typora/typora-issues/issues/339#issuecomment-252538826","issue_url":"https://api.github.com/repos/typora/typora-issues/issues/339","id":252538826,"user":{"login":"ickc","id":10970208,"avatar_url":"https://avatars.githubusercontent.com/u/10970208?v=3","gravatar_id":"","url":"https://api.github.com/users/ickc","html_url":"https://github.com/ickc","followers_url":"https://api.github.com/users/ickc/followers","following_url":"https://api.github.com/users/ickc/following{/other_user}","gists_url":"https://api.github.com/users/ickc/gists{/gist_id}","starred_url":"https://api.github.com/users/ickc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ickc/subscriptions","organizations_url":"https://api.github.com/users/ickc/orgs","repos_url":"https://api.github.com/users/ickc/repos","events_url":"https://api.github.com/users/ickc/events{/privacy}","received_events_url":"https://api.github.com/users/ickc/received_events","type":"User","site_admin":false},"created_at":"2016-10-10T05:10:40Z","updated_at":"2016-10-10T05:10:40Z","body":"The example over there might have some problems. The wikibook about LaTeX sometimes introduces wrong/poor habit. I'm not sure if this one is intentional or a mistake. But I tried to compiled it and it throws an error.\r\n\r\nThe `\\ldots` there is not math, so it is in \"bare\" LaTeX. It is exactly this kind of things that I don't recommend typora as a GUI editor to parse them.\r\n\r\nMay be I didn't make the point clearer, so let me explain it again:\r\n\r\nThere's a bunch of math environments that is not in math delimiters, *e.g.* `equation`. (These environments usually involve numbering. The full list is in the link in the original post)\r\n\r\nSo in LaTeX, they should be typed like this:\r\n\r\nSyntax 1:\r\n\r\n```tex\r\n\\begin{equation}\r\nE=mc^2\r\n\\end{equation}\r\n```\r\n\r\nIn MathJax, it is more tolerate (and has historical reason) and allow both the above syntax, or\r\n\r\nSyntax 2:\r\n\r\n```tex\r\n$$\\begin{equation}\r\nE=mc^2\r\n\\end{equation}$$\r\n```\r\n\r\nBut the problem is this later one is not a correct LaTeX syntax. If it is left as is when export to LaTeX, `latex` will throw an error, sometimes still compilable, sometimes halted (depending on exactly which environment we are talking about).\r\n\r\nThe problem is how to solve this problem? Either the source use syntax 1, and the parsing engine need to understand such syntaxes (a bunch of them and only them. The newest patch in pandoc fixes the bug that it includes too much `\\begin...\\end...` pairs.), or use syntax 2, and requires a post-processor when exporting to LaTeX (so in LaTeX output, syntax 2 *becomes* syntax 1).\r\n\r\npandoc chose the 1st approach, since pandoc has long been parsing some LaTeX in the md source (*e.g.* `\\newcommand`). My suggestion to typora is to pick the 2nd approach instead.\r\n\r\nThe reason is that typora provides live-preview, if you choose the 1st approach, that your typora live-preview engine need to understand that syntax as well such that after the user hit enter after syntax 1, it will turns into math preview.\r\n\r\nThis could create problems since typora also uses pandoc, and the suggestion seem to contradict with pandoc's dicision.\r\n\r\nThe counter argument to this disadvantage are:\r\n\r\n1. nothing prevent one to use the 2nd in pandoc. I personally use it on my legacy files that used syntax 2. That's why I wrote that post-processor.\r\n2. It provides better compatibility to other variants of markdown, especially MultiMarkdown that expects syntax 1 only.\r\n3. typora is specifically said somewhere about the compatibility issue with pandoc. typora uses an internal engine to output an AST understood by pandoc. So typora's source not being compatible with pandoc is understood."}}
{"actor":{"display_login":"ickc"}}