On Wed, 8 Jul 2015 06:24:52 +0000 (UTC) Ian <iank...@gmail.com> wrote:
> Hi > > I want to automatically update latex code embedded in a LyX document > that was produced as output from another program, in my case STATA. > The Latex code contains table commands. > > The concept is similar to handling graphics in LyX: Insert >> Graphic > >> (attach file). If I change the graphic file content, keeping the > >> file name > and location the same, the graphic image will automatically update in > LyX. I want to do the same thing, but with a .tex file in which > contains the Latex code for a table produced by STATA. The .tex file > name and location remain constant, but the content changes. > > I am sure this is an easy thing, but I just can't seem to find it on > the web forums. > > Thanks. > I do that kind of stuff all the time. The trick is to put some kind of an unmistakable token in your LyX doc. Then make a shellscript that cats your LyX into a script (I'd probably use AWK, your mileage may vary) to replace the token with the desired LaTeX, and then redirect the script's output to another LyX file. LyX --export latex tempfile.lyx;pdflatex tempfile.tex. I have preprocessors that renumber procedure numbers so when I add a new procedure, I just put it in the right order, and the preprocessor numbers it. This is offtopic, but I also have a diploma maker whose input is a SVG file with text templates, and a Yaml file with replacments for the templates and a list of student names. I change the Yaml file, rerun my script, and bang, I have diplomas for each student in my latest class. If you make token based preprocessors, the world is your oyster. SteveT Steve Litt July 2015 featured book: Rapid Learning for the 21st Century http://www.troubleshooters.com/rl21