>>To: LyX Users List <[email protected]>
>>From: Daniel Culver <[EMAIL PROTECTED]>
>>Subject: Mysql
>>Date: Wed, 10 Jan 2007 20:40:36 -0800
>>
>>Hi,
>>I am thinking about using Lyx for some documents that need to include
>>output from a Mysql database. Does anyone have any advise about the
>>best way to proceed.
It depends of the kind of doc you mean
If it's just patching data
in a LyX doc (a teable, e.g.), it's quite simple to write
a script which creates the tex code in a file, e.g. mytable.tex
and \input{mytable}
If you want to fill in a template with various data,
here is what I do (it's not Mysql, it's from Internet
forms, but it must work the same).
1/on the LyX side,
- insert variable info as latex commands, i.e. if you want
to get the name, type in ERT \dbname, \dbaddress, etc. at the desired location.
- create a tex file, say data_ref.tex where these commands are defined
with typical values
\newcommand{\dbname}{your_name}
\newcommand{\dbaddress}{your_address}
...
- \input{data_ref} in your preamble and check that the LyX output is correct
- touch an empty data.tex file and \input{data} after \input{data_ref} in the
preamble
2/ on the mySQl side
- create a script, say extract_data.sh, extract_data.pl (perl is great for
this)
or whatever interpreter which extracts the variables your_name,
your_address...
and writes out to file data.tex like this:
\renewcommand{\dbname}{your_name}
\renewcommand{\dbaddress}{your_address}
...
- check that lyx -e dvi foo.lyx is OK;
- do whatever needed to automate extraction and lyx compilation for various
sets of data.
You see that's just one method (among others I guess) to produce a mailing.
It's easy to fill in forms with this:
- get the eps of the empty form
- define all needed commands to patch data in the form
- open xfig, place the eps picture
- with the special flag set, type in all commands at their locations,
- insert the xfig file as external material in the lyx doc,
- if the pstex_t or pdftex_t file needs editing (the choice of combinations of
fonts is not
complete in xfig) you may revert to explicit \input of pstex_t or pdftex_t, and
fiddle with the family, shape, etc definitions to get what you want.
HTH
--
Jean-Pierre