Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'd like to use LaTeX as an document generation backend in my application (mainly because it is well known, feature rich and output is of very high quality). Let's assume the application creates a small set of documents with content generated (or calculated) from user input.

Of course, I could require a working installation of TeX with the (relatively small) set of used packages on the installation target. Another option would be providing this during the installation process of the application itself. This would allow for feeding the generated LaTeX source to the latex command.

This adds a large and perhaps unstable dependency to the (comparatively) small application. As TeX installations can easily exceed several hundred MB in size, I'd rather not like to bother users with this.

What I'm looking for is a way of embedding LaTeX in my application, specifically tailored to the used document class and packages in the generated documents, ideally without the need to kpathsea the required files.

I assume this has been done before, but I haven't managed to find any traces of this.

share|improve this question

migrated from stackoverflow.com May 24 '13 at 8:00

This question came from our site for professional and enthusiast programmers.

1  
Will the users of your application enter large amounts of text? If not, the advances of having pretty LaTeX output might be outweight by the disadvantages of installing a minimal TeX system (see here for options: tex.stackexchange.com/a/23180/828) and you could generate the output differently. –  Habi May 24 '13 at 8:40
    
@Habi I'm not sure what "you could generate the output differently" means. Regarding your questions: No, users will enter a small amount of data. The output will be generated from this. It's typically between 10 to 20 pages consisting of text an tabulated data. –  mkluwe May 24 '13 at 9:52
    
I don't know anything about your app. I wonder what kind of app gives you an output of 10-20 pages of text and tabulated data and doesn't want you to use TeX itself :) You could print it with the standard OS printing routines, or give the users the option to export LaTeX code (if they care about nice high quality output). –  Habi May 24 '13 at 11:42
    
@Habi Think of a reporting tool: Given some period of time as input, output can be very large. The answer to tex.stackexchange.com/questions/65404 goes in this direction. My documents contain more text, but nevertheless... –  mkluwe May 24 '13 at 12:41
    
Are you talking about a web application? –  Alex May 24 '13 at 17:06
show 1 more comment

1 Answer

This is fairly straight-forward:

  • get a minimal (La)TeX distribution such as w32tex (if the license will allow it) or kergis (which should be okay anywhere since it's MIT licensed) http://www.kergis.com/en/kertex.html
  • TeX a sample document which includes every element you plan to support
  • use a utility like http://ctan.org/pkg/snapshot to get a list of the files needed
  • put all of the files in a directory w/in your application and set the TeX binary to look file files there first
share|improve this answer
    
Thank you for pointing out snapshot. At the moment, I'm planning to use tex -ini to generate a custom format to reduce the amount of files loaded. –  mkluwe Jul 8 '13 at 11:20
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.