Re: Keeping text in sync at two locations in a document
It can easily be done in LaTeX, by defining macros that contain the dates and titles and then using those more than once. You can do this in LyX, too, therefore, using ERT, but there's no native support for it. Yes there is native support for macros in lyx, but the name is misleading; they are called Math macros. [Menu | Insert | Math | Macros] will allow you to define the macro, in both LaTeX and how it should appear in LyX if you so desire. Then, to use it in your text, insert some Inline Math; type your macro name preceded with a back-slash. The downside to this is that they are math macros, rather than simple LaTeX macros. There's an open bug about providing general macro support. RIchard
Re: Keeping text in sync at two locations in a document
Mateo > Yes there is native support for macros in lyx, but the name is misleading; > they are called Math macros. [Menu | Insert | Math | Macros] will allow you > to define the macro, in both LaTeX and how it should appear in LyX if you so > desire. Then, to use it in your text, insert some Inline Math; type your > macro name preceded with a back-slash. > > This is instead of defining the LaTeX macros in your preamble, as per below > (which also work just as well). This is also useful to know, but in this instance having the code in an ERT block at the beginning of the document works well, as I can construct my timetable in this block and see dates etc in context have it propagated through the document. Next year I can then edit the appropriate bits in the block and that part of the docment is updated. Thanks, Graham
Re: Keeping text in sync at two locations in a document
On Thursday 16 September 2010, Richard Heck wrote: > On 09/16/2010 03:06 AM, Graham Smith wrote: > > I have two timetables within the same document. > > >< snip >< > > Is there some way of doing this in Lyx. > > > > > It can easily be done in LaTeX, by defining macros that contain the > dates and titles and then using those more than once. You can do this in > LyX, too, therefore, using ERT, but there's no native support for it. Yes there is native support for macros in lyx, but the name is misleading; they are called Math macros. [Menu | Insert | Math | Macros] will allow you to define the macro, in both LaTeX and how it should appear in LyX if you so desire. Then, to use it in your text, insert some Inline Math; type your macro name preceded with a back-slash. This is instead of defining the LaTeX macros in your preamble, as per below (which also work just as well). Mateo. > So > e.g.: > \newcommand\datea{10 September 2010} > \newcommand\dateb{12 October 2010} > \newcommand\datec{20 November 2010} > \newcommand\titlea{Wow, What a Title!} > \newcommand\titleb{This Will Be Great} > \newcommand\titlec{Lorem Ipsum} > Put that where you like, e.g., in the preamble. If you want to be able > to use LyX to edit the text part, then you can do this in the main body > of the document: > [ERT]\newcommand\titlea{[/ERT]Now we're in LyX mode[ERT]}[/ERT] > You could also put these things in a separate child document and include > it to keep from cluttering your main document with ERT. > > Then in the tables: > [ERT]\datea{}[/ERT] > etc, where you need it. The braces are just to make sure nothing odd > happens following the command. > > Richard > >
Re: Keeping text in sync at two locations in a document
Richard > It can easily be done in LaTeX, by defining macros that contain the dates > and titles and then using those more than once. You can do this in LyX, too, That is very clever, and exactly what I wanted. Indeed I can see scope for this being useful for several other things as well. many thanks, Graham
Re: Keeping text in sync at two locations in a document
On 09/16/2010 03:06 AM, Graham Smith wrote: I have two timetables within the same document. One is the main timetable which has the lecture title and a summary of its content. The other is a summary timetable that goes on the back page of the document, and just has the date and lecture title. With Word I can use" Bookmarks" to auto-update the summary timetable when I edit the main timetable. The dates are fixed so its only the lecture titles that get edited and re-arranged. Is there some way of doing this in Lyx. It can easily be done in LaTeX, by defining macros that contain the dates and titles and then using those more than once. You can do this in LyX, too, therefore, using ERT, but there's no native support for it. So e.g.: \newcommand\datea{10 September 2010} \newcommand\dateb{12 October 2010} \newcommand\datec{20 November 2010} \newcommand\titlea{Wow, What a Title!} \newcommand\titleb{This Will Be Great} \newcommand\titlec{Lorem Ipsum} Put that where you like, e.g., in the preamble. If you want to be able to use LyX to edit the text part, then you can do this in the main body of the document: [ERT]\newcommand\titlea{[/ERT]Now we're in LyX mode[ERT]}[/ERT] You could also put these things in a separate child document and include it to keep from cluttering your main document with ERT. Then in the tables: [ERT]\datea{}[/ERT] etc, where you need it. The braces are just to make sure nothing odd happens following the command. Richard
Keeping text in sync at two locations in a document
I have two timetables within the same document. One is the main timetable which has the lecture title and a summary of its content. The other is a summary timetable that goes on the back page of the document, and just has the date and lecture title. With Word I can use" Bookmarks" to auto-update the summary timetable when I edit the main timetable. The dates are fixed so its only the lecture titles that get edited and re-arranged. Is there some way of doing this in Lyx. Thanks, Graham