Re: automatically updating latex code used in a LyX document
Liviu Andronic wrote: > On Fri, Jul 10, 2015 at 11:23 AM, José Matos wrote: >> On Thursday 09 July 2015 23:19:07 Liviu Andronic wrote: >>> Perhaps we should consider renaming it to something like: "Child >>> Document (TeX or LyX)"? >>> >>> Liviu >> >> Note that a child document can also be a programming listings or any >> other file to be included verbatim. :-) >> > Absolutely, yet our naming is so terse so as to prove confusing. Yes, it is confusing. The reason why the menu items are as they are is the implementation in three different insets: Include inset, graphics inset and external inset. However the functionality of those insets overlaps, and there is a very old plan to get rid of the graphics inset in favour of the external inset. We need some volunteers;-) > Maybe > we need a tooltip there, or a status message appearing when hovering > the item, or something else. Otherwise people simply won't really know > what that item is supposed to do, or worse assume that LyX is unable > to do this at all (when it does!). I know RTFM would be one way to > approach this, but maybe there is something we can do to ease > confusion... Say, and yet another shot in the dark: "Include Child > Document (.tex, .lyx, etc.)" I guess it should be possible to rework the menu items independently of the insets, but I hjave no good idea myself. Georg
Re: automatically updating latex code used in a LyX document
Liviu Andronic wrote: > On Thu, Jul 9, 2015 at 10:11 PM, Georg Baum > wrote: >> Ian wrote: >> >>> Thanks Liviu. Inserting a Child document .tex file was exactly what I >>> wanted to do. I just didn't know what it was called. >> >> Except for the fact that it is not automatically updated if the STATA >> file changes. >> > If the content of the child .tex file changes, doesn't LyX > automatically reflect those changes when recompiling the LyX document? Yes it does. However, LyX does not recognize that the .tex file itself needs to be regenerated when the STATA file changes. The latter would be possible with an external inset. Georg
Re: automatically updating latex code used in a LyX document
On Fri, Jul 10, 2015 at 11:23 AM, José Matos wrote: > On Thursday 09 July 2015 23:19:07 Liviu Andronic wrote: >> Perhaps we should consider renaming it to something like: "Child >> Document (TeX or LyX)"? >> >> Liviu > > Note that a child document can also be a programming listings or any other > file to be included verbatim. :-) > Absolutely, yet our naming is so terse so as to prove confusing. Maybe we need a tooltip there, or a status message appearing when hovering the item, or something else. Otherwise people simply won't really know what that item is supposed to do, or worse assume that LyX is unable to do this at all (when it does!). I know RTFM would be one way to approach this, but maybe there is something we can do to ease confusion... Say, and yet another shot in the dark: "Include Child Document (.tex, .lyx, etc.)" Cheers, Liviu > -- > José Abílio -- Do you think you know what math is? http://www.ideasroadshow.com/issues/ian-stewart-2013-08-02 Or what it means to be intelligent? http://www.ideasroadshow.com/issues/john-duncan-2013-08-30 Think again: http://www.ideasroadshow.com/library
Re: automatically updating latex code used in a LyX document
On Thursday 09 July 2015 23:19:07 Liviu Andronic wrote: > Perhaps we should consider renaming it to something like: "Child > Document (TeX or LyX)"? > > Liviu Note that a child document can also be a programming listings or any other file to be included verbatim. :-) -- José Abílio
Re: automatically updating latex code used in a LyX document
On 07/09/2015 05:19 PM, Liviu Andronic wrote: On Thu, Jul 9, 2015 at 10:17 PM, Georg Baum wrote: Benedict Holland wrote: If you have generated the tex file in Stata, use ERT. It is much easier. I am curious: What is easier if you include the file via ERT than with a child document? Note that I do not mean to convert the child document to LyX format, since LyX also allows to include child documents in LaTeX format. I suspect this is simply reflects a misunderstanding relating to the naming of our "Insert > File > Child Document..." menu item. For example, when answering this question I had to repeatedly look closely in the Insert menu since I was looking for "Insert > File > TeX Document...", and there is obviously none such item. Then I looked several times at External Material, but to my bemusement there was no TeX entry there. So by trial and error I realized that Child Document was the winner. Perhaps we should consider renaming it to something like: "Child Document (TeX or LyX)"? I second this suggestion, generally speaking. But perhaps we should really have two different menu items, or ? Richard
Re: automatically updating latex code used in a LyX document
On Thu, 09 Jul 2015 22:10:35 +0200 Georg Baum wrote: > Steve Litt wrote: > > > On Wed, 8 Jul 2015 06:24:52 + (UTC) > > Ian 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. > > This is possible: LyX has a mechanism called "external templates" > which can be seen as a generalization of the graphics inset: With an > external template, you can tell LyX what it needs to do to convert > your STATA file into LaTeX, and you also tell it how this LaTeX is to > be included in the LyX document. The only requirement for this to > work is that your application (or any other tool) allows to convert > to LaTeX from the command line. > > If you want to use this feature, you need to do two things: > > 1) Define a new external template for STATA as explained in chapter 6 > "6 Including External Material" in the Customization Manual. This > neds to be once, and if you need help don't hesitate to ask on the > list. > > 2) Each time you want to include a STATA output, you use Insert -> > File -> External Material. > > > > 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. > > This is certainly technically interesting, but I would not recommend > such a procedure to the original poster, since the builtin mechanism > does not need those helper scripts, and all the export/view buttons > in LyX do just work. I'm not so sure it I wouldn't recommend it for the Original Poster (OP). I've been using these techniques for years, and they amount to a 1 click (or menu choice or command) complete process. It could be automated to do every hour on the hour with no point and click intervention. It doesn't depend on LyX features and won't break if LyX changes its internal way of doing stuff. It's very simple to troubleshoot, given that there's an intermediate file. And it's dead bang easy for anyone who can script Python at all. I think it boils down to a philosophical point. Some folks believe strongly in never reinventing the wheel. I certainly use a lot of wheels as-is, but I always resist incorporating a wheel if all I need is one little spoke. Dependencies, even on something you've already incorporated, have a cost. I have scripts that create personalized eBooks, with the buyer's name in the footers, and some other security features I can't discuss. I make and ship these several times a day, and all I need to do is tell my converter which books to convert, the person's name, and bang, it makes all the eBooks in the order. LyX's only involvement is in a shellscript using its --export feature. If the OP can do simple scripting, I'd personally recommend preprocessing over LyX-centric ways of doing it, if the LyX-centric ways are complex, time consuming (in a point and click sense), or likely to change with a future LyX version. SteveT Steve Litt July 2015 featured book: Rapid Learning for the 21st Century http://www.troubleshooters.com/rl21
Re: automatically updating latex code used in a LyX document
On Thu, Jul 9, 2015 at 10:17 PM, Georg Baum wrote: > Benedict Holland wrote: > >> If you have generated the tex file in Stata, use ERT. It is much easier. > > I am curious: What is easier if you include the file via ERT than with a > child document? Note that I do not mean to convert the child document to LyX > format, since LyX also allows to include child documents in LaTeX format. > I suspect this is simply reflects a misunderstanding relating to the naming of our "Insert > File > Child Document..." menu item. For example, when answering this question I had to repeatedly look closely in the Insert menu since I was looking for "Insert > File > TeX Document...", and there is obviously none such item. Then I looked several times at External Material, but to my bemusement there was no TeX entry there. So by trial and error I realized that Child Document was the winner. Perhaps we should consider renaming it to something like: "Child Document (TeX or LyX)"? Liviu >> The command you want to look up is \input as in \input{table.tex}. This is >> the only way I generate, edit, and include tables now. This should also be >> the command that lyx uses... either that or include but I assume input >> would be a better use in this situation. I also use another application to >> edit the .tex because I need spell checking. > > If you insert the .tex file as a child document you can do this as well: The > child inset context menu provides an edit entry which fires up the .tex file > in your favourite editor. I cannot imagine any easier way to reference child > document in LaTeX format. > > > Georg > > -- Do you think you know what math is? http://www.ideasroadshow.com/issues/ian-stewart-2013-08-02 Or what it means to be intelligent? http://www.ideasroadshow.com/issues/john-duncan-2013-08-30 Think again: http://www.ideasroadshow.com/library
Re: automatically updating latex code used in a LyX document
On Thu, Jul 9, 2015 at 10:11 PM, Georg Baum wrote: > Ian wrote: > >> Thanks Liviu. Inserting a Child document .tex file was exactly what I >> wanted to do. I just didn't know what it was called. > > Except for the fact that it is not automatically updated if the STATA file > changes. > If the content of the child .tex file changes, doesn't LyX automatically reflect those changes when recompiling the LyX document? Liviu > > Georg > > -- Do you think you know what math is? http://www.ideasroadshow.com/issues/ian-stewart-2013-08-02 Or what it means to be intelligent? http://www.ideasroadshow.com/issues/john-duncan-2013-08-30 Think again: http://www.ideasroadshow.com/library
Re: automatically updating latex code used in a LyX document
Benedict Holland wrote: > If you have generated the tex file in Stata, use ERT. It is much easier. I am curious: What is easier if you include the file via ERT than with a child document? Note that I do not mean to convert the child document to LyX format, since LyX also allows to include child documents in LaTeX format. > The command you want to look up is \input as in \input{table.tex}. This is > the only way I generate, edit, and include tables now. This should also be > the command that lyx uses... either that or include but I assume input > would be a better use in this situation. I also use another application to > edit the .tex because I need spell checking. If you insert the .tex file as a child document you can do this as well: The child inset context menu provides an edit entry which fires up the .tex file in your favourite editor. I cannot imagine any easier way to reference child document in LaTeX format. Georg
Re: automatically updating latex code used in a LyX document
Ian wrote: > Thanks Liviu. Inserting a Child document .tex file was exactly what I > wanted to do. I just didn't know what it was called. Except for the fact that it is not automatically updated if the STATA file changes. Georg
Re: automatically updating latex code used in a LyX document
Steve Litt wrote: > On Wed, 8 Jul 2015 06:24:52 + (UTC) > Ian 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. This is possible: LyX has a mechanism called "external templates" which can be seen as a generalization of the graphics inset: With an external template, you can tell LyX what it needs to do to convert your STATA file into LaTeX, and you also tell it how this LaTeX is to be included in the LyX document. The only requirement for this to work is that your application (or any other tool) allows to convert to LaTeX from the command line. If you want to use this feature, you need to do two things: 1) Define a new external template for STATA as explained in chapter 6 "6 Including External Material" in the Customization Manual. This neds to be once, and if you need help don't hesitate to ask on the list. 2) Each time you want to include a STATA output, you use Insert -> File -> External Material. > 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. This is certainly technically interesting, but I would not recommend such a procedure to the original poster, since the builtin mechanism does not need those helper scripts, and all the export/view buttons in LyX do just work. Georg
Re: automatically updating latex code used in a LyX document
On Wed, 8 Jul 2015 06:24:52 + (UTC) Ian 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
Re: automatically updating latex code used in a LyX document
If you have generated the tex file in Stata, use ERT. It is much easier. The command you want to look up is \input as in \input{table.tex}. This is the only way I generate, edit, and include tables now. This should also be the command that lyx uses... either that or include but I assume input would be a better use in this situation. I also use another application to edit the .tex because I need spell checking. FWIW, I would highly recommend looking at how to make good tables using booktabs. It isn't hard but stata produces some really ugly and hard to read tables. Also, it doesn't know how to use longtable correctly and if you need notes, you also need threeparttable. None of those are standard output in State AFAIK and I know even know if lyx has a UI for threeparttable. Good luck, ~Ben On Wed, Jul 8, 2015 at 4:39 AM, Ian wrote: > > > > > If you want to include a .tex file, you would Insert > File > Child. > > See Help > Embedded, section 7.2 on Child Documents. > > > > Liviu > > > > > Thanks Liviu. Inserting a Child document .tex file was exactly what I > wanted to do. I just didn't know what it was called. > > > >
Re: automatically updating latex code used in a LyX document
> > If you want to include a .tex file, you would Insert > File > Child. > See Help > Embedded, section 7.2 on Child Documents. > > Liviu > Thanks Liviu. Inserting a Child document .tex file was exactly what I wanted to do. I just didn't know what it was called.
Re: automatically updating latex code used in a LyX document
On Wed, Jul 8, 2015 at 8:24 AM, Ian 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. > It would be easier if you provided a minimal example, but from what you say it is easy to do what you want. If you want to include a .tex file, you would Insert > File > Child. See Help > Embedded, section 7.2 on Child Documents. Liviu > I am sure this is an easy thing, but I just can't seem to find it on the > web forums. > > Thanks. > -- Do you think you know what math is? http://www.ideasroadshow.com/issues/ian-stewart-2013-08-02 Or what it means to be intelligent? http://www.ideasroadshow.com/issues/john-duncan-2013-08-30 Think again: http://www.ideasroadshow.com/library
automatically updating latex code used in a LyX document
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.