3

I am new to Tex and I want to generate a PDF after taking some data from oracle SQL database. I researched a lot and I came to solution that I will have to write a C++ code for this. The C++ code will first read the data from database and the code will also generate the .tex file dynamically. This tex file would be fed as input to pdftex to generate the final output.

Now, my question's are:

  1. Do you think this is good approach or please suggest if you can think of some better solution?
  2. Is there any C++ library which can help me in generating tex file else I'll have to generate the tex file via basic C++ operations.
  • 2
    Actually I'm generating a TeX file using a python script using a CSV database. I'll say that using scripting languages are easier for the kind of work. However if you wanna usse it on on c++ code after, don't hesitate. For your second question I have no idea – Romain Picot Aug 22 '15 at 05:48
  • @RomainPicot I preferred C++ over python because I have C++ API to call oracle already installed on my production server and don't have python interface for same installed. BTW, do you think doing it from shell script would be better than doing same from C++? – Mayank Jain Aug 22 '15 at 05:52
  • you can do using brainfuck or some other exotic language if you master it or just want to learn it. So shell or cpp depend on you. I'll add something for the second point: It's just writing some text in final for so printf or cout with c++ – Romain Picot Aug 22 '15 at 05:56
  • 1
    Welcome to TeX.SE. If you provide a sample of the output from SQL database it would be easier to help you. Unless there is a lot of processing that you need to do to the data you can do all this directly from TeX by invoking a shell script to query the SQL database and generate a CSV file. Then use something like datatool package to process the data. – Peter Grill Aug 22 '15 at 09:01
  • 2
    There are two possible architectures: generate a LaTeX document from a program that queries the database - as you suggested. Or write a LaTeX document that queries the database during execution using the shell mechanism. This still requires writing the queries in some program but factors out all the static part of the document which helps maintaining it. – Christian Lindig Aug 22 '15 at 09:35
  • 3
    This is my answer to a similiar problem using python: http://tex.stackexchange.com/a/251901/59716 – MaxNoe Aug 22 '15 at 09:44
  • @Christian Lindig - Can you please suggest me one example or link which shows how can I call shell script in latex. – Mayank Jain Aug 24 '15 at 18:42
  • The mechanism is called \write18 and it is discussed under the tag write18. Here is an example: http://stackoverflow.com/a/3253068/44082. Note that you need to enable shell execution from pdflatex on the command line with --shell-escape. – Christian Lindig Aug 24 '15 at 19:24
  • 1
    What you are trying to do has a name: Database publishing. If your questions is about generating the TeX code, I'd consider it off-topic here and suggest [se] as a better site. If it's about the generated TeX code, please clarify your problems. – Martin Schröder Aug 24 '15 at 20:30

0 Answers0