Haskell Haddock latex equation in comments
I'd like to use latex notation for equations in my source code. For example, I would write the following comment in some haskell source file Equations.hs:
-- | $v = frac{dx}{dt}$
In the doc
directory, this gets rendered by haddock in Equations.tex as:
{char '44}v = frac{char '173}dx{char '175}{char '173}dt{char '175}{char '44}
I found this function in the source for Haddock's latex backend that replaces many characters that are used in latex formatting:
latexMunge :: Char -> String -> String
...
latexMunge '$' s = "{char '44}" ++ s
Is there any existing functionality that allows me to bypass this and insert latex equations in comments?
No. The main reason why this (and similar features) don't exist is that it's unclear what to do with the markup in the other backends, be it HTML one, Hoogle one or whatever else someone might be using. This is fairly commonly requested but there is no common agreement and more importantly, no patches.
Technically we don't support the LaTeX backend, it's kept around compiling so that the Haskell Report can be produced. If you or someone else wants to give it some new life (and features) then we'll happily accept patches.
tl;dr: no can do. I know people simply pre-render LaTeX and insert the resulting images in with the image syntax.
链接地址: http://www.djcxy.com/p/21184.html上一篇: 两个日期之间的月差