is there a way to compile a LaTeX document with C#?
I want to program a standalone Windows application, that gives you a pdf-file without installing any other programs like miktex/etc.
Thanks in advance.
Using LaTeX is similar to using a programming language or markup language, like HTML. You'll have to reimplement everything from LaTeX that you want to support in your C# program. This might be possible for a very small subset of the LaTeX standard, but you'll be reinventing the wheel. LaTeX is the most extensive markup language around with an enormous feature set with decades of development, it's not feasible to create a C# converter out of the blue for it.
To put it bluntly, it would be probably easier for you to create your own C# compiler than to come up with a feature complete LaTeX compiler.
If you can't change your input data, i.e. a LaTeX source, then you should use one of the existing LaTeX converters. If you're looking for a way to convert text source files with some markup data to PDF with C# then better look into a lightweight markup language like Markdown.
Related
Is there a way to get text that exist inside the border of specific color let say "red".
is it possible to all the text that exist in side "red" border box from pdf using c#. i had googled it but i did not found anyway to get text with style format from pdf.
The answer is not simple, unfortunately. Usually, when programmers need to write code that can parse text out of PDF files (what you are trying to do), they use third-party code libraries that other people wrote specifically for manipulating PDFs. In the C# world, there are a few options for well-known PDF manipulation libraries, but the ones that are easiest to use are not free. I've personally had good results using a library called iTextSharp, but it is not free.
I am writing software which displays a lot of mathematical content. As in windows forms it is already hard to set a subscript or a Greek letter in a label, I am thinking of switching to WPF.
At the moment I am searching for the best way to render a mathematical expression, a formula or just a symbol inside my graphical user interface. They have to be shown in labels or drawn graphs/pictures. No live/just-in-time renderings but beautiful fix symbols.
What is the best way to do that? I thought, that MathML should be supported well, but I can't find a lot regarding that. I would be glad to hear some advice.
Here is, where I can get my symbols from (or what I would prefer):
LaTeX-code (First choice! Code is already there and same appearance in Software and documentation would be marvellous)
MathML-code (LaTeX-code in Word 2007 or higher -> Word equations -> copy as plain MathML to clipboard)
SVG (some rendering of LaTeX in Inkscape and export to XAML)
xmcd Files (Mathcad XML Document. Don't know how, but at least it's XML)
html Files (written by LaTeX->html or Mathcad->html
What I wouldn't consider personally, but maybe there are good solutions to:
Images (png-icons, pdf, dvi, eps, svg directly imported)
Symbols (like copy pasted from Character Map. Don't like the fonts, wouldn't find all I need and exchange of formula syntax would not be given)
I think using LaTeX, MathML or html would be great as they could be used for documentation as well. I also could think about exporting calculation results to *.tex files or internally generate graphics completely with LaTeX (tikz, pgfplots...)
Consider using open-source WPF-Math library (disclaimer: I'm its' current maintainer).
It can help you to display the LaTeX expression in a WPF window. It also uses vector graphic instead of bitmaps, so the formulae will scale nice on the modern displays.
I would go with pure xaml approach using datatemplates. There is no need for another vector format or rednering engine.
You can use datatemplate for each expression in expression tree. Using viewboxes you can achieve stretching, so topmost expressions will be larger then inner expressions. Your datatemplates will generate visual tree from you expression tree. I mean there will be contentpresenters inside contentpresenter.
The great advatage is that the expression visualisation can be responsive and interactive, just like math expression in MS Word, or Excel.
I could help you with implementation, since this is not trivial, if you are not familiar with wpf datatemplates
As far as I can see, the best rendering (on paper) is achieved with a late conversion from a vector file. I would prefer using either GDI+ (System.Drawing) or WPF (System.Media) to render a formula. Let me know if we can collaborate on a WPF solution.
I used https://github.com/std8590/xmcd2cs to convert most of my Mathcad xmcd files to C#.
Then I used the formulas in code and make the input variables available in UI.
Is there a markup language that can be used in conjunction with a well supported .net open source project to generate PDF or HTML documents with very fine control on the output in terms of style and anchoring for both ?
Documents will part be static and part auto generated from the xml comments of some class libraries.
To Clarify the question, I Know html is a markup language, The reason I don't want to use it to directly store the content is because all of the HTML to PDF tools and libraries I have looked at contain patchy support for creating tables of contents, indexes and turning hyperlinks in to PDF document anchors.
I would opt for HTML documents. Markdown comes to mind. But as far as 'very fine' control goes arbitrarily, you can always just use HTML.. it is THE HyperText Markup Language after all.
There were many questions like this before on stackoverflow. I think the consensus is that you should have one markup language, rather than two.
HTML is - by definition (hypertext MARKUP LANGUAGE) - the markup language of choice and all you need to do is convert that to PDF. The other way around, from PDF to HTML is quite a bit tougher.
In order to convert HTML to PDF there's a truckload of tools, depending on what exact needs you have for the resulting PDF and what kind of CSS you need to support.
I'd always go for a rendering engine that's used in browsers (instead of something like iText or Prince), because you want to make sure your docs look like they do in a browser. You'd end up with Winnovative or something based on WebKit like the API by htm2pdf.
XSL-FO is the recommended solution. It provides a great level of control over the document layout and there are several tools for XSL-FO to PDF comversion.
I'm looking for a C# syntax highlighter that will take my C# code and turn it into standalone HTML that is neatly tagged. I have found some websites that offer this but only output HTML that is coupled with a CSS stylesheet. If anyone knows if what I'm describing exists please gimme a link!
I'm using Copy Code in HTML format with Visual Studio 2010 as part of Visual Studio 2010 Productivity Power Tools
The Python tool Pygments looks like it can do what you want and much more besides. I believe it supports many languages, including C#.
a wide range of common languages and markup formats is supported
special attention is paid to details that increase highlighting quality
support for new languages and formats are added easily; most
languages use a simple regex-based
lexing mechanism
a number of output formats is available, among them HTML, RTF,
LaTeX and ANSI sequences
it is usable as a command-line tool and as a library
When I last used it, I got standalone HTML from the CopySourceAsHtml plugin to Visual Studio. (I stopped using it only because I prefer the linked CSS approach.)
http://copysourceashtml.codeplex.com/
The appeal of this plugin is that it will match the styling of your Visual Studio theme, whatever that may be.
I need to programatically highlight PDFs on the fly, preferrably using the highlight file method.
Are there any .net programming libraries to generate a xml highlight offsets file for a pdf? Doesnt have to be open source or free.
I tried converting PDFBox to a .net DLL using IKVM and it did not work correctly. Im not terribly excited about the memory footprint of the entire java class library in the DLL anyway.
a second option would be to regenerate and highlight the source PDF, if there are any libraries / APIs that will do this to a PDF relatively easily that would work too, but I have not found any in my searches.
thanks in advance.
I dont know if this has solution for your requirement, but this is a good opensource api to work with PDF. I will be so happy if it could help your needs.
http://itextsharp.sourceforge.net/tutorial/index.html