John Lamber
John Lamber

Reputation: 281

LaTex for .NET

I am using ItextSharp to generate PDF. Part of our output, we have a lot of math related content. Maybe we can use some kind of Latex library to feed the result to ItextSharp to produce PDF. I have been googling for a while now but found nothing. Do you know if there is a latex library for .NET exists?

Also, do you know if ItextSharp can handle this without this Latex help?

Upvotes: 13

Views: 6952

Answers (4)

Rod
Rod

Reputation: 11

I'd look at a wrapper library too. Unless your wanting to write something massive like a latex editor, you're probably only wanting a small subset. I'd look at texnet free (www.texdotnet.com).

Upvotes: 1

joejoeson
joejoeson

Reputation: 1107

The GSoC project owner got back to me on the new project to externalize Mathtext to a new python library called MathTex.

He said that his work depends on a library called FT2FONT which is a wrapper around a C++ library. It would be trivial, for someone with good .net font knowledge, to take this work and use the wrapper to wrap the .net Font library and allow it to be used in IronPython.

Upvotes: 3

Jouni K. Seppänen
Jouni K. Seppänen

Reputation: 44132

It probably doesn't exist yet, but it shouldn't be an impossibly big project to compile TeX for C#. The original TeX was written in a version of Pascal, which is nowadays automatically translated into C by web2c. So it would just be a "small matter of programming" to make web2c produce C#, and to translate the supporting libraries (kpathsea, and whatever parts of pdftex you need - probably not nearly all of it) to be compatible.

Apart from that, there seems to be a GSoC project to extract the math rendering engine of Matplotlib into a separate library. Assuming that the library will be pure Python, you could use it via IronPython. So if you can wait until the end of the summer, that might be just what you need.

Upvotes: 4

John Fouhy
John Fouhy

Reputation: 42193

Your best bet may be to roll your own.

It might be as simple as making a basic template, and then doing:

  1. Insert expression into template.
  2. Compile with pdflatex.
  3. Insert resulting pdf into your document.

As another option, you could look at the source for other applications that do this. Mediawiki (the software behind wikipedia) springs to mind – it can use a LaTeX backend to generate maths formulae, and it's open-source so you can see how they did it.

Upvotes: 2

Related Questions