-
Notifications
You must be signed in to change notification settings - Fork 15
best way to escape dollar sign? #7
Comments
escape the dollar sign with $ aviods it to be processed by latex by the html file looks strange
|
You're welcome to change the script's RE to be something like [ ] or ( ), etc. |
Using
render it, markdown testmarkdown.md, we get [fd] (fasdf) Markdown strips the backslash. It's the correct behavior. Since any markdown extension runs after markdown itself, we need some way to ask markdown engine not to touch Other markdown with latex solutions do use E.g
This is not good sematic. And I tried those approaches, not as natrual as your current solution. I propose a minor code change. Considering the facts
Ask markdown-latex to subsitute any $ and % outside math mode to $ and %. Must be outside math mode because in math mode one need to escape $ and % to get themselves,
How about ask the writer upfront to escape '%' and $ in their documents. This will add some effort but it worthes it, because 1) it's stated beforhand rahter than authors go through what I had been through 2) people are used to escape special characters, and there are only two reserved words here. 3) a unified rule is easier for people to cooprate and exchange document |
This isn't true. The plugin is both a preprocessor and postprocessor. I changed the regular expression to search for [ ] and it worked fine. I output the preprocess result and the postprocess: Regular expression for a small TeX mode:
Running a small test:
|
Anyhow, the best solution, as you stated, is to just escape the % and $ if you use them in a document. |
Would you implement this in your code? |
I am typesetting articles on pricing and economy. There are dollar signs with normal text. If I don't escape them, python would complain about
or something like that, different u'' characters. It's really misleading! I thought there were some characters that python can't handle or the file is encoded with BOM.
Meanwhile the latex tmp.log stops after \usepackage then \end{article}, nothing within
Until by some chance I got to see a real latex tmp log with:
I knew it's something within equation or some missing $ . Of course, there are dollar signs all over the article.
Here is a sample:
Currently my way of dealing with this is to manually escape each $dollars. Because % $6,000 + $6,800 = $12,800. % inline won't work
My question is what's the best the to deal with it?
Thanks in advance!
The text was updated successfully, but these errors were encountered: