Re: search math macros
Am Wed, 24 Jan 2024 11:05:38 -0500 schrieb Richard Kimberly Heck : > On 1/24/24 03:09, Kornel Benko wrote: > > Am Mon, 22 Jan 2024 17:35:25 -0500 > > schrieb Richard Kimberly Heck : > > > >> On 1/22/24 16:27, Michael Dean Pugh wrote: > >>> I've been using LyX for a number of years. Because I was reusing a > >>> lot of math macros, I started putting them in a separate file and > >>> loading that file at the beginning of each document with an input > >>> statement. Over time, the list has grown and I wanted to search for a > >>> macro to see how I had defined it (probably because I had since found > >>> a better way). But no configuration in Advanced Search that I have > >>> tried will allow me to search math macros. Am I missing something or > >>> is this a feature that might be added in the future? > >> OK, this is a bit weird: If you USE the macro, then the definition will > >> be found. So use it temporarily. > >> > >> > >> I think I understand why this happens, but it is a bit of a long story, > >> and not a terribly interesting one. I'm not sure it is even possible to > >> fix this. > >> > >> > >> Riki > >> > > I think the reason is that the macro definitions are not part of any latex > > output. > > Yes, that's what I assumed. Though what's odd is that the definition IS > found if it is used. What's not found is the actual usage, at least in > my testing. > > Riki > > Ouch. Should have been exactly reversed (fading memory). Kornel pgpUfuxcktOmr.pgp Description: Digitale Signatur von OpenPGP -- lyx-users mailing list lyx-users@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-users
Re: search math macros
On 1/24/24 03:09, Kornel Benko wrote: Am Mon, 22 Jan 2024 17:35:25 -0500 schrieb Richard Kimberly Heck : On 1/22/24 16:27, Michael Dean Pugh wrote: I've been using LyX for a number of years. Because I was reusing a lot of math macros, I started putting them in a separate file and loading that file at the beginning of each document with an input statement. Over time, the list has grown and I wanted to search for a macro to see how I had defined it (probably because I had since found a better way). But no configuration in Advanced Search that I have tried will allow me to search math macros. Am I missing something or is this a feature that might be added in the future? OK, this is a bit weird: If you USE the macro, then the definition will be found. So use it temporarily. I think I understand why this happens, but it is a bit of a long story, and not a terribly interesting one. I'm not sure it is even possible to fix this. Riki I think the reason is that the macro definitions are not part of any latex output. Yes, that's what I assumed. Though what's odd is that the definition IS found if it is used. What's not found is the actual usage, at least in my testing. Riki -- lyx-users mailing list lyx-users@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-users
Re: search math macros
Am Mon, 22 Jan 2024 17:35:25 -0500 schrieb Richard Kimberly Heck : > On 1/22/24 16:27, Michael Dean Pugh wrote: > > I've been using LyX for a number of years. Because I was reusing a > > lot of math macros, I started putting them in a separate file and > > loading that file at the beginning of each document with an input > > statement. Over time, the list has grown and I wanted to search for a > > macro to see how I had defined it (probably because I had since found > > a better way). But no configuration in Advanced Search that I have > > tried will allow me to search math macros. Am I missing something or > > is this a feature that might be added in the future? > > OK, this is a bit weird: If you USE the macro, then the definition will > be found. So use it temporarily. > > > I think I understand why this happens, but it is a bit of a long story, > and not a terribly interesting one. I'm not sure it is even possible to > fix this. > > > Riki > I think the reason is that the macro definitions are not part of any latex output. Since ADV-Find is using (mostly) unchanged output created for latex, the defs are neither in the search buffer, nor in searched buffer. Sure, it can be fixed, but needs more work. Kornel pgpFbXcOCyhIR.pgp Description: Digitale Signatur von OpenPGP -- lyx-users mailing list lyx-users@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-users
Re: search math macros
On 1/22/24 16:27, Michael Dean Pugh wrote: I've been using LyX for a number of years. Because I was reusing a lot of math macros, I started putting them in a separate file and loading that file at the beginning of each document with an input statement. Over time, the list has grown and I wanted to search for a macro to see how I had defined it (probably because I had since found a better way). But no configuration in Advanced Search that I have tried will allow me to search math macros. Am I missing something or is this a feature that might be added in the future? OK, this is a bit weird: If you USE the macro, then the definition will be found. So use it temporarily. I think I understand why this happens, but it is a bit of a long story, and not a terribly interesting one. I'm not sure it is even possible to fix this. Riki -- lyx-users mailing list lyx-users@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-users
search math macros
I've been using LyX for a number of years. Because I was reusing a lot of math macros, I started putting them in a separate file and loading that file at the beginning of each document with an input statement. Over time, the list has grown and I wanted to search for a macro to see how I had defined it (probably because I had since found a better way). But no configuration in Advanced Search that I have tried will allow me to search math macros. Am I missing something or is this a feature that might be added in the future? Thanks! Mike Pug -- lyx-users mailing list lyx-users@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-users
Re: How to make LyX math macros available across documents?
Am Freitag, den 06.08.2021, 11:15 -0400 schrieb Paul A. Rubin: > On 8/6/21 5:52 AM, Tobias Hilbricht wrote: > > Dear readers of this list, > > > > in my worksheets in chemistry I have to write chemical formulas and > > physical quantities very often. But while that is very easy to do > > in > > LyX out of the box with chemical formulas due to the integration of > > mhchem and its macro \ce, I am still trying to achieve something > > similar for physical quantities with siunitx and its macro \qty. > > > > What I have so far is a working LyX math macro (in LyX Ctrl+M on > > \newcommand{\mqty}[2]{\qty{#1}{#1}}) which I can invoke with a > > keyboard > > shortcut (Alt+Q for "command-sequence math-insert \mqty; char-left; > > char-left"). > > > > But I have to copy this custom LyX macro from document to document > > (siunitx loaded, of course). By contrast, I can invoke the macro > > \ce in > > math mode with a keyboard shortcut without further ado in every > > document and enjoy the immediate preview and avoid ERT. > > > > How is it possible to have custom macros available across documents > > in > > the same way? > > > > Thanks for helpful hints in advance! > > > > Yours > > Tobias > > > > > > > I can think of at least three possibilities. > If you will use the custom code routinely, create a document > containing it and make that document your new default document > (Document > Settings ... > Save as Document Defaults. > Create a document template that contains the custom code in its > preamble. You just create an otherwise empty document with your > preferred default settings and the custom code and save it in your > local templates document. When you want to use the custom code, start > your new document with File > New from Template ... and select the > correct template. > Create a module (Customization manual, section 5.2.1) containing the > custom code, store it in your local layouts folder, and then > reconfigure LyX so that LyX can find it. Thereafter, you can add it > to any document using Document > Settings ... > Modules. > Paul > > Dear Paul and Richard, thank you for your suggestions. I will resort to the "template solution". This is not the same as invoking an "LyX inbuild" command like \ce in any document, but for my purpose it is quite sufficient. Yours Tobias -- lyx-users mailing list lyx-users@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-users
Re: How to make LyX math macros available across documents?
On 8/6/21 5:52 AM, Tobias Hilbricht wrote: > Dear readers of this list, > > in my worksheets in chemistry I have to write chemical formulas and > physical quantities very often. But while that is very easy to do in > LyX out of the box with chemical formulas due to the integration of > mhchem and its macro \ce, I am still trying to achieve something > similar for physical quantities with siunitx and its macro \qty. > > What I have so far is a working LyX math macro (in LyX Ctrl+M on > \newcommand{\mqty}[2]{\qty{#1}{#1}}) which I can invoke with a keyboard > shortcut (Alt+Q for "command-sequence math-insert \mqty; char-left; > char-left"). > > But I have to copy this custom LyX macro from document to document > (siunitx loaded, of course). By contrast, I can invoke the macro \ce in > math mode with a keyboard shortcut without further ado in every > document and enjoy the immediate preview and avoid ERT. > > How is it possible to have custom macros available across documents in > the same way? I have several child documents containing different sorts of macros I use for different purposes. If I need one, then I just include it. Riki -- lyx-users mailing list lyx-users@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-users
Re: How to make LyX math macros available across documents?
On 8/6/21 5:52 AM, Tobias Hilbricht wrote: Dear readers of this list, in my worksheets in chemistry I have to write chemical formulas and physical quantities very often. But while that is very easy to do in LyX out of the box with chemical formulas due to the integration of mhchem and its macro \ce, I am still trying to achieve something similar for physical quantities with siunitx and its macro \qty. What I have so far is a working LyX math macro (in LyX Ctrl+M on \newcommand{\mqty}[2]{\qty{#1}{#1}}) which I can invoke with a keyboard shortcut (Alt+Q for "command-sequence math-insert \mqty; char-left; char-left"). But I have to copy this custom LyX macro from document to document (siunitx loaded, of course). By contrast, I can invoke the macro \ce in math mode with a keyboard shortcut without further ado in every document and enjoy the immediate preview and avoid ERT. How is it possible to have custom macros available across documents in the same way? Thanks for helpful hints in advance! Yours Tobias I can think of at least three possibilities. * If you will use the custom code routinely, create a document containing it and make that document your new default document (Document > Settings ... > Save as Document Defaults. * Create a document template that contains the custom code in its preamble. You just create an otherwise empty document with your preferred default settings and the custom code and save it in your local templates document. When you want to use the custom code, start your new document with File > New from Template ... and select the correct template. * Create a module (Customization manual, section 5.2.1) containing the custom code, store it in your local layouts folder, and then reconfigure LyX so that LyX can find it. Thereafter, you can add it to any document using Document > Settings ... > Modules. Paul -- lyx-users mailing list lyx-users@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-users
How to make LyX math macros available across documents?
Dear readers of this list, in my worksheets in chemistry I have to write chemical formulas and physical quantities very often. But while that is very easy to do in LyX out of the box with chemical formulas due to the integration of mhchem and its macro \ce, I am still trying to achieve something similar for physical quantities with siunitx and its macro \qty. What I have so far is a working LyX math macro (in LyX Ctrl+M on \newcommand{\mqty}[2]{\qty{#1}{#1}}) which I can invoke with a keyboard shortcut (Alt+Q for "command-sequence math-insert \mqty; char-left; char-left"). But I have to copy this custom LyX macro from document to document (siunitx loaded, of course). By contrast, I can invoke the macro \ce in math mode with a keyboard shortcut without further ado in every document and enjoy the immediate preview and avoid ERT. How is it possible to have custom macros available across documents in the same way? Thanks for helpful hints in advance! Yours Tobias -- lyx-users mailing list lyx-users@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-users
Re: Detokenized Math Macros?
On Wed, Nov 11, 2020 at 9:06 AM Richard Kimberly Heck wrote: > On 11/10/20 1:13 PM, Joel Kulesza wrote: > > Colleagues, > > > > Is there a way to detokenize math macros in LyX such that characters > > like an underscore are not passed? I'd like to highlight text and > > then apply the macro (via toolbar button/shortcut), but it passes > > through characters without escaping them automatically. > > This is intentional. The idea is that you can write some LaTeX, > highlight it, and them hit ctrl-M to make it math. Or paste it. Or > whatever. > Makes sense, and I understand. I was asking on behalf of a colleague with the hope that there was a "quick fix" based on how we've implemented macros. > My goal is to apply macro-based styling to various keywords in a > > document, so a macro seems like the most natural way to mark those > > items and then update them, as needed. However, I'm happy to consider > > other, better, ways to accomplish that. > > This looks like a job for a character style. The Logical Markup module > defines a 'Code' style that renders its content as monospace. Of course, > it can be customized. > Interesting—I'll look into that. Thanks Riki! - Joel -- lyx-users mailing list lyx-users@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-users
Re: Detokenized Math Macros?
On 11/10/20 1:13 PM, Joel Kulesza wrote: Colleagues, Is there a way to detokenize math macros in LyX such that characters like an underscore are not passed? I'd like to highlight text and then apply the macro (via toolbar button/shortcut), but it passes through characters without escaping them automatically. This is intentional. The idea is that you can write some LaTeX, highlight it, and them hit ctrl-M to make it math. Or paste it. Or whatever. My goal is to apply macro-based styling to various keywords in a document, so a macro seems like the most natural way to mark those items and then update them, as needed. However, I'm happy to consider other, better, ways to accomplish that. This looks like a job for a character style. The Logical Markup module defines a 'Code' style that renders its content as monospace. Of course, it can be customized. Riki -- lyx-users mailing list lyx-users@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-users
Detokenized Math Macros?
Colleagues, Is there a way to detokenize math macros in LyX such that characters like an underscore are not passed? I'd like to highlight text and then apply the macro (via toolbar button/shortcut), but it passes through characters without escaping them automatically. For example, please see the attached MWE. My goal is to apply macro-based styling to various keywords in a document, so a macro seems like the most natural way to mark those items and then update them, as needed. However, I'm happy to consider other, better, ways to accomplish that. Thank you, Joel detokenize_macro.lyx Description: Binary data -- lyx-users mailing list lyx-users@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-users
Re: LyX, Beamer and math macros
On 06/08/2018 01:39 PM, Richard Kimberly Heck wrote: On 06/08/2018 08:31 AM, Paul A. Rubin wrote: On 06/08/2018 01:14 AM, Reuven Segev wrote: Hi, When using LyX to produce slides with Beamer, I encountered the following issue. Beamer produces an empty slide wherever I insert my math macros. I could not think of a way to "encapsulate" them. Any help will be appreciated. Best, Reuven Segev Try putting them in a standard environment before the title. That may not work: You're likely to get a warning about there being a non-title environment before the title. What you can do is put the macros in a standard environment right after the title, author, etc, and before the first real frame (or section heading, or whatever). It is also possible to put macros right into a frame, as long as they are not in an environment that will `break' the frame. E.g., you can't put them in standard, unless that is use with increased depth. But you can put them in the Frame environment, right after the frame title (or anywhere else). Riki Sorry, that was a typo: I meant to say /below/ the title, not before. I don't get a non-title warning with a macro above the title, but I do get a not properly defined error when I use it. Paul
Re: LyX, Beamer and math macros
On 06/08/2018 08:31 AM, Paul A. Rubin wrote: > On 06/08/2018 01:14 AM, Reuven Segev wrote: >> Hi, >> When using LyX to produce slides with Beamer, I encountered the >> following issue. Beamer produces an empty slide wherever I insert my >> math macros. I could not think of a way to "encapsulate" them. >> >> Any help will be appreciated. >> >> Best, >> Reuven Segev > Try putting them in a standard environment before the title. That may not work: You're likely to get a warning about there being a non-title environment before the title. What you can do is put the macros in a standard environment right after the title, author, etc, and before the first real frame (or section heading, or whatever). It is also possible to put macros right into a frame, as long as they are not in an environment that will `break' the frame. E.g., you can't put them in standard, unless that is use with increased depth. But you can put them in the Frame environment, right after the frame title (or anywhere else). Riki
Re: LyX, Beamer and math macros
On 06/08/2018 01:14 AM, Reuven Segev wrote: Hi, When using LyX to produce slides with Beamer, I encountered the following issue. Beamer produces an empty slide wherever I insert my math macros. I could not think of a way to "encapsulate" them. Any help will be appreciated. Best, Reuven Segev Try putting them in a standard environment before the title. Paul
LyX, Beamer and math macros
Hi, When using LyX to produce slides with Beamer, I encountered the following issue. Beamer produces an empty slide wherever I insert my math macros. I could not think of a way to "encapsulate" them. Any help will be appreciated. Best, Reuven Segev
Re: Child Math Macros with Includes and nested Inputs
On 09/07/2016 01:07 PM, Tadeus Ras wrote: > Hello fellow Lyx users, > > > In order to structure my thesis, I am using an Include for each > chapter (starting from the included thesis template in > Resources\examples\thesis —> > https://wiki.lyx.org/Examples/Thesis#toc7). Further I would like to > structure the different Includes by using Inputs for the associated > sections. For each Input, I set the Include-file it is in as the main > document. No problem so far. > > But I haven’t got to grips with my math macros file after several > attempts (tried also with https://wiki.lyx.org/Tips/ChildMathMacros) :-( I generally use the "Solution" after the "LyX<1.5" thing. I.e., in the included file do: [ERT] \ifx\MathMacrosDefined\undefined \def\MathMacrosDefined{Hi there} [/ERT] Math macros go here. [ERT] \fi [/ERT] Now the macros are is only included once. Richard
Child Math Macros with Includes and nested Inputs
Hello fellow Lyx users, In order to structure my thesis, I am using an Include for each chapter (starting from the included thesis template in Resources\examples\thesis —> https://wiki.lyx.org/Examples/Thesis#toc7). Further I would like to structure the different Includes by using Inputs for the associated sections. For each Input, I set the Include-file it is in as the main document. No problem so far. But I haven’t got to grips with my math macros file after several attempts (tried also with https://wiki.lyx.org/Tips/ChildMathMacros <https://wiki.lyx.org/Tips/ChildMathMacros>) :-( I defined a branch „Math Macros“ and insert it at the beginning of each chapter and each section as well as in the global main document. I input the file „MathMacros.lyx“ into that branch. Then I activate it in the global main document only. LyX still seems to encounter problems with repeated definition of math macros. Is it possible to use that procedure for math macros with includes and nested inputs? Is my description somewhat understandable? I use LyX 2.2.1 on Mac OS X 10.11.6. Thanks for any hints and suggestions! Tadeus
Re: Searching in math macros
On Thu, Oct 1, 2015 at 11:49 PM, Guillaume Munch <g...@lyx.org> wrote: > Le 01/10/2015 12:03, David a écrit : >> >> Dear Lyx users, >> >> I work on a document that contains a long list of math macros >> defining various mathematical symbols. I would like to search in >> this list. >> >> Please consider the example Lyx file attached. How could I find, for >> example, \speedOfLight ? I have tried Edit > Find (Quick) and Edit >>> >>> Find (Advanced), but without luck. >> >> >> Do you know a way to do this? Thanks in advance. >> >> Regards, David >> > > I often found myself in the same situation and there was no solution to my > knowledge. > > As of now, there is a list of math macros in the navigation menu and the > outline pane. Especially the outline pane works well for that: math macros > can now be accessed and ordered either by appearance or alphabetically, and > can be searched for using the filter. > Is a list of math macros very different from a list of ERT insets? Will both contain cryptic code? Liviu > One more reason to be impatient for the 2.2 release. > > > Guillaume > -- 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: Searching in math macros
Am 01.10.2015 um 23:49 schrieb Guillaume Munch: > > As of now, there is a list of math macros in the navigation menu and the > outline pane. Especially the outline pane works well for that: math > macros can now be accessed and ordered either by appearance or > alphabetically, and can be searched for using the filter. Oh great, thanks a ton for this tip! David
Re: Searching in math macros
On 2015-10-02, Liviu Andronic wrote: > On Thu, Oct 1, 2015 at 11:49 PM, Guillaume Munch <g...@lyx.org> wrote: >> Le 01/10/2015 12:03, David a écrit : ... >> As of now, there is a list of math macros in the navigation menu and the >> outline pane. Especially the outline pane works well for that: math macros >> can now be accessed and ordered either by appearance or alphabetically, and >> can be searched for using the filter. > Is a list of math macros very different from a list of ERT insets? > Will both contain cryptic code? Every math-macro has a unique name (as it defines a macro which is later used by this name), while an ERT inset can contain arbitrary LaTeX code, usually just calling already defined macros. Günter
Re: Searching in math macros
On Fri, Oct 2, 2015 at 10:40 AM, Guenter Milde <mi...@users.sf.net> wrote: > On 2015-10-02, Liviu Andronic wrote: >> On Thu, Oct 1, 2015 at 11:49 PM, Guillaume Munch <g...@lyx.org> wrote: >>> Le 01/10/2015 12:03, David a écrit : > > ... > >>> As of now, there is a list of math macros in the navigation menu and the >>> outline pane. Especially the outline pane works well for that: math macros >>> can now be accessed and ordered either by appearance or alphabetically, and >>> can be searched for using the filter. > >> Is a list of math macros very different from a list of ERT insets? >> Will both contain cryptic code? > > Every math-macro has a unique name (as it defines a macro which is later > used by this name), while an ERT inset can contain arbitrary > LaTeX code, usually just calling already defined macros. > Right. So this is about a collection of macro names. Same approach would be useful with Sweave/knitr chunks, using their labels (and numbering, especially when labels are missing) in the Outliner. Liviu > > Günter > -- 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: Searching in math macros
Le 02/10/2015 09:58, Liviu Andronic a écrit : On Fri, Oct 2, 2015 at 10:40 AM, Guenter Milde <mi...@users.sf.net> wrote: On 2015-10-02, Liviu Andronic wrote: On Thu, Oct 1, 2015 at 11:49 PM, Guillaume Munch <g...@lyx.org> wrote: Le 01/10/2015 12:03, David a écrit : ... As of now, there is a list of math macros in the navigation menu and the outline pane. Especially the outline pane works well for that: math macros can now be accessed and ordered either by appearance or alphabetically, and can be searched for using the filter. Is a list of math macros very different from a list of ERT insets? Will both contain cryptic code? Every math-macro has a unique name (as it defines a macro which is later used by this name), while an ERT inset can contain arbitrary LaTeX code, usually just calling already defined macros. Right. So this is about a collection of macro names. Same approach would be useful with Sweave/knitr chunks, using their labels (and numbering, especially when labels are missing) in the Outliner. Liviu Yes if we implement lists of custom insets then it would be easy to make an inset argument behave like a caption from the outliner point of view using the new 2.2 implementation. This can be discussed in <http://www.lyx.org/trac/ticket/7790>. Guillaume
Searching in math macros
Dear Lyx users, I work on a document that contains a long list of math macros defining various mathematical symbols. I would like to search in this list. Please consider the example Lyx file attached. How could I find, for example, \speedOfLight ? I have tried Edit > Find (Quick) and Edit > Find (Advanced), but without luck. Do you know a way to do this? Thanks in advance. Regards, David symbols.lyx Description: application/lyx
Re: Searching in math macros
Le 01/10/2015 12:03, David a écrit : Dear Lyx users, I work on a document that contains a long list of math macros defining various mathematical symbols. I would like to search in this list. Please consider the example Lyx file attached. How could I find, for example, \speedOfLight ? I have tried Edit > Find (Quick) and Edit Find (Advanced), but without luck. Do you know a way to do this? Thanks in advance. Regards, David I often found myself in the same situation and there was no solution to my knowledge. As of now, there is a list of math macros in the navigation menu and the outline pane. Especially the outline pane works well for that: math macros can now be accessed and ordered either by appearance or alphabetically, and can be searched for using the filter. One more reason to be impatient for the 2.2 release. Guillaume
Re: Keyboard macros: disabled commands and autocomplete
Dear list, I would like to bring up the following topic again in the hope that someone has an answer. Am 30.07.2015 um 13:51 schrieb David Rörich: 2) I work on a document with many math macros having long names, several of them beginning with the same string. When entering an ambiguous string, an autocomplete window opens offering a choice of commands and macros that begin with that string (see image attached). This is very helpful. However, the delay between entering the string and the autocomplete window appearance is bothering me. Many IDEs have shortkeys for opening the autocompletion. Does such a shortkey in Lyx exist? If not, can I create one? What would be the corresponding command? Best, David
Re: Keyboard macros: disabled commands and autocomplete
On 08/13/2015 05:35 AM, David wrote: Dear list, I would like to bring up the following topic again in the hope that someone has an answer. There isn't one set, but you can set one yourself. Go to Tools Preferences Editing Shortcuts, enter completion in the search field, select completion-popup, hit Modify, put the cursor in the blank field to the left of the Delete Key button, and then enter the shortcut that works for you. Alt-Shift-Down Arrow seems to be available here and makes some kind of sense. Richard Am 30.07.2015 um 13:51 schrieb David Rörich: 2) I work on a document with many math macros having long names, several of them beginning with the same string. When entering an ambiguous string, an autocomplete window opens offering a choice of commands and macros that begin with that string (see image attached). This is very helpful. However, the delay between entering the string and the autocomplete window appearance is bothering me. Many IDEs have shortkeys for opening the autocompletion. Does such a shortkey in Lyx exist? If not, can I create one? What would be the corresponding command? Best, David
Re: Keyboard macros: disabled commands and autocomplete
On 08/13/2015 05:35 AM, David wrote: Dear list, I would like to bring up the following topic again in the hope that someone has an answer. PS You can also change the delay time under Tools Preferences Editing Input Completion. Richard
Re: Keyboard macros: disabled commands and autocomplete
Am 13.08.2015 um 16:03 schrieb Richard Heck: On 08/13/2015 05:35 AM, David wrote: Dear list, I would like to bring up the following topic again in the hope that someone has an answer. PS You can also change the delay time under Tools Preferences Editing Input Completion. Richard Good to know, thank you!
Re: Keyboard macros: disabled commands and autocomplete
Dear list, I would like to bring up the following topic again in the hope that someone has an answer. Am 30.07.2015 um 13:51 schrieb David Rörich: > > 2) I work on a document with many math macros having long names, several > of them beginning with the same string. When entering an ambiguous > string, an autocomplete window opens offering a choice of commands and > macros that begin with that string (see image attached). This is very > helpful. However, the delay between entering the string and the > autocomplete window appearance is bothering me. Many IDEs have shortkeys > for opening the autocompletion. Does such a shortkey in Lyx exist? If > not, can I create one? What would be the corresponding command? > Best, David
Re: Keyboard macros: disabled commands and autocomplete
On 08/13/2015 05:35 AM, David wrote: Dear list, I would like to bring up the following topic again in the hope that someone has an answer. There isn't one set, but you can set one yourself. Go to Tools> Preferences> Editing> Shortcuts, enter "completion" in the search field, select "completion-popup", hit "Modify", put the cursor in the blank field to the left of the "Delete Key" button, and then enter the shortcut that works for you. Alt-Shift-Down Arrow seems to be available here and makes some kind of sense. Richard Am 30.07.2015 um 13:51 schrieb David Rörich: 2) I work on a document with many math macros having long names, several of them beginning with the same string. When entering an ambiguous string, an autocomplete window opens offering a choice of commands and macros that begin with that string (see image attached). This is very helpful. However, the delay between entering the string and the autocomplete window appearance is bothering me. Many IDEs have shortkeys for opening the autocompletion. Does such a shortkey in Lyx exist? If not, can I create one? What would be the corresponding command? Best, David
Re: Keyboard macros: disabled commands and autocomplete
On 08/13/2015 05:35 AM, David wrote: Dear list, I would like to bring up the following topic again in the hope that someone has an answer. PS You can also change the delay time under Tools> Preferences> Editing> Input Completion. Richard
Re: Keyboard macros: disabled commands and autocomplete
Am 13.08.2015 um 16:03 schrieb Richard Heck: > On 08/13/2015 05:35 AM, David wrote: >> Dear list, >> >> I would like to bring up the following topic again in the hope that >> someone has an answer. > > PS You can also change the delay time under Tools> Preferences> Editing> > Input Completion. > > Richard > > Good to know, thank you!
Re: Keyboard macros: disabled commands and autocomplete
Am 31.07.2015 um 20:03 schrieb aparsloe: A hackish way is to insert and then delete a space character, to 'dirty' the document, which should enable the buffer-write: command-sequence space-insert normal; char-delete-backward; buffer-write; master-buffer-update; but I suspect buffer-write; master-buffer-update is incompatible with command-sequence as it presently exists. As I understand it, the buffer-write operation is a threaded process and so the master-buffer-update command will be started generally before the buffer-write is complete so that the overall effect won't be what you want. (I'm ignorant of LyX internals but I've tried command sequences involving saving/exporting operations before and this is what happens. See bug #8346.) In this case the order of commands does not matter, because Lyx takes the current state of the file from the editor, not from disk. So your suggestion works perferctly for me. Thank you, Andrew!
Re: Keyboard macros: disabled commands and autocomplete
Am 31.07.2015 um 20:03 schrieb aparsloe: > A hackish way is to insert and then delete a space character, to 'dirty' > the document, which should enable the buffer-write: > > command-sequence space-insert normal; char-delete-backward; > buffer-write; master-buffer-update; > > but I suspect "buffer-write; master-buffer-update" is incompatible with > "command-sequence" as it presently exists. As I understand it, the > buffer-write operation is a threaded process and so the > master-buffer-update command will be started generally before the > buffer-write is complete so that the overall effect won't be what you > want. (I'm ignorant of LyX internals but I've tried command sequences > involving saving/exporting operations before and this is what happens. > See bug #8346.) In this case the order of commands does not matter, because Lyx takes the current state of the file from the editor, not from disk. So your suggestion works perferctly for me. Thank you, Andrew!
Keyboard macros: disabled commands and autocomplete
I have two questions concerning keyboard macros / commands: 1) I'd like to bind a shortkey to the following command sequence: command-sequence buffer-write; master-buffer-update; i.e. save the current document, then update the preview of the master document. In principle, this works. However, if the document is already saved, the buffer-write command is disabled and consequently the second command is not executed, neither. Is it possible to enforce execution of the second command? 2) I work on a document with many math macros having long names, several of them beginning with the same string. When entering an ambiguous string, an autocomplete window opens offering a choice of commands and macros that begin with that string (see image attached). This is very helpful. However, the delay between entering the string and the autocomplete window appearance is bothering me. Many IDEs have shortkeys for opening the autocompletion. Does such a shortkey in Lyx exist? If not, can I create one? What would be the corresponding command? Thanks a lot. David signature.asc Description: OpenPGP digital signature
Re: Keyboard macros: disabled commands and autocomplete
On 30/07/2015 4:51 a.m., David Rörich wrote: I have two questions concerning keyboard macros / commands: 1) I'd like to bind a shortkey to the following command sequence: command-sequence buffer-write; master-buffer-update; i.e. save the current document, then update the preview of the master document. In principle, this works. However, if the document is already saved, the buffer-write command is disabled and consequently the second command is not executed, neither. Is it possible to enforce execution of the second command? Thanks a lot. David A hackish way is to insert and then delete a space character, to 'dirty' the document, which should enable the buffer-write: command-sequence space-insert normal; char-delete-backward; buffer-write; master-buffer-update; but I suspect buffer-write; master-buffer-update is incompatible with command-sequence as it presently exists. As I understand it, the buffer-write operation is a threaded process and so the master-buffer-update command will be started generally before the buffer-write is complete so that the overall effect won't be what you want. (I'm ignorant of LyX internals but I've tried command sequences involving saving/exporting operations before and this is what happens. See bug #8346.) Andrew --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus
Keyboard macros: disabled commands and autocomplete
I have two questions concerning keyboard macros / commands: 1) I'd like to bind a shortkey to the following command sequence: command-sequence buffer-write; master-buffer-update; i.e. save the current document, then update the preview of the master document. In principle, this works. However, if the document is already saved, the "buffer-write" command is disabled and consequently the second command is not executed, neither. Is it possible to enforce execution of the second command? 2) I work on a document with many math macros having long names, several of them beginning with the same string. When entering an ambiguous string, an autocomplete window opens offering a choice of commands and macros that begin with that string (see image attached). This is very helpful. However, the delay between entering the string and the autocomplete window appearance is bothering me. Many IDEs have shortkeys for opening the autocompletion. Does such a shortkey in Lyx exist? If not, can I create one? What would be the corresponding command? Thanks a lot. David signature.asc Description: OpenPGP digital signature
Re: Keyboard macros: disabled commands and autocomplete
On 30/07/2015 4:51 a.m., David Rörich wrote: I have two questions concerning keyboard macros / commands: 1) I'd like to bind a shortkey to the following command sequence: command-sequence buffer-write; master-buffer-update; i.e. save the current document, then update the preview of the master document. In principle, this works. However, if the document is already saved, the "buffer-write" command is disabled and consequently the second command is not executed, neither. Is it possible to enforce execution of the second command? Thanks a lot. David A hackish way is to insert and then delete a space character, to 'dirty' the document, which should enable the buffer-write: command-sequence space-insert normal; char-delete-backward; buffer-write; master-buffer-update; but I suspect "buffer-write; master-buffer-update" is incompatible with "command-sequence" as it presently exists. As I understand it, the buffer-write operation is a threaded process and so the master-buffer-update command will be started generally before the buffer-write is complete so that the overall effect won't be what you want. (I'm ignorant of LyX internals but I've tried command sequences involving saving/exporting operations before and this is what happens. See bug #8346.) Andrew --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus
Re: Import LaTeX macros into LyX Math Macros
On Wed, May 6, 2015 at 3:27 AM, Reuven Segev reuven.se...@gmail.com wrote: Hi, How can import a LaTeX file into LyX so that the LaTeX macros are imported into LyX math macros? Cross-posted at http://latex-community.org/forum/viewtopic.php?f=19t=26277 Scott
Import LaTeX macros into LyX Math Macros
Hi, How can import a LaTeX file into LyX so that the LaTeX macros are imported into LyX math macros? Thanks
Import LaTeX macros into LyX Math Macros
Hi, How can import a LaTeX file into LyX so that the LaTeX macros are imported into LyX math macros? Thanks
Re: Import LaTeX macros into LyX Math Macros
On Wed, May 6, 2015 at 3:27 AM, Reuven Segev reuven.se...@gmail.com wrote: Hi, How can import a LaTeX file into LyX so that the LaTeX macros are imported into LyX math macros? Cross-posted at http://latex-community.org/forum/viewtopic.php?f=19t=26277 Scott
Import LaTeX macros into LyX Math Macros
Hi, How can import a LaTeX file into LyX so that the LaTeX macros are imported into LyX math macros? Thanks
Re: Import LaTeX macros into LyX Math Macros
On Wed, May 6, 2015 at 3:27 AM, Reuven Segev <reuven.se...@gmail.com> wrote: > Hi, > How can import a LaTeX file into LyX so that the LaTeX macros are imported > into LyX math macros? > Cross-posted at http://latex-community.org/forum/viewtopic.php?f=19=26277 Scott
Re: using native 'math macros' as 'text macros'
On 2014-01-22, Liviu Andronic wrote: So, is it a good or bad idea to use math macros to emulate text macros? Is there a nicer approach? IMO, it is a bad idea. Math macros are for mathematical typesetting (and even then not the cleanest LaTeX code results). The text alternative to math macros are insets. You could define them either in a custom layout, a module or a local layout. Günter
Re: using native 'math macros' as 'text macros'
On Thu, Jan 23, 2014 at 12:09 PM, Guenter Milde mi...@users.sf.net wrote: On 2014-01-22, Liviu Andronic wrote: So, is it a good or bad idea to use math macros to emulate text macros? Is there a nicer approach? IMO, it is a bad idea. Math macros are for mathematical typesetting (and even then not the cleanest LaTeX code results). Thanks. I should drop this, then. The text alternative to math macros are insets. You could define them either in a custom layout, a module or a local layout. For anyone interested, here's an example of how to do this: http://tex.stackexchange.com/a/155442/15538 . However this is a bit awkward to set up all the time. I'm still curious though if it is easier now, given the custom inset lift-up in 2.1, to fix http://www.lyx.org/trac/ticket/1704 ? Liviu
Re: using native 'math macros' as 'text macros'
On 2014-01-22, Liviu Andronic wrote: So, is it a good or bad idea to use math macros to emulate text macros? Is there a nicer approach? IMO, it is a bad idea. Math macros are for mathematical typesetting (and even then not the cleanest LaTeX code results). The text alternative to math macros are insets. You could define them either in a custom layout, a module or a local layout. Günter
Re: using native 'math macros' as 'text macros'
On Thu, Jan 23, 2014 at 12:09 PM, Guenter Milde mi...@users.sf.net wrote: On 2014-01-22, Liviu Andronic wrote: So, is it a good or bad idea to use math macros to emulate text macros? Is there a nicer approach? IMO, it is a bad idea. Math macros are for mathematical typesetting (and even then not the cleanest LaTeX code results). Thanks. I should drop this, then. The text alternative to math macros are insets. You could define them either in a custom layout, a module or a local layout. For anyone interested, here's an example of how to do this: http://tex.stackexchange.com/a/155442/15538 . However this is a bit awkward to set up all the time. I'm still curious though if it is easier now, given the custom inset lift-up in 2.1, to fix http://www.lyx.org/trac/ticket/1704 ? Liviu
Re: using native 'math macros' as 'text macros'
On 2014-01-22, Liviu Andronic wrote: > So, is it a good or bad idea to use math macros to emulate text > macros? Is there a nicer approach? IMO, it is a bad idea. "Math macros" are for mathematical typesetting (and even then not the cleanest LaTeX code results). The text alternative to "math macros" are "insets". You could define them either in a custom layout, a module or a local layout. Günter
Re: using native 'math macros' as 'text macros'
On Thu, Jan 23, 2014 at 12:09 PM, Guenter Milde <mi...@users.sf.net> wrote: > On 2014-01-22, Liviu Andronic wrote: > >> So, is it a good or bad idea to use math macros to emulate text >> macros? Is there a nicer approach? > > IMO, it is a bad idea. "Math macros" are for mathematical typesetting (and > even then not the cleanest LaTeX code results). > Thanks. I should drop this, then. > The text alternative to "math macros" are "insets". You could define them > either in a custom layout, a module or a local layout. > For anyone interested, here's an example of how to do this: http://tex.stackexchange.com/a/155442/15538 . However this is a bit awkward to set up all the time. I'm still curious though if it is easier now, given the custom inset lift-up in 2.1, to fix http://www.lyx.org/trac/ticket/1704 ? Liviu
using native 'math macros' as 'text macros'
Dear all, I would like to use in my LyX documents something that would resemble text macros. I'm aware of http://www.lyx.org/trac/ticket/1704 and of solutions such as http://tex.stackexchange.com/questions/12747/keeping-the-names-of-things-consistent-in-lyx , but I'm wondering if the existing 'math macro' machinery can be used for this. For example, I am writing cover letters and the recipient is mentioned at least in three different places in the letter. When writing to a different recipient, I often simply change the name (in addition to some other minor modifications). I want to avoid needing to change the name three times, which is prone to errors and misspellings. (Another similar use case is when writing technical documentation as described here: http://tex.stackexchange.com/questions/12747/keeping-the-names-of-things-consistent-in-lyx .) Is there a straightforward, native way (i.e. non-ERT) to do this in LyX? I tried to use 'math macros' for this job (see attached): - insert math macro - Name= '\myname' - TeX = ctrl+m to put the text into an mbox, then type 'M. Simpson' But sofar I identified two issues: - hyphenation/line breaks. Since the text is within a math inset, I assume that TeX treats it as a single block and fails to hyphenate it in certain instances. I'm not sure how to solve this, as I cannot insert a hyphenation point into the macro. - formatting and on-screen rendering. If for example in one place of the text the macro is emphasized, and in another it is noun-ed, LyX won't recognize that and display the instant preview using regular, default font. This is minor, of course, but distracting. So, is it a good or bad idea to use math macros to emulate text macros? Is there a nicer approach? Regards, Liviu -- Do you know how to read? http://www.alienetworks.com/srtest.cfm http://goodies.xfce.org/projects/applications/xfce4-dict#speed-reader Do you know how to write? http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail text macro.lyx Description: Binary data text macro.pdf Description: Adobe PDF document
using native 'math macros' as 'text macros'
Dear all, I would like to use in my LyX documents something that would resemble text macros. I'm aware of http://www.lyx.org/trac/ticket/1704 and of solutions such as http://tex.stackexchange.com/questions/12747/keeping-the-names-of-things-consistent-in-lyx , but I'm wondering if the existing 'math macro' machinery can be used for this. For example, I am writing cover letters and the recipient is mentioned at least in three different places in the letter. When writing to a different recipient, I often simply change the name (in addition to some other minor modifications). I want to avoid needing to change the name three times, which is prone to errors and misspellings. (Another similar use case is when writing technical documentation as described here: http://tex.stackexchange.com/questions/12747/keeping-the-names-of-things-consistent-in-lyx .) Is there a straightforward, native way (i.e. non-ERT) to do this in LyX? I tried to use 'math macros' for this job (see attached): - insert math macro - Name= '\myname' - TeX = ctrl+m to put the text into an mbox, then type 'M. Simpson' But sofar I identified two issues: - hyphenation/line breaks. Since the text is within a math inset, I assume that TeX treats it as a single block and fails to hyphenate it in certain instances. I'm not sure how to solve this, as I cannot insert a hyphenation point into the macro. - formatting and on-screen rendering. If for example in one place of the text the macro is emphasized, and in another it is noun-ed, LyX won't recognize that and display the instant preview using regular, default font. This is minor, of course, but distracting. So, is it a good or bad idea to use math macros to emulate text macros? Is there a nicer approach? Regards, Liviu -- Do you know how to read? http://www.alienetworks.com/srtest.cfm http://goodies.xfce.org/projects/applications/xfce4-dict#speed-reader Do you know how to write? http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail text macro.lyx Description: Binary data text macro.pdf Description: Adobe PDF document
using native 'math macros' as 'text macros'
Dear all, I would like to use in my LyX documents something that would resemble "text macros". I'm aware of http://www.lyx.org/trac/ticket/1704 and of solutions such as http://tex.stackexchange.com/questions/12747/keeping-the-names-of-things-consistent-in-lyx , but I'm wondering if the existing 'math macro' machinery can be used for this. For example, I am writing cover letters and the recipient is mentioned at least in three different places in the letter. When writing to a different recipient, I often simply change the name (in addition to some other minor modifications). I want to avoid needing to change the name three times, which is prone to errors and misspellings. (Another similar use case is when writing technical documentation as described here: http://tex.stackexchange.com/questions/12747/keeping-the-names-of-things-consistent-in-lyx .) Is there a straightforward, native way (i.e. non-ERT) to do this in LyX? I tried to use 'math macros' for this job (see attached): - insert > math > macro - Name= '\myname' - TeX = ctrl+m to put the text into an mbox, then type 'M. Simpson' But sofar I identified two issues: - hyphenation/line breaks. Since the text is within a math inset, I assume that TeX treats it as a single block and fails to hyphenate it in certain instances. I'm not sure how to solve this, as I cannot insert a hyphenation point into the macro. - formatting and on-screen rendering. If for example in one place of the text the macro is emphasized, and in another it is noun-ed, LyX won't recognize that and display the instant preview using regular, default font. This is minor, of course, but distracting. So, is it a good or bad idea to use math macros to emulate text macros? Is there a nicer approach? Regards, Liviu -- Do you know how to read? http://www.alienetworks.com/srtest.cfm http://goodies.xfce.org/projects/applications/xfce4-dict#speed-reader Do you know how to write? http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail text macro.lyx Description: Binary data text macro.pdf Description: Adobe PDF document
Linguistics, macros and amsmath text
Dear Users, I'm having trouble using macros like this ones. Please see attached example \global\long\def\rp#1{R_{\text{p}}^{\text{#1}}} When I call the macro and parameter 1 is something like árbol or año latex gives error \acute or \tilde only allowed in math mode. LyX code calling the macro. \[ \rp{\acute{a}rbol} \] How can I use the macros with \text and Linguistics? Thanks Martin acute.lyx Description: application/lyx
Re: Linguistics, macros and amsmath text
El lun, 18-11-2013 a las 17:27 -0200, Alessandro Bandeira Duarte escribió: \mbox{}? Thanks but the idea is to write \mbox or \text in the macro, in order not to write it in the macro call! Martin
Re: Linguistics, macros and amsmath text
On 2013-11-18, martin wrote: [-- Type: text/plain, Encoding: quoted-printable --] El lun, 18-11-2013 a las 17:27 -0200, Alessandro Bandeira Duarte escribió: \mbox{}? Thanks but the idea is to write \mbox or \text in the macro, in order not to write it in the macro call! However, it seems there is a check for allowed characters that cannot be overridden easily. If this is confirmed by a developer, post a bug report. Günter
Linguistics, macros and amsmath text
Dear Users, I'm having trouble using macros like this ones. Please see attached example \global\long\def\rp#1{R_{\text{p}}^{\text{#1}}} When I call the macro and parameter 1 is something like árbol or año latex gives error \acute or \tilde only allowed in math mode. LyX code calling the macro. \[ \rp{\acute{a}rbol} \] How can I use the macros with \text and Linguistics? Thanks Martin acute.lyx Description: application/lyx
Re: Linguistics, macros and amsmath text
El lun, 18-11-2013 a las 17:27 -0200, Alessandro Bandeira Duarte escribió: \mbox{}? Thanks but the idea is to write \mbox or \text in the macro, in order not to write it in the macro call! Martin
Re: Linguistics, macros and amsmath text
On 2013-11-18, martin wrote: [-- Type: text/plain, Encoding: quoted-printable --] El lun, 18-11-2013 a las 17:27 -0200, Alessandro Bandeira Duarte escribió: \mbox{}? Thanks but the idea is to write \mbox or \text in the macro, in order not to write it in the macro call! However, it seems there is a check for allowed characters that cannot be overridden easily. If this is confirmed by a developer, post a bug report. Günter
Linguistics, macros and amsmath text
Dear Users, I'm having trouble using macros like this ones. Please see attached example \global\long\def\rp#1{R_{\text{p}}^{\text{#1}}} When I call the macro and parameter 1 is something like árbol or año latex gives error \acute or \tilde only allowed in math mode. LyX code calling the macro. \[ \rp{\acute{a}rbol} \] How can I use the macros with \text and Linguistics? Thanks Martin acute.lyx Description: application/lyx
Re: Linguistics, macros and amsmath text
El lun, 18-11-2013 a las 17:27 -0200, Alessandro Bandeira Duarte escribió: > \mbox{}? > Thanks but the idea is to write \mbox or \text in the macro, in order not to write it in the macro call! Martin
Re: Linguistics, macros and amsmath text
On 2013-11-18, martin wrote: > [-- Type: text/plain, Encoding: quoted-printable --] > El lun, 18-11-2013 a las 17:27 -0200, Alessandro Bandeira Duarte > escribió: >> \mbox{}? > Thanks but the idea is to write \mbox or \text in the macro, in order > not to write it in the macro call! However, it seems there is a check for allowed characters that cannot be overridden easily. If this is confirmed by a developer, post a bug report. Günter
The pLyX system: text macros
There are three files attached to this posting: txtmacs.py, txtmacs_help.py -- a script implementing a system of text macros in LyX, and its help file pLyXTexTMacros(compressed).lyx -- an explanatory document (with nearly 670 text macros just waiting to be expanded) The explanatory document must be saved in *uncompressed* format for the examples in it to work. It explains where to put the python scripts and then launches into an extensive explanation of how to use the system. While I was working on a table sorting script in September, there was a brief exchange on the Developer's list about text macros. It occurred to me that the scheme of exporting from .lyx to .lyx then doing a buffer-reload might lend itself to a text macro implementation. This started out as a system of expanding abbreviations (which could be nested one within another). Almost immediately I found that an 'abbreviation' could be essentially any LyX construct -- a word, a phrase, a paragraph, a number of paragraphs, an equation, inline or display, a picture, an inset, essentially anything. Then the code generalised so that the abbreviations could take arguments. Thus a macro [hg] might, by itself, expand to 'hyperbolic geometry' but presented with an argument, [hg](H), would expand to 'Hyperbolic geometry', meaning it could be used within and at the start of sentences. With 3 well-chosen keyboard shortcuts, I found macros provided a more convenient way of inserting character styles than presently available (in my opinion) in LyX. Macros also provide the easy insertion of LyX menu selections (as in the LyX manuals) with their sans serif formatting and menu separation character. And they enable the insertion of a specified number of any given character -- 47 asterisks perhaps, or 34 smileys. There are conditionals available which enlarge the scope of what is possible. In fact it is all very new to me and I don't know what is possible. But the basic system has proved undeniably useful, and I wouldn't consider undertaking any substantial writing task in LyX now without this facility to hand. Andrew # Define and expand text macros in a LyX document. # Part of the pLyX.py system; not an independent script # # txtmacs.py # # Andrew Parsloe (apars...@clear.net.nz) # ## import re, argparse bs1 = '\n\\backslash\n1\n' macdict = {'toggle': [[], ''], 'if0': [[''], bs1], 'if1': [[''], bs1], 'peel': [[''], bs1]} def main(infl, outfl, options, guff): '''Expand text macros.''' flex_arg = r'\begin_inset Flex .[argument]' begin_layout = r'\begin_layout' end_layout = r'\end_layout' begin_inset = r'\begin_inset' end_inset = r'\end_inset' begin_note = r'\begin_inset Note Note' bkslash = '\\' backslash = '\\backslash\n' status_open = 'status open\n' status_coll = 'status collapsed\n' re_macro = re.compile(r'(\w+)\n*(\w*)\s*(\d*)\s*$') re_lyxcmds = re.compile(r'(\\\w+) \w+') underscores = set([begin_layout, begin_inset, end_layout, end_inset]) charstyles = ['\\family', '\\series', '\\shape', '\\size', '\\emph', \ '\\noun', '\\underbar', '\\strikeout', '\\uuline', \ '\\uwave', '\\no_emph', '\\no_noun', '\\no_strikeout', \ '\\no_bar', '\\no_uuline', '\\no_uwave'] def output(depth, L): # write to file only at top level if depth == 0: outfl.write(L) return '' else: return L def defaults(s): '''Return used charstyles to default states.''' temp = r'' for y in (set(re_lyxcmds.findall(s)) - underscores): if y == r'\color': temp += y + ' inherit\n' elif y == r'\lang': temp += y + ' english\n' elif y.lower() in charstyles: temp += y + ' default\n' return temp def expand(mname, sup_args, depth): '''Expand the macro (recursively if necessary).''' # substitute values for placeholders macexp = macdict.get(mname)[1] macprms = macdict.get(mname)[0] num_params = len(macprms) macprms = ['\n'] + macprms[:num_params - len(sup_args)] + sup_args for i in range(num_params, -1, -1): macexp = macexp.replace('\n\\backslash\n' + str(i), macprms[i]) # replace macro inset with its expansion # expand included macros store = scan(iter(macexp.splitlines(True)), depth + 1) # return char styles to defaults store += output(depth + 1, defaults(macexp)) return store def strip_outers(stuff): '''Strip enclosing layout statements.''' stuff = stuff.partition('\n')[2] stuff = stuff.rpartition(end_layout)[0] return stuff def inset_contents(iterable, keepouters): '''Get contents of inset +/- outer layout
The pLyX system: text macros
There are three files attached to this posting: txtmacs.py, txtmacs_help.py -- a script implementing a system of text macros in LyX, and its help file pLyXTexTMacros(compressed).lyx -- an explanatory document (with nearly 670 text macros just waiting to be expanded) The explanatory document must be saved in *uncompressed* format for the examples in it to work. It explains where to put the python scripts and then launches into an extensive explanation of how to use the system. While I was working on a table sorting script in September, there was a brief exchange on the Developer's list about text macros. It occurred to me that the scheme of exporting from .lyx to .lyx then doing a buffer-reload might lend itself to a text macro implementation. This started out as a system of expanding abbreviations (which could be nested one within another). Almost immediately I found that an 'abbreviation' could be essentially any LyX construct -- a word, a phrase, a paragraph, a number of paragraphs, an equation, inline or display, a picture, an inset, essentially anything. Then the code generalised so that the abbreviations could take arguments. Thus a macro [hg] might, by itself, expand to 'hyperbolic geometry' but presented with an argument, [hg](H), would expand to 'Hyperbolic geometry', meaning it could be used within and at the start of sentences. With 3 well-chosen keyboard shortcuts, I found macros provided a more convenient way of inserting character styles than presently available (in my opinion) in LyX. Macros also provide the easy insertion of LyX menu selections (as in the LyX manuals) with their sans serif formatting and menu separation character. And they enable the insertion of a specified number of any given character -- 47 asterisks perhaps, or 34 smileys. There are conditionals available which enlarge the scope of what is possible. In fact it is all very new to me and I don't know what is possible. But the basic system has proved undeniably useful, and I wouldn't consider undertaking any substantial writing task in LyX now without this facility to hand. Andrew # Define and expand text macros in a LyX document. # Part of the pLyX.py system; not an independent script # # txtmacs.py # # Andrew Parsloe (apars...@clear.net.nz) # ## import re, argparse bs1 = '\n\\backslash\n1\n' macdict = {'toggle': [[], ''], 'if0': [[''], bs1], 'if1': [[''], bs1], 'peel': [[''], bs1]} def main(infl, outfl, options, guff): '''Expand text macros.''' flex_arg = r'\begin_inset Flex .[argument]' begin_layout = r'\begin_layout' end_layout = r'\end_layout' begin_inset = r'\begin_inset' end_inset = r'\end_inset' begin_note = r'\begin_inset Note Note' bkslash = '\\' backslash = '\\backslash\n' status_open = 'status open\n' status_coll = 'status collapsed\n' re_macro = re.compile(r'(\w+)\n*(\w*)\s*(\d*)\s*$') re_lyxcmds = re.compile(r'(\\\w+) \w+') underscores = set([begin_layout, begin_inset, end_layout, end_inset]) charstyles = ['\\family', '\\series', '\\shape', '\\size', '\\emph', \ '\\noun', '\\underbar', '\\strikeout', '\\uuline', \ '\\uwave', '\\no_emph', '\\no_noun', '\\no_strikeout', \ '\\no_bar', '\\no_uuline', '\\no_uwave'] def output(depth, L): # write to file only at top level if depth == 0: outfl.write(L) return '' else: return L def defaults(s): '''Return used charstyles to default states.''' temp = r'' for y in (set(re_lyxcmds.findall(s)) - underscores): if y == r'\color': temp += y + ' inherit\n' elif y == r'\lang': temp += y + ' english\n' elif y.lower() in charstyles: temp += y + ' default\n' return temp def expand(mname, sup_args, depth): '''Expand the macro (recursively if necessary).''' # substitute values for placeholders macexp = macdict.get(mname)[1] macprms = macdict.get(mname)[0] num_params = len(macprms) macprms = ['\n'] + macprms[:num_params - len(sup_args)] + sup_args for i in range(num_params, -1, -1): macexp = macexp.replace('\n\\backslash\n' + str(i), macprms[i]) # replace macro inset with its expansion # expand included macros store = scan(iter(macexp.splitlines(True)), depth + 1) # return char styles to defaults store += output(depth + 1, defaults(macexp)) return store def strip_outers(stuff): '''Strip enclosing layout statements.''' stuff = stuff.partition('\n')[2] stuff = stuff.rpartition(end_layout)[0] return stuff def inset_contents(iterable, keepouters): '''Get contents of inset +/- outer layout
The pLyX system: text macros
There are three files attached to this posting: txtmacs.py, txtmacs_help.py -- a script implementing a system of text macros in LyX, and its help file pLyXTexTMacros(compressed).lyx -- an explanatory document (with nearly 670 text macros just waiting to be expanded) The explanatory document must be saved in *uncompressed* format for the examples in it to work. It explains where to put the python scripts and then launches into an extensive explanation of how to use the system. While I was working on a table sorting script in September, there was a brief exchange on the Developer's list about text macros. It occurred to me that the scheme of exporting from .lyx to .lyx then doing a buffer-reload might lend itself to a text macro implementation. This started out as a system of expanding abbreviations (which could be nested one within another). Almost immediately I found that an 'abbreviation' could be essentially any LyX construct -- a word, a phrase, a paragraph, a number of paragraphs, an equation, inline or display, a picture, an inset, essentially anything. Then the code generalised so that the abbreviations could take arguments. Thus a macro [hg] might, by itself, expand to 'hyperbolic geometry' but presented with an argument, [hg](H), would expand to 'Hyperbolic geometry', meaning it could be used within and at the start of sentences. With 3 well-chosen keyboard shortcuts, I found macros provided a more convenient way of inserting character styles than presently available (in my opinion) in LyX. Macros also provide the easy insertion of LyX menu selections (as in the LyX manuals) with their sans serif formatting and menu separation character. And they enable the insertion of a specified number of any given character -- 47 asterisks perhaps, or 34 smileys. There are conditionals available which enlarge the scope of what is possible. In fact it is all very new to me and I don't know what is possible. But the basic system has proved undeniably useful, and I wouldn't consider undertaking any substantial writing task in LyX now without this facility to hand. Andrew # Define and expand text macros in a LyX document. # Part of the pLyX.py system; not an independent script # # txtmacs.py # # Andrew Parsloe (apars...@clear.net.nz) # ## import re, argparse bs1 = '\n\\backslash\n1\n' macdict = {'toggle': [[], ''], 'if0': [[''], bs1], 'if1': [[''], bs1], 'peel': [[''], bs1]} def main(infl, outfl, options, guff): '''Expand text macros.''' flex_arg = r'\begin_inset Flex .[argument]' begin_layout = r'\begin_layout' end_layout = r'\end_layout' begin_inset = r'\begin_inset' end_inset = r'\end_inset' begin_note = r'\begin_inset Note Note' bkslash = '\\' backslash = '\\backslash\n' status_open = 'status open\n' status_coll = 'status collapsed\n' re_macro = re.compile(r'(\w+)\n*(\w*)\s*(\d*)\s*$') re_lyxcmds = re.compile(r'(\\\w+) \w+') underscores = set([begin_layout, begin_inset, end_layout, end_inset]) charstyles = ['\\family', '\\series', '\\shape', '\\size', '\\emph', \ '\\noun', '\\underbar', '\\strikeout', '\\uuline', \ '\\uwave', '\\no_emph', '\\no_noun', '\\no_strikeout', \ '\\no_bar', '\\no_uuline', '\\no_uwave'] def output(depth, L): # write to file only at top level if depth == 0: outfl.write(L) return '' else: return L def defaults(s): '''Return used charstyles to default states.''' temp = r'' for y in (set(re_lyxcmds.findall(s)) - underscores): if y == r'\color': temp += y + ' inherit\n' elif y == r'\lang': temp += y + ' english\n' elif y.lower() in charstyles: temp += y + ' default\n' return temp def expand(mname, sup_args, depth): '''Expand the macro (recursively if necessary).''' # substitute values for placeholders macexp = macdict.get(mname)[1] macprms = macdict.get(mname)[0] num_params = len(macprms) macprms = ['\n'] + macprms[:num_params - len(sup_args)] + sup_args for i in range(num_params, -1, -1): macexp = macexp.replace('\n\\backslash\n' + str(i), macprms[i]) # replace macro & inset with its expansion # & expand included macros store = scan(iter(macexp.splitlines(True)), depth + 1) # return char styles to defaults store += output(depth + 1, defaults(macexp)) return store def strip_outers(stuff): '''Strip enclosing layout statements.''' stuff = stuff.partition('\n')[2] stuff = stuff.rpartition(end_layout)[0] return stuff def inset_contents(iterable, keepouters): '''Get contents of inset +/- oute
Re: math macros via LaTex preamble
On 07/21/2012 11:34 PM, Allen Barker wrote: On 07/20/2012 03:40 AM, Guenter Milde wrote: Also, math-macros are document specific - defining a math-macro in one document does not make it available in other ones. This is why my documents include a file of commonly used math macros -- just like I \input a file with commonly used preamble definitions in my LaTeX documents. Could you elaborate on the best way to include a file of commonly-used math macros, in a way which is compatible with Lyx? I tend to use a lot of \DeclareMathOperator commands in the preamble, for example. These kinds of commands do not (now) have any LyX equivalent, so they are just entered as raw LaTeX and naturally go in the preamble. So put them in some file mycmds.tex, and input it into your LyX preamble in the usual way. I've avoided the Lyx macro stuff so far because it has seemed to me to be *too* document specific. I don't know if it actually is, but I haven't found that information in the preliminary searches I've conducted. I have several files, for different projects, that contain nothing but math macros. This gets input into my other documents, using InsertFileChild Document. Note that LyX doesn't know anything about what you put in the preamble (it just gets output raw into your document preamble), so if you use your new math operators in LyX, they'll work, but not look nice. So the attached shows a way around this problem. The difference between \test and \lest doesn't show up inside LyX, but it does in the output. Richard mathop.lyx Description: application/lyx
RE: math macros via LaTex preamble
From: Richard Heck [rgh...@lyx.org] Sent: Sunday, July 22, 2012 10:20 AM So the attached shows a way around this problem. The difference between \test and \lest doesn't show up inside LyX, but it does in the output. Is there any way to put these inside a preview inset? Scott
Re: math macros via LaTex preamble
On 2012-07-22, Allen Barker wrote: On 07/20/2012 03:40 AM, Guenter Milde wrote: Also, math-macros are document specific - defining a math-macro in one document does not make it available in other ones. This is why my documents include a file of commonly used math macros -- just like I \input a file with commonly used preamble definitions in my LaTeX documents. Could you elaborate on the best way to include a file of commonly-used math macros, in a way which is compatible with Lyx? I tend to use a lot of \DeclareMathOperator commands in the preamble, for example. For definitions that should work in most documents, I use two files, a tex preamble and a lyx preamble. In DocumentSettingsLaTeX preamble, I write \input{preamble.tex} and in the document itself I have an inset with InsertFileLyX Documentmath-macros.lyx. In math-macros.lyx I use a branch macro-doc that is usually inactiv for the comments/documentation. Instead of \DeclareMathOperator, I use \operatorname in a math-macro, say \Re := \operatorname{Re} which then translates to \global\long\def\Re{\operatorname{Re}} Any general comments on the best way to organize and include preamble material in a way which is compatible with Lyx would also be appreciated. The best way generally depends on weather conditions, personal preference and other circumstances. For parent/child documents, I put the math-macros file (together with some other stuff) in a branch that is set active in the child but inactive in the parent doc. This way the child is also a valid standalone document. Günter
Re: math macros via LaTex preamble
On 07/21/2012 11:34 PM, Allen Barker wrote: On 07/20/2012 03:40 AM, Guenter Milde wrote: Also, math-macros are document specific - defining a math-macro in one document does not make it available in other ones. This is why my documents include a file of commonly used math macros -- just like I \input a file with commonly used preamble definitions in my LaTeX documents. Could you elaborate on the best way to include a file of commonly-used math macros, in a way which is compatible with Lyx? I tend to use a lot of \DeclareMathOperator commands in the preamble, for example. These kinds of commands do not (now) have any LyX equivalent, so they are just entered as raw LaTeX and naturally go in the preamble. So put them in some file mycmds.tex, and input it into your LyX preamble in the usual way. I've avoided the Lyx macro stuff so far because it has seemed to me to be *too* document specific. I don't know if it actually is, but I haven't found that information in the preliminary searches I've conducted. I have several files, for different projects, that contain nothing but math macros. This gets input into my other documents, using InsertFileChild Document. Note that LyX doesn't know anything about what you put in the preamble (it just gets output raw into your document preamble), so if you use your new math operators in LyX, they'll work, but not look nice. So the attached shows a way around this problem. The difference between \test and \lest doesn't show up inside LyX, but it does in the output. Richard mathop.lyx Description: application/lyx
RE: math macros via LaTex preamble
From: Richard Heck [rgh...@lyx.org] Sent: Sunday, July 22, 2012 10:20 AM So the attached shows a way around this problem. The difference between \test and \lest doesn't show up inside LyX, but it does in the output. Is there any way to put these inside a preview inset? Scott
Re: math macros via LaTex preamble
On 2012-07-22, Allen Barker wrote: On 07/20/2012 03:40 AM, Guenter Milde wrote: Also, math-macros are document specific - defining a math-macro in one document does not make it available in other ones. This is why my documents include a file of commonly used math macros -- just like I \input a file with commonly used preamble definitions in my LaTeX documents. Could you elaborate on the best way to include a file of commonly-used math macros, in a way which is compatible with Lyx? I tend to use a lot of \DeclareMathOperator commands in the preamble, for example. For definitions that should work in most documents, I use two files, a tex preamble and a lyx preamble. In DocumentSettingsLaTeX preamble, I write \input{preamble.tex} and in the document itself I have an inset with InsertFileLyX Documentmath-macros.lyx. In math-macros.lyx I use a branch macro-doc that is usually inactiv for the comments/documentation. Instead of \DeclareMathOperator, I use \operatorname in a math-macro, say \Re := \operatorname{Re} which then translates to \global\long\def\Re{\operatorname{Re}} Any general comments on the best way to organize and include preamble material in a way which is compatible with Lyx would also be appreciated. The best way generally depends on weather conditions, personal preference and other circumstances. For parent/child documents, I put the math-macros file (together with some other stuff) in a branch that is set active in the child but inactive in the parent doc. This way the child is also a valid standalone document. Günter
Re: math macros via LaTex preamble
On 07/21/2012 11:34 PM, Allen Barker wrote: On 07/20/2012 03:40 AM, Guenter Milde wrote: Also, math-macros are document specific - defining a math-macro in one document does not make it available in other ones. This is why my documents include a file of commonly used math macros -- just like I \input a file with commonly used preamble definitions in my LaTeX documents. Could you elaborate on the best way to include a file of commonly-used math macros, in a way which is compatible with Lyx? I tend to use a lot of \DeclareMathOperator commands in the preamble, for example. These kinds of commands do not (now) have any LyX equivalent, so they are just entered as raw LaTeX and naturally go in the preamble. So put them in some file mycmds.tex, and input it into your LyX preamble in the usual way. I've avoided the Lyx macro stuff so far because it has seemed to me to be *too* document specific. I don't know if it actually is, but I haven't found that information in the preliminary searches I've conducted. I have several files, for different projects, that contain nothing but math macros. This gets input into my other documents, using Insert>File>Child Document. Note that LyX doesn't know anything about what you put in the preamble (it just gets output raw into your document preamble), so if you use your new math operators in LyX, they'll work, but not look nice. So the attached shows a way around this problem. The difference between \test and \lest doesn't show up inside LyX, but it does in the output. Richard mathop.lyx Description: application/lyx
RE: math macros via LaTex preamble
From: Richard Heck [rgh...@lyx.org] Sent: Sunday, July 22, 2012 10:20 AM >So the attached shows a way around this problem. The difference between \test >and \lest >doesn't show up inside LyX, but it does in the output. Is there any way to put these inside a preview inset? Scott
Re: math macros via LaTex preamble
On 2012-07-22, Allen Barker wrote: > On 07/20/2012 03:40 AM, Guenter Milde wrote: >> Also, math-macros are document specific - defining a math-macro in one >> document does not make it available in other ones. This is why my >> documents include a file of commonly used math macros -- just like I >> \input a file with commonly used preamble definitions in my LaTeX >> documents. > Could you elaborate on the best way to include a file of > commonly-used math macros, in a way which is compatible > with Lyx? I tend to use a lot of \DeclareMathOperator > commands in the preamble, for example. For definitions that should work in most documents, I use two files, a tex preamble and a lyx preamble. In Document>Settings>LaTeX preamble, I write \input{preamble.tex} and in the document itself I have an inset with Insert>File>LyX Document>math-macros.lyx. In math-macros.lyx I use a branch "macro-doc" that is usually inactiv for the comments/documentation. Instead of \DeclareMathOperator, I use \operatorname in a math-macro, say \Re := \operatorname{Re} which then translates to \global\long\def\Re{\operatorname{Re}} > Any general comments on the "best" way to organize and > include preamble material in a way which is compatible > with Lyx would also be appreciated. The "best" way generally depends on weather conditions, personal preference and other circumstances. For parent/child documents, I put the math-macros file (together with some other stuff) in a branch that is set active in the child but inactive in the parent doc. This way the child is also a valid standalone document. Günter
Re: math macros via LaTex preamble
On 07/20/2012 03:40 AM, Guenter Milde wrote: Also, math-macros are document specific - defining a math-macro in one document does not make it available in other ones. This is why my documents include a file of commonly used math macros -- just like I \input a file with commonly used preamble definitions in my LaTeX documents. Could you elaborate on the best way to include a file of commonly-used math macros, in a way which is compatible with Lyx? I tend to use a lot of \DeclareMathOperator commands in the preamble, for example. I've avoided the Lyx macro stuff so far because it has seemed to me to be *too* document specific. I don't know if it actually is, but I haven't found that information in the preliminary searches I've conducted. Any general comments on the best way to organize and include preamble material in a way which is compatible with Lyx would also be appreciated.
Re: math macros via LaTex preamble
On 07/20/2012 03:40 AM, Guenter Milde wrote: Also, math-macros are document specific - defining a math-macro in one document does not make it available in other ones. This is why my documents include a file of commonly used math macros -- just like I \input a file with commonly used preamble definitions in my LaTeX documents. Could you elaborate on the best way to include a file of commonly-used math macros, in a way which is compatible with Lyx? I tend to use a lot of \DeclareMathOperator commands in the preamble, for example. I've avoided the Lyx macro stuff so far because it has seemed to me to be *too* document specific. I don't know if it actually is, but I haven't found that information in the preliminary searches I've conducted. Any general comments on the best way to organize and include preamble material in a way which is compatible with Lyx would also be appreciated.
Re: math macros via LaTex preamble
On 07/20/2012 03:40 AM, Guenter Milde wrote: Also, math-macros are document specific - defining a math-macro in one document does not make it available in other ones. This is why my documents include a file of commonly used math macros -- just like I \input a file with commonly used preamble definitions in my LaTeX documents. Could you elaborate on the best way to include a file of commonly-used math macros, in a way which is compatible with Lyx? I tend to use a lot of \DeclareMathOperator commands in the preamble, for example. I've avoided the Lyx macro stuff so far because it has seemed to me to be *too* document specific. I don't know if it actually is, but I haven't found that information in the preliminary searches I've conducted. Any general comments on the "best" way to organize and include preamble material in a way which is compatible with Lyx would also be appreciated.
Re: math macros via LaTex preamble
On 2012-07-19, ralston wrote: I've got 10 years experience and 200 documents using LaTex with heavy math. Like everyone else I paste a clot of \newcommands into my Latex preamble without looking at it. My student has recommended Lyx, which I appreciate has many great features. I really want to like LyX. What a great concept. And yet... I find LyX math macros an absolutely horror. Why construct LyX to ignore macros in an imported LaTex preamble? Why defeat the most popular usage, and why not write something to properly automate the import? Because (La)TeX is a macro language that is miles more difficult to machine-parse than, say, XML. This is why the focus is on *generating* (writing/editing) documents that can be typeset with LaTeX (and/or HTML, Docbook, ...). LyX is *not* a LaTeX editor. Depending on your needs, existing documents and willingness to change habits, LyX may boost your productivity or be not the tool of your choice. It's a fact that exchanging LaTex with collaborators and opening old files needs to be automated. Yet Lyx wants me to paste macros by hand into every document, or else create subsidiary file systems I don't understand with no examples of what to do. I don't understand where LyX wants you to paste macros by hand... Why not automate that? This is a task too difficult to be done completely automatically. LyX did improve and specific suggestions for further improvement are welcome. Once I create a macro it won't update (for me!) in an imported LaTeX document, and the error messages are too non-specific to debug. The math-macros are really just for math-mode commands. This is why LyX does not convert preamble definitions to math-macros - is just does not know whether they are math-mode or text-mode (or both). (See your list below for a mix of math-mode and text-mode commands.) Also, math-macros are document specific - defining a math-macro in one document does not make it available in other ones. This is why my documents include a file of commonly used math macros -- just like I \input a file with commonly used preamble definitions in my LaTeX documents. Import also seems to forget a lot of small things like ^{}, _{} and matrix formats that are real work to fix. Yes, there are many non-supported ways to write things in LaTeX. I've only got about 10 macros to get running, but LyX has fought me all the way. I hope I'm in the wrong and working with basic concept errors someone could straighten out... and why doesn't LyX post at least one completely running imported mathy FILE example, rather than abstract principleswhile my excuse is a definite lack of interest in working with things that create more work than they save. Frustrated by hours or wasted time, I probably seem cranky. I do understand your frustration. Please keep in mind that LyX is not an enterprise solution promising easy LaTeX for all but a volunteer effort to create a document processor that matches the expectations and ideals of its developers with much input from the users. As such, it may be not the right tool for you - at least it needs more patience for things that might seem easy to you but are very complex from the point of a programmer... In case I've not been too rude, here's some macros, which LyX gurus will not find profound; I will surely either convert with enthusiasm to LyX, or forbid all my students and contacts to ever touch it, depending on how the importing and exporting of latex with macros can be automated. I hope you will come to a more tempered evaluation of the program. Even if it is not the tool for you, it might be valuable for your students. \newcommand{\ab}{\allowbreak} \newcommand{\bit}{\begin{itemize}} \newcommand{\eit}{\end{itemize}} \newcommand{\im}{\item} \newcommand{\be}{\begin{equation}} \newcommand{\ee}{\end{equation}} \newcommand{\ba}{\begin{eqnarray}} \newcommand{\ea}{\end{eqnarray}} \newcommand{\nn}{\nonumber} \renewcommand{\bf}{\textbf} All of these are rather shortcut aliases for text mode. math-macro is not the right thing to emulate them. I would try to find out whether tex2lyx already can be configured to do a back-replacement (e.g. \bf - \textbf) before converting to LyX format or write a simple search-and replace script to do this in a preprocessing step. As you are not going to use these commands directly when writing in LyX, there is no need for supporting the aliases. \newcommand{\ra}{\rightarrow} \newcommand{\NN}{\vec \nabla} \def\slasha#1{\setbox0=\hbox{$#1$}#1\hskip-\wd0\hbox to\wd0{\hss\sl/\/\hss}} \def\slashb#1{\setbox0=\hbox{$#1$}#1\hskip-\wd0\dimen0=5pt\advance \dimen0 by-\ht0\advance\dimen0 by\dp0\lower0.5\dimen0\hbox to\wd0{\hss\sl/\/\hss}} These are (as far as I can see) real math macros, hence it may be sensible to define math-macros for them (if you want a nice look in LyX). However, it is possible to use them as is in math insets - it just does not look so nice with the red
Re: math macros via LaTex preamble
On 2012-07-19, ralston wrote: I've got 10 years experience and 200 documents using LaTex with heavy math. Like everyone else I paste a clot of \newcommands into my Latex preamble without looking at it. My student has recommended Lyx, which I appreciate has many great features. I really want to like LyX. What a great concept. And yet... I find LyX math macros an absolutely horror. Why construct LyX to ignore macros in an imported LaTex preamble? Why defeat the most popular usage, and why not write something to properly automate the import? Because (La)TeX is a macro language that is miles more difficult to machine-parse than, say, XML. This is why the focus is on *generating* (writing/editing) documents that can be typeset with LaTeX (and/or HTML, Docbook, ...). LyX is *not* a LaTeX editor. Depending on your needs, existing documents and willingness to change habits, LyX may boost your productivity or be not the tool of your choice. It's a fact that exchanging LaTex with collaborators and opening old files needs to be automated. Yet Lyx wants me to paste macros by hand into every document, or else create subsidiary file systems I don't understand with no examples of what to do. I don't understand where LyX wants you to paste macros by hand... Why not automate that? This is a task too difficult to be done completely automatically. LyX did improve and specific suggestions for further improvement are welcome. Once I create a macro it won't update (for me!) in an imported LaTeX document, and the error messages are too non-specific to debug. The math-macros are really just for math-mode commands. This is why LyX does not convert preamble definitions to math-macros - is just does not know whether they are math-mode or text-mode (or both). (See your list below for a mix of math-mode and text-mode commands.) Also, math-macros are document specific - defining a math-macro in one document does not make it available in other ones. This is why my documents include a file of commonly used math macros -- just like I \input a file with commonly used preamble definitions in my LaTeX documents. Import also seems to forget a lot of small things like ^{}, _{} and matrix formats that are real work to fix. Yes, there are many non-supported ways to write things in LaTeX. I've only got about 10 macros to get running, but LyX has fought me all the way. I hope I'm in the wrong and working with basic concept errors someone could straighten out... and why doesn't LyX post at least one completely running imported mathy FILE example, rather than abstract principleswhile my excuse is a definite lack of interest in working with things that create more work than they save. Frustrated by hours or wasted time, I probably seem cranky. I do understand your frustration. Please keep in mind that LyX is not an enterprise solution promising easy LaTeX for all but a volunteer effort to create a document processor that matches the expectations and ideals of its developers with much input from the users. As such, it may be not the right tool for you - at least it needs more patience for things that might seem easy to you but are very complex from the point of a programmer... In case I've not been too rude, here's some macros, which LyX gurus will not find profound; I will surely either convert with enthusiasm to LyX, or forbid all my students and contacts to ever touch it, depending on how the importing and exporting of latex with macros can be automated. I hope you will come to a more tempered evaluation of the program. Even if it is not the tool for you, it might be valuable for your students. \newcommand{\ab}{\allowbreak} \newcommand{\bit}{\begin{itemize}} \newcommand{\eit}{\end{itemize}} \newcommand{\im}{\item} \newcommand{\be}{\begin{equation}} \newcommand{\ee}{\end{equation}} \newcommand{\ba}{\begin{eqnarray}} \newcommand{\ea}{\end{eqnarray}} \newcommand{\nn}{\nonumber} \renewcommand{\bf}{\textbf} All of these are rather shortcut aliases for text mode. math-macro is not the right thing to emulate them. I would try to find out whether tex2lyx already can be configured to do a back-replacement (e.g. \bf - \textbf) before converting to LyX format or write a simple search-and replace script to do this in a preprocessing step. As you are not going to use these commands directly when writing in LyX, there is no need for supporting the aliases. \newcommand{\ra}{\rightarrow} \newcommand{\NN}{\vec \nabla} \def\slasha#1{\setbox0=\hbox{$#1$}#1\hskip-\wd0\hbox to\wd0{\hss\sl/\/\hss}} \def\slashb#1{\setbox0=\hbox{$#1$}#1\hskip-\wd0\dimen0=5pt\advance \dimen0 by-\ht0\advance\dimen0 by\dp0\lower0.5\dimen0\hbox to\wd0{\hss\sl/\/\hss}} These are (as far as I can see) real math macros, hence it may be sensible to define math-macros for them (if you want a nice look in LyX). However, it is possible to use them as is in math insets - it just does not look so nice with the red
Re: math macros via LaTex preamble
On 2012-07-19, ralston wrote: > I've got 10 years experience and 200 documents using LaTex with heavy > math. Like everyone else I paste a clot of \newcommands into my Latex > preamble without looking at it. > My student has recommended Lyx, which I appreciate has many great > features. I really want to like LyX. What a great concept. And > yet... I find LyX math macros an absolutely horror. Why construct LyX > to ignore macros in an imported LaTex preamble? Why defeat the most > popular usage, and why not write something to properly automate the > import? Because (La)TeX is a macro language that is miles more difficult to machine-parse than, say, XML. This is why the focus is on *generating* (writing/editing) documents that can be typeset with LaTeX (and/or HTML, Docbook, ...). LyX is *not* a "LaTeX editor". Depending on your needs, existing documents and willingness to change habits, LyX may boost your productivity or be not the tool of your choice. > It's a fact that exchanging LaTex with collaborators and opening old > files needs to be automated. Yet Lyx wants me to paste macros by hand > into every document, or else create subsidiary file systems I don't > understand with no examples of what to do. I don't understand where LyX wants you to paste macros by hand... > Why not automate that? This is a task too difficult to be done completely automatically. LyX did improve and specific suggestions for further improvement are welcome. > Once I create a macro it won't update (for me!) in an imported LaTeX > document, and the error messages are too non-specific to debug. The math-macros are really just for math-mode commands. This is why LyX does not convert preamble definitions to "math-macros" - is just does not know whether they are math-mode or text-mode (or both). (See your list below for a mix of math-mode and text-mode commands.) Also, math-macros are document specific - defining a math-macro in one document does not make it available in other ones. This is why my documents include a file of commonly used math macros -- just like I \input a file with commonly used preamble definitions in my LaTeX documents. > Import also seems to forget a lot of small things like "^{}, _{} " and > matrix formats that are real work to fix. Yes, there are many non-supported ways to write things in LaTeX. > I've only got about 10 macros to get running, but LyX has fought me all > the way. I hope I'm in the wrong and working with basic concept errors > someone could straighten out... and why doesn't LyX post at least one > completely running imported mathy FILE example, rather than abstract > principleswhile my excuse is a definite lack of interest in working > with things that create more work than they save. Frustrated by hours > or wasted time, I probably seem cranky. I do understand your frustration. Please keep in mind that LyX is not an enterprise solution promising "easy LaTeX for all" but a volunteer effort to create a document processor that matches the expectations and ideals of its developers with much input from the users. As such, it may be not the right tool for you - at least it needs more patience for things that might seem easy to you but are very complex from the point of a programmer... > In case I've not been too rude, here's some macros, which LyX gurus > will not find profound; I will surely either convert with enthusiasm to > LyX, or forbid all my students and contacts to ever touch it, depending > on how the importing and exporting of latex with macros can be > automated. I hope you will come to a more tempered evaluation of the program. Even if it is not the tool for you, it might be valuable for your students. > \newcommand{\ab}{\allowbreak} \newcommand{\bit}{\begin{itemize}} > \newcommand{\eit}{\end{itemize}} \newcommand{\im}{\item} > \newcommand{\be}{\begin{equation}} \newcommand{\ee}{\end{equation}} > \newcommand{\ba}{\begin{eqnarray}} \newcommand{\ea}{\end{eqnarray}} > \newcommand{\nn}{\nonumber} \renewcommand{\bf}{\textbf} All of these are rather shortcut aliases for text mode. "math-macro" is not the right thing to emulate them. I would try to find out whether tex2lyx already can be configured to do a back-replacement (e.g. \bf -> \textbf) before converting to LyX format or write a simple search-and replace script to do this in a preprocessing step. As you are not going to use these commands directly when writing in LyX, there is no need for supporting the aliases. > \newcommand{\ra}{\rightarrow} \newcommand{\NN}{\vec \nabla} > \def\slasha#1{\setbox0=\hbox{$#1$}#1\hskip-\wd0\hbox > to\wd0{\hss\sl/\/\hss}} > \def\slashb#1{\setbox0=\hbox{$#1$}#1\hskip-\wd0\dimen0=5pt\advance > \dimen0 by-\ht0\advance\dimen0 by\dp0\lower0.5\dimen0\hbox > to\wd0{\hss\sl/\/\hss}} These are (as far
math macros via LaTex preamble
I've got 10 years experience and 200 documents using LaTex with heavy math. Like everyone else I paste a clot of \newcommands into my Latex preamble without looking at it. My student has recommended Lyx, which I appreciate has many great features. I really want to like LyX. What a great concept. And yet... I find LyX math macros an absolutely horror. Why construct LyX to ignore macros in an imported LaTex preamble? Why defeat the most popular usage, and why not write something to properly automate the import? It's a fact that exchanging LaTex with collaborators and opening old files needs to be automated. Yet Lyx wants me to paste macros by hand into every document, or else create subsidiary file systems I don't understand with no examples of what to do. Why not automate that? Once I create a macro it won't update (for me!) in an imported LaTeX document, and the error messages are too non-specific to debug. Import also seems to forget a lot of small things like ^{}, _{} and matrix formats that are real work to fix. I've only got about 10 macros to get running, but LyX has fought me all the way. I hope I'm in the wrong and working with basic concept errors someone could straighten out... and why doesn't LyX post at least one completely running imported mathy FILE example, rather than abstract principleswhile my excuse is a definite lack of interest in working with things that create more work than they save. Frustrated by hours or wasted time, I probably seem cranky. In case I've not been too rude, here's some macros, which LyX gurus will not find profound; I will surely either convert with enthusiasm to LyX, or forbid all my students and contacts to ever touch it, depending on how the importing and exporting of latex with macros can be automated. \newcommand{\ab}{\allowbreak} \newcommand{\bit}{\begin{itemize}} \newcommand{\eit}{\end{itemize}} \newcommand{\im}{\item} \newcommand{\be}{\begin{equation}} \newcommand{\ee}{\end{equation}} \newcommand{\ba}{\begin{eqnarray}} \newcommand{\ea}{\end{eqnarray}} \newcommand{\nn}{\nonumber} \renewcommand{\bf}{\textbf} \newcommand{\ra}{\rightarrow} \newcommand{\NN}{\vec \nabla} \def\slasha#1{\setbox0=\hbox{$#1$}#1\hskip-\wd0\hbox to\wd0{\hss\sl/\/\hss}} \def\slashb#1{\setbox0=\hbox{$#1$}#1\hskip-\wd0\dimen0=5pt\advance \dimen0 by-\ht0\advance\dimen0 by\dp0\lower0.5\dimen0\hbox to\wd0{\hss\sl/\/\hss}} John P -- View this message in context: http://lyx.475766.n2.nabble.com/math-macros-via-LaTex-preamble-tp7580151.html Sent from the LyX - Users mailing list archive at Nabble.com.
math macros via LaTex preamble
I've got 10 years experience and 200 documents using LaTex with heavy math. Like everyone else I paste a clot of \newcommands into my Latex preamble without looking at it. My student has recommended Lyx, which I appreciate has many great features. I really want to like LyX. What a great concept. And yet... I find LyX math macros an absolutely horror. Why construct LyX to ignore macros in an imported LaTex preamble? Why defeat the most popular usage, and why not write something to properly automate the import? It's a fact that exchanging LaTex with collaborators and opening old files needs to be automated. Yet Lyx wants me to paste macros by hand into every document, or else create subsidiary file systems I don't understand with no examples of what to do. Why not automate that? Once I create a macro it won't update (for me!) in an imported LaTeX document, and the error messages are too non-specific to debug. Import also seems to forget a lot of small things like ^{}, _{} and matrix formats that are real work to fix. I've only got about 10 macros to get running, but LyX has fought me all the way. I hope I'm in the wrong and working with basic concept errors someone could straighten out... and why doesn't LyX post at least one completely running imported mathy FILE example, rather than abstract principleswhile my excuse is a definite lack of interest in working with things that create more work than they save. Frustrated by hours or wasted time, I probably seem cranky. In case I've not been too rude, here's some macros, which LyX gurus will not find profound; I will surely either convert with enthusiasm to LyX, or forbid all my students and contacts to ever touch it, depending on how the importing and exporting of latex with macros can be automated. \newcommand{\ab}{\allowbreak} \newcommand{\bit}{\begin{itemize}} \newcommand{\eit}{\end{itemize}} \newcommand{\im}{\item} \newcommand{\be}{\begin{equation}} \newcommand{\ee}{\end{equation}} \newcommand{\ba}{\begin{eqnarray}} \newcommand{\ea}{\end{eqnarray}} \newcommand{\nn}{\nonumber} \renewcommand{\bf}{\textbf} \newcommand{\ra}{\rightarrow} \newcommand{\NN}{\vec \nabla} \def\slasha#1{\setbox0=\hbox{$#1$}#1\hskip-\wd0\hbox to\wd0{\hss\sl/\/\hss}} \def\slashb#1{\setbox0=\hbox{$#1$}#1\hskip-\wd0\dimen0=5pt\advance \dimen0 by-\ht0\advance\dimen0 by\dp0\lower0.5\dimen0\hbox to\wd0{\hss\sl/\/\hss}} John P -- View this message in context: http://lyx.475766.n2.nabble.com/math-macros-via-LaTex-preamble-tp7580151.html Sent from the LyX - Users mailing list archive at Nabble.com.
math macros via LaTex preamble
I've got 10 years experience and 200 documents using LaTex with heavy math. Like everyone else I paste a clot of \newcommands into my Latex preamble without looking at it. My student has recommended Lyx, which I appreciate has many great features. I really want to like LyX. What a great concept. And yet... I find LyX math macros an absolutely horror. Why construct LyX to ignore macros in an imported LaTex preamble? Why defeat the most popular usage, and why not write something to properly automate the import? It's a fact that exchanging LaTex with collaborators and opening old files needs to be automated. Yet Lyx wants me to paste macros by hand into every document, or else create subsidiary file systems I don't understand with no examples of what to do. Why not automate that? Once I create a macro it won't update (for me!) in an imported LaTeX document, and the error messages are too non-specific to debug. Import also seems to forget a lot of small things like "^{}, _{} " and matrix formats that are real work to fix. I've only got about 10 macros to get running, but LyX has fought me all the way. I hope I'm in the wrong and working with basic concept errors someone could straighten out... and why doesn't LyX post at least one completely running imported mathy FILE example, rather than abstract principleswhile my excuse is a definite lack of interest in working with things that create more work than they save. Frustrated by hours or wasted time, I probably seem cranky. In case I've not been too rude, here's some macros, which LyX gurus will not find profound; I will surely either convert with enthusiasm to LyX, or forbid all my students and contacts to ever touch it, depending on how the importing and exporting of latex with macros can be automated. \newcommand{\ab}{\allowbreak} \newcommand{\bit}{\begin{itemize}} \newcommand{\eit}{\end{itemize}} \newcommand{\im}{\item} \newcommand{\be}{\begin{equation}} \newcommand{\ee}{\end{equation}} \newcommand{\ba}{\begin{eqnarray}} \newcommand{\ea}{\end{eqnarray}} \newcommand{\nn}{\nonumber} \renewcommand{\bf}{\textbf} \newcommand{\ra}{\rightarrow} \newcommand{\NN}{\vec \nabla} \def\slasha#1{\setbox0=\hbox{$#1$}#1\hskip-\wd0\hbox to\wd0{\hss\sl/\/\hss}} \def\slashb#1{\setbox0=\hbox{$#1$}#1\hskip-\wd0\dimen0=5pt\advance \dimen0 by-\ht0\advance\dimen0 by\dp0\lower0.5\dimen0\hbox to\wd0{\hss\sl/\/\hss}} John P -- View this message in context: http://lyx.475766.n2.nabble.com/math-macros-via-LaTex-preamble-tp7580151.html Sent from the LyX - Users mailing list archive at Nabble.com.
Macros and preview in child documents (reborn)
I would like to know if the topic discussed in this thread: http://marc.info/?l=lyx-usersm=116195922003640w=2 has evolved since 2006. I have a lot of math macros defined on the preamble of a master document, which has several childs. When I process the document, the math macros are correctly parsed on the output (pdf) of all child documents, but instant preview does not display the correct layout for the macro. Usualy, it will only show a blank instead. A workaround I've found is to define the macros not on the master's preamble, but on its body, using LyX's function at Insert - Math - Macro. That way, the math expressions is correctly displayed on all child docs. Is there another way to do this? -- Rudi Gaelzer Department of Physics Institute of Physics and Mathematics Federal University of Pelotas BRAZIL Registered linux user # 153741
Re: Macros and preview in child documents (reborn)
On 05/08/2012 01:00 PM, Rudi Gaelzer wrote: I would like to know if the topic discussed in this thread: http://marc.info/?l=lyx-usersm=116195922003640w=2 has evolved since 2006. I have a lot of math macros defined on the preamble of a master document, which has several childs. When I process the document, the math macros are correctly parsed on the output (pdf) of all child documents, but instant preview does not display the correct layout for the macro. Usualy, it will only show a blank instead. A workaround I've found is to define the macros not on the master's preamble, but on its body, using LyX's function at Insert - Math - Macro. That way, the math expressions is correctly displayed on all child docs. If you want to define the macros manually in the preamble, then put them in a separate file, macros.tex, and include that file in the preamble of the master *and also in the children*. I think that should do it. But, as you note, if you use LyX's macro facility, all is handled properly. Richard
Macros and preview in child documents (reborn)
I would like to know if the topic discussed in this thread: http://marc.info/?l=lyx-usersm=116195922003640w=2 has evolved since 2006. I have a lot of math macros defined on the preamble of a master document, which has several childs. When I process the document, the math macros are correctly parsed on the output (pdf) of all child documents, but instant preview does not display the correct layout for the macro. Usualy, it will only show a blank instead. A workaround I've found is to define the macros not on the master's preamble, but on its body, using LyX's function at Insert - Math - Macro. That way, the math expressions is correctly displayed on all child docs. Is there another way to do this? -- Rudi Gaelzer Department of Physics Institute of Physics and Mathematics Federal University of Pelotas BRAZIL Registered linux user # 153741
Re: Macros and preview in child documents (reborn)
On 05/08/2012 01:00 PM, Rudi Gaelzer wrote: I would like to know if the topic discussed in this thread: http://marc.info/?l=lyx-usersm=116195922003640w=2 has evolved since 2006. I have a lot of math macros defined on the preamble of a master document, which has several childs. When I process the document, the math macros are correctly parsed on the output (pdf) of all child documents, but instant preview does not display the correct layout for the macro. Usualy, it will only show a blank instead. A workaround I've found is to define the macros not on the master's preamble, but on its body, using LyX's function at Insert - Math - Macro. That way, the math expressions is correctly displayed on all child docs. If you want to define the macros manually in the preamble, then put them in a separate file, macros.tex, and include that file in the preamble of the master *and also in the children*. I think that should do it. But, as you note, if you use LyX's macro facility, all is handled properly. Richard
Macros and preview in child documents (reborn)
I would like to know if the topic discussed in this thread: http://marc.info/?l=lyx-users=116195922003640=2 has evolved since 2006. I have a lot of math macros defined on the preamble of a master document, which has several childs. When I process the document, the math macros are correctly parsed on the output (pdf) of all child documents, but instant preview does not display the correct layout for the macro. Usualy, it will only show a blank instead. A workaround I've found is to define the macros not on the master's preamble, but on its body, using LyX's function at Insert -> Math -> Macro. That way, the math expressions is correctly displayed on all child docs. Is there another way to do this? -- Rudi Gaelzer Department of Physics Institute of Physics and Mathematics Federal University of Pelotas BRAZIL Registered linux user # 153741
Re: Macros and preview in child documents (reborn)
On 05/08/2012 01:00 PM, Rudi Gaelzer wrote: I would like to know if the topic discussed in this thread: http://marc.info/?l=lyx-users=116195922003640=2 has evolved since 2006. I have a lot of math macros defined on the preamble of a master document, which has several childs. When I process the document, the math macros are correctly parsed on the output (pdf) of all child documents, but instant preview does not display the correct layout for the macro. Usualy, it will only show a blank instead. A workaround I've found is to define the macros not on the master's preamble, but on its body, using LyX's function at Insert -> Math -> Macro. That way, the math expressions is correctly displayed on all child docs. If you want to define the macros manually in the preamble, then put them in a separate file, macros.tex, and include that file in the preamble of the master *and also in the children*. I think that should do it. But, as you note, if you use LyX's macro facility, all is handled properly. Richard
Re: Problem with optional arguments on macros
Your test file compiled correctly for me every time I tried (multiple tries within one LyX session, multiple LyX sessions, exported to .tex and compiled outside LyX). Paul
Re: Problem with optional arguments on macros
Your test file compiled correctly for me every time I tried (multiple tries within one LyX session, multiple LyX sessions, exported to .tex and compiled outside LyX). Paul
Re: Problem with optional arguments on macros
Your test file compiled correctly for me every time I tried (multiple tries within one LyX session, multiple LyX sessions, exported to .tex and compiled outside LyX). Paul
Problem with optional arguments on macros
test3.lyx Description: Binary data I'm having a problem with optional arguments on macros. They are sometimes written into the TeX file as non-optional (i.e., in {} instead of []), which causes them to be ignored by the TeX compiler. This appears to be random -- different instances of the same macro in the same document will render differently. If the instances are viewed unfolded, then it doesn't happen. (This is not a good solution, even as a workaround, since there is no way to unfold all the instances in a document at once.) Anyone had this problem, too, and know of a good workaround? I've attached a sample file. The problem may not show up the first time, so it should be compiled several times. Here are instructions for creating a sample with this problem: Open a new file, create a new macro, add 4 optional arguments, and then format the TeX however you want (I used {#1^{#2^{#3^{#4}}}). Now add a math environment and create an instance of the new command. Copy and paste a bunch of these, say, 20, on different lines. Compile several times. The problem will show up intermittently with different instances. Thanks! -Brandon
Problem with optional arguments on macros
test3.lyx Description: Binary data I'm having a problem with optional arguments on macros. They are sometimes written into the TeX file as non-optional (i.e., in {} instead of []), which causes them to be ignored by the TeX compiler. This appears to be random -- different instances of the same macro in the same document will render differently. If the instances are viewed unfolded, then it doesn't happen. (This is not a good solution, even as a workaround, since there is no way to unfold all the instances in a document at once.) Anyone had this problem, too, and know of a good workaround? I've attached a sample file. The problem may not show up the first time, so it should be compiled several times. Here are instructions for creating a sample with this problem: Open a new file, create a new macro, add 4 optional arguments, and then format the TeX however you want (I used {#1^{#2^{#3^{#4}}}). Now add a math environment and create an instance of the new command. Copy and paste a bunch of these, say, 20, on different lines. Compile several times. The problem will show up intermittently with different instances. Thanks! -Brandon
Problem with optional arguments on macros
test3.lyx Description: Binary data I'm having a problem with optional arguments on macros. They are sometimes written into the TeX file as non-optional (i.e., in {} instead of []), which causes them to be ignored by the TeX compiler. This appears to be random -- different instances of the same macro in the same document will render differently. If the instances are viewed unfolded, then it doesn't happen. (This is not a good solution, even as a workaround, since there is no way to unfold all the instances in a document at once.) Anyone had this problem, too, and know of a good workaround? I've attached a sample file. The problem may not show up the first time, so it should be compiled several times. Here are instructions for creating a sample with this problem: Open a new file, create a new macro, add 4 optional arguments, and then format the TeX however you want (I used {#1^{#2^{#3^{#4}}}). Now add a math environment and create an instance of the new command. Copy and paste a bunch of these, say, 20, on different lines. Compile several times. The problem will show up intermittently with different instances. Thanks! -Brandon
Re: Math macros inside child documents
On 2011-05-10, Diego Queiroz wrote: For truly consistent behaviour, we would have to disable stand-alone compilation of documents setting a master (except for included (vs. input) documents). This is a strong restriction. But the only one for truly consistent behaviour. If you want to export stand-alone, uncheck the master setting. With this, in a document with thousand of pages I will obligated to generate all pages? I do not agree. No, you can *include* the sub-documents and use the includeonly feature to compile a subset of sub-documents where LaTeX will ensure (almost) correct page numbers and references and LyX will use the parent doc settings instead of the child-doc ones. Actually, I regularly compile stand-alone child docs (to save time on checking the appearance in the output). I have set up a stand-alone branch for math-macros and bibliography and I can live with the question marks in the references. This is another subject, but let's understand the question marks are a problem to be solved too. This is solved by using include and includeonly instead of stand-alone compilation. I do not think that LyX must re-implement this feature. I think it would be good if LyX doesn't generate so much errors, Actually, *you* generate the error -- a reference to a label that does not exist in the document. Setting a master (currently) is just an editing hint but does not change the way a document is compiled stand-alone. Maybe there could be better visual feedback in LyX, but this requires that the buffer is aware of the intended use: a) compile the master b) compile the master but includeonly the child c) compile the child stand-alone Maybe a configurable default-action for the compile buttons (and View... menu items) could trigger the matching feedback in the buffer. (With the default-default action for documents that set the master and are input- a) are included - b) ) but I vote against the generation of documents with wrong content (i.e. the question marks). Otherwise, LyX could not stop on the first error, as it already do today. That is, currently, if a error is found, LyX just stops and warns the user. Even if the document can still be generated by LaTeX. We didn't define LyX to just continue and see what you get because we don't want this, right? I am not sure about this. If I remember right, the LaTeX run is done in nonstopmode but the output not opened in a viewer - I'd like a show output anyway button in the error message dialogue. Having a look at the output is sometimes far more helpful than TeX error messages. In the worst case, I'm in favor of a warning to the user about these wrong things. I prefer this continue but warn, so that e.g. unresolved references [??] do not go unnoticed but do not prevent me from checking page breaks or the position of floats. ... Günter
Re: Math macros inside child documents
But the only one for truly consistent behaviour. If you want to export stand-alone, uncheck the master setting. Even if the master setting is not set in the child, LyX still display all macros perfectly if the master document is open. My complaint is this: if LyX is able to interpret things and display them in the editor, it should be able to generate the output. That's all. Specially if this problem is not present in older versions. No, you can *include* the sub-documents and use the includeonly feature to compile a subset of sub-documents where LaTeX will ensure (almost) correct page numbers and references and LyX will use the parent doc settings instead of the child-doc ones. What happens when you set the include only option? The whole document is generated and the pages are ommited or it handle the pages in a more fashioned way? I am asking this because, if LyX handles it in a good way, we can change the action of the view button of child docs to automatically generate the master document including only the active document. This appears suitable for me and is better than blocking. Actually, *you* generate the error -- a reference to a label that does not exist in the document. Setting a master (currently) is just an editing hint but does not change the way a document is compiled stand-alone. If LyX options were consistent, it won't let me generate such errors. It doesn't really matter if I am responsible for them or not: computers are here to handle problems we don't want to deal with, right? They are not here to introduce another class of problems (although I agree this is not always true :-) . I am not sure about this. If I remember right, the LaTeX run is done in nonstopmode but the output not opened in a viewer - I'd like a show output anyway button in the error message dialogue. Having a look at the output is sometimes far more helpful than TeX error messages. A show output anyway button would be great. However, if LyX consistency were assured, there's no need for it (expect when using ERT). --- Diego Queiroz
Re: Math macros inside child documents
On 2011-05-11, Diego Queiroz wrote: [-- Type: text/plain, Encoding: --] But the only one for truly consistent behaviour. If you want to export stand-alone, uncheck the master setting. Even if the master setting is not set in the child, LyX still display all macros perfectly if the master document is open. This is a bug. (Around LyX 1.4, math-macros were resolved in any open buffer - related or not.) My complaint is this: if LyX is able to interpret things and display them in the editor, it should be able to generate the output. That's all. Specially if this problem is not present in older versions. Oh no. If LyX is able to interpret a label defined in some other document but not in the current one, I would not expect this to work in LaTeX. Why should math-macros be different? No, you can *include* the sub-documents and use the includeonly feature to compile a subset of sub-documents where LaTeX will ensure (almost) correct page numbers and references and LyX will use the parent doc settings instead of the child-doc ones. What happens when you set the include only option? The whole document is generated and the pages are ommited or it handle the pages in a more fashioned way? TeX \include is specially designed for the master/child concept. Read about it in the (La)TeX docs. http://www.tex.ac.uk/cgi-bin/texfaq2html?label=include I am asking this because, if LyX handles it in a good way, we can change the action of the view button of child docs to automatically generate the master document including only the active document. This appears suitable for me and is better than blocking. This was my suggestion for included documents setting a master, while input document setting a master would defaut to compile/view/export master. However, I also suggested to use this as *defaults* - allowing the user to override the consistent behaviour in favour of flexibility. Actually, *you* generate the error -- a reference to a label that does not exist in the document. Setting a master (currently) is just an editing hint but does not change the way a document is compiled stand-alone. If LyX options were consistent, it won't let me generate such errors. This is why I wrote what needed to be done for true/strong consistency: you cannot compile a *.tex document designed for inclusion as a stand-alone document. I prefer to live with some amount of inconsistency because otherwise I would have to use ERT for references to labels I know exist but LyX doesn't. A show output anyway button would be great. However, if LyX consistency were assured, there's no need for it (expect when using ERT). ... or the LaTeX preamble or an outdated TeX distribution or a package combination with conflicts or ... Günter
Re: Math macros inside child documents
A show output anyway button would be great. However, if LyX consistency were assured, there's no need for it (expect when using ERT). ... or the LaTeX preamble (1) or an outdated TeX distribution (2) or a package combination with conflicts (3) or ... (?) Günter I repeat: if, and only if, LyX consistency were assured, there's no need for such option (except when using ERT). What means: 1) In LyX, the LaTeX preamble is an alternative to ERT but it has the same purpose. So any LaTeX code in LyX will always be a problem to consistency. If this is your point, I agree with you. 2) In an ideal scenario, LyX could check the LaTeX distribution to see what resources are available. So an outdated LaTeX should not be a problem. 3) Currently LyX already handles many known packages conflicts. Since all LyX resources are packages mapped to menu commands, every new package to be supported should be checked for possible conflicts with all the existent ones. When this is not possible, LyX should handle the problem in some way (like preventing the user of using them together). ?) Since these problems are solved, I cannot imagine another problem that is not related to ERT, file corruption and hardware problems. Otherwise, LyX can handle it. Actually, ERTs does exist only to keep LyX flexible, but the ERT goes against its proposal. Anyway, let's give up this discussion. It is leading to nowhere. We're flaming the mailing list. Sorry for this. --- Diego Queiroz