Pierre
Pierre

Reputation: 233

IHaskell and Latex

Is it possible, when using IHaskell, to have all the output automatically processed by Latex, or understood as Markdown ?

Perhaps this will involve (at least if I want it to work with data of type MyType) using import IHaskell.Display and instance IHaskellDisplay MyType where... but I don't know how to make this work!

Thanks!

edit Someone asked for an example, so what I have in mind is: every string of output (for every output is a string, ultimately...) is processed as latex code (or markdown). If a function returns, say, an integer, the result will be barely visible, but if a function returns the string $\mathbb{Z}$ then what appears on the screen is

$\mathbb{Z}$

[alert ! I thought we had latex formulae on stackoverflow, just like we do in mathoverflow, but if we don't, you need your imagination here!...]

Ultimately i imagine I would have a class Latexable a where showlatex :: a -> String and I would implement showlatex for some types.

Well, I'm happy with various partial solutions, allowing me to have some formulae typeset directly in the notebook, it doesn't really matter whether all output is processed...

Upvotes: 2

Views: 211

Answers (1)

Pierre
Pierre

Reputation: 233

Here's a partial answer to my own question.

import IHaskell.Display (latex)

Then if you try, say

latex "$x+y$"

it works!

It remains to find a mechanism so that latex is automatically called in certain situations, so the question remains open. But in most cases, I'm good.

Upvotes: 2

Related Questions