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: 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
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.
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
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
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
Re: Math macros inside child documents
On 2011-05-09, Diego Queiroz wrote: But what if you really want to compile it as a standalone document? People do this. Richard But if it was really a standalone document, I would have to unset master document property, right? ... I am just looking for a more user oriented behavior. I mean, if I can see everything right on the screen, what's the problem? This is how I feel about the current behavior. LyX is handling everything on the editor, since all math macros are interpreted correctly when I open any document, but I can't generate the file because of its internal structure. We should try to avoid consistency errors in LyX. If people decide to use ERT, we should expect unwanted behavior, but in a document using only LyX resources, it must never generate errors (or they should be rare, at least), doesn't matter what the user decides to do. For truly consistent behaviour, we would have to disable stand-alone compilation of documents setting a master (except for included (vs. input) documents). Günter
Re: Math macros inside child documents
Guenter Milde wrote: For truly consistent behaviour, we would have to disable stand-alone compilation of documents setting a master (except for included (vs. input) documents). Why this? I have many documents with a master set that get compiled stand- alone from time to time and should _not_ inherit anything from the master then. Jürgen
Re: Math macros inside child documents
On 2011-05-10, Jürgen Spitzmüller wrote: Guenter Milde wrote: For truly consistent behaviour, we would have to disable stand-alone compilation of documents setting a master (except for included (vs. input) documents). Why this? I have many documents with a master set that get compiled stand- alone from time to time and should _not_ inherit anything from the master then. Because the OP complained that it is incosistent to show math-macro expansions in the child doc but not make them available in stand-alone compilation. The same argument would hold for references to sections, equations, tables and figures in other parts of the document. 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. The above was just stating the pure solution to the OPs report. However, I vote to keep things as-is, because: practicality beats purity. Just make it very clear in the documentation that parent-document features are non-available in the child if compiled stand-alone (without include feature) even if rendered in the LyX window - this is a feature. (After switching to LyX 2 I will try with the include feature.) Günter
Re: Math macros inside child documents
On 05/10/2011 09:09 AM, Guenter Milde wrote: On 2011-05-10, Jürgen Spitzmüller wrote: Guenter Milde wrote: For truly consistent behaviour, we would have to disable stand-alone compilation of documents setting a master (except for included (vs. input) documents). Why this? I have many documents with a master set that get compiled stand- alone from time to time and should _not_ inherit anything from the master then. Because the OP complained that it is incosistent to show math-macro expansions in the child doc but not make them available in stand-alone compilation. The same argument would hold for references to sections, equations, tables and figures in other parts of the document. 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. The above was just stating the pure solution to the OPs report. However, I vote to keep things as-is, because: practicality beats purity. Just make it very clear in the documentation that parent-document features are non-available in the child if compiled stand-alone (without include feature) even if rendered in the LyX window - this is a feature. We did establish that this is a change from 1.6.x, where parent macros are written to the child. That was not intentional, and the behavior depends upon the setting of EXPORT_IN_THREAD. We can keep it as it is, but then we should make it consistent (and could remove useless code). Richard
Re: Math macros inside child documents
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. With this, in a document with thousand of pages I will obligated to generate all pages? I do not agree. 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. I think it would be good if LyX doesn't generate so much errors, 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? In the worst case, I'm in favor of a warning to the user about these wrong things. One reason is because I already submited a work with those ??. My fault indeed, but LyX could warn me anyway. ;-) Just make it very clear in the documentation that parent-document features are non-available in the child if compiled stand-alone (without include feature) even if rendered in the LyX window - this is a feature. We did establish that this is a change from 1.6.x, where parent macros are written to the child. That was not intentional, and the behavior depends upon the setting of EXPORT_IN_THREAD. We can keep it as it is, but then we should make it consistent (and could remove useless code). There are two things to note here: 1st: LyX interprets macros very well. It doesn't matter where they are (child/master/etc). If the documents are linked, LyX handles it in the screen. Fact. IMO, if it handles the content to the screen it should handle to the output. 2nd: AFAIK this feature was supported in later versions (I did not tested by myself, but people in this thread said it work). I won't be surprised if someone decide to stay with LyX 1.6 just because this feature was removed. Or just because I am not able to compile my old doc anymore or any other complaints. Cheers, --- Diego Queiroz
Re: Math macros inside child documents
On 2011-05-09, Diego Queiroz wrote: But what if you really want to compile it as a standalone document? People do this. Richard But if it was really a standalone document, I would have to unset master document property, right? ... I am just looking for a more user oriented behavior. I mean, if I can see everything right on the screen, what's the problem? This is how I feel about the current behavior. LyX is handling everything on the editor, since all math macros are interpreted correctly when I open any document, but I can't generate the file because of its internal structure. We should try to avoid consistency errors in LyX. If people decide to use ERT, we should expect unwanted behavior, but in a document using only LyX resources, it must never generate errors (or they should be rare, at least), doesn't matter what the user decides to do. For truly consistent behaviour, we would have to disable stand-alone compilation of documents setting a master (except for included (vs. input) documents). Günter
Re: Math macros inside child documents
Guenter Milde wrote: For truly consistent behaviour, we would have to disable stand-alone compilation of documents setting a master (except for included (vs. input) documents). Why this? I have many documents with a master set that get compiled stand- alone from time to time and should _not_ inherit anything from the master then. Jürgen
Re: Math macros inside child documents
On 2011-05-10, Jürgen Spitzmüller wrote: Guenter Milde wrote: For truly consistent behaviour, we would have to disable stand-alone compilation of documents setting a master (except for included (vs. input) documents). Why this? I have many documents with a master set that get compiled stand- alone from time to time and should _not_ inherit anything from the master then. Because the OP complained that it is incosistent to show math-macro expansions in the child doc but not make them available in stand-alone compilation. The same argument would hold for references to sections, equations, tables and figures in other parts of the document. 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. The above was just stating the pure solution to the OPs report. However, I vote to keep things as-is, because: practicality beats purity. Just make it very clear in the documentation that parent-document features are non-available in the child if compiled stand-alone (without include feature) even if rendered in the LyX window - this is a feature. (After switching to LyX 2 I will try with the include feature.) Günter
Re: Math macros inside child documents
On 05/10/2011 09:09 AM, Guenter Milde wrote: On 2011-05-10, Jürgen Spitzmüller wrote: Guenter Milde wrote: For truly consistent behaviour, we would have to disable stand-alone compilation of documents setting a master (except for included (vs. input) documents). Why this? I have many documents with a master set that get compiled stand- alone from time to time and should _not_ inherit anything from the master then. Because the OP complained that it is incosistent to show math-macro expansions in the child doc but not make them available in stand-alone compilation. The same argument would hold for references to sections, equations, tables and figures in other parts of the document. 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. The above was just stating the pure solution to the OPs report. However, I vote to keep things as-is, because: practicality beats purity. Just make it very clear in the documentation that parent-document features are non-available in the child if compiled stand-alone (without include feature) even if rendered in the LyX window - this is a feature. We did establish that this is a change from 1.6.x, where parent macros are written to the child. That was not intentional, and the behavior depends upon the setting of EXPORT_IN_THREAD. We can keep it as it is, but then we should make it consistent (and could remove useless code). Richard
Re: Math macros inside child documents
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. With this, in a document with thousand of pages I will obligated to generate all pages? I do not agree. 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. I think it would be good if LyX doesn't generate so much errors, 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? In the worst case, I'm in favor of a warning to the user about these wrong things. One reason is because I already submited a work with those ??. My fault indeed, but LyX could warn me anyway. ;-) Just make it very clear in the documentation that parent-document features are non-available in the child if compiled stand-alone (without include feature) even if rendered in the LyX window - this is a feature. We did establish that this is a change from 1.6.x, where parent macros are written to the child. That was not intentional, and the behavior depends upon the setting of EXPORT_IN_THREAD. We can keep it as it is, but then we should make it consistent (and could remove useless code). There are two things to note here: 1st: LyX interprets macros very well. It doesn't matter where they are (child/master/etc). If the documents are linked, LyX handles it in the screen. Fact. IMO, if it handles the content to the screen it should handle to the output. 2nd: AFAIK this feature was supported in later versions (I did not tested by myself, but people in this thread said it work). I won't be surprised if someone decide to stay with LyX 1.6 just because this feature was removed. Or just because I am not able to compile my old doc anymore or any other complaints. Cheers, --- Diego Queiroz
Re: Math macros inside child documents
On 2011-05-09, Diego Queiroz wrote: >> But what if you really want to compile it as a standalone document? >> People do this. >> Richard > But if it was really a standalone document, I would have to unset master > document property, right? ... > I am just looking for a more "user oriented behavior". I mean, "if I can see > everything right on the screen, what's the problem?" > This is how I feel about the current behavior. LyX is handling everything on > the editor, since all math macros are interpreted correctly when I open any > document, but I can't generate the file because of its internal structure. > We should try to avoid consistency errors in LyX. If people decide to use > ERT, we should expect unwanted behavior, but in a document using only LyX > resources, it must never generate errors (or they should be rare, at least), > doesn't matter what the user decides to do. For truly consistent behaviour, we would have to disable stand-alone compilation of documents setting a master (except for "included" (vs. "input") documents). Günter
Re: Math macros inside child documents
Guenter Milde wrote: > For truly consistent behaviour, we would have to disable stand-alone > compilation of documents setting a master (except for "included" (vs. > "input") documents). Why this? I have many documents with a master set that get compiled stand- alone from time to time and should _not_ inherit anything from the master then. Jürgen
Re: Math macros inside child documents
On 2011-05-10, Jürgen Spitzmüller wrote: > Guenter Milde wrote: >> For truly consistent behaviour, we would have to disable stand-alone >> compilation of documents setting a master (except for "included" (vs. >> "input") documents). > Why this? I have many documents with a master set that get compiled stand- > alone from time to time and should _not_ inherit anything from the master > then. Because the OP complained that it is incosistent to show math-macro expansions in the child doc but not make them available in stand-alone compilation. The same argument would hold for references to sections, equations, tables and figures in other parts of the document. 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. The above was just stating the "pure" solution to the OPs report. However, I vote to keep things as-is, because: "practicality beats purity". Just make it very clear in the documentation that parent-document features are non-available in the child if compiled stand-alone (without include feature) even if rendered in the LyX window - this is a feature. (After switching to LyX 2 I will try with the include feature.) Günter
Re: Math macros inside child documents
On 05/10/2011 09:09 AM, Guenter Milde wrote: > On 2011-05-10, Jürgen Spitzmüller wrote: >> Guenter Milde wrote: >>> For truly consistent behaviour, we would have to disable stand-alone >>> compilation of documents setting a master (except for "included" (vs. >>> "input") documents). >> Why this? I have many documents with a master set that get compiled stand- >> alone from time to time and should _not_ inherit anything from the master >> then. > Because the OP complained that it is incosistent to show math-macro > expansions in the child doc but not make them available in stand-alone > compilation. > > The same argument would hold for references to sections, equations, > tables and figures in other parts of the document. > > 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. > > The above was just stating the "pure" solution to the OPs report. > However, I vote to keep things as-is, because: "practicality beats > purity". > > Just make it very clear in the documentation that parent-document > features are non-available in the child if compiled stand-alone (without > include feature) even if rendered in the LyX window - this is a feature. > We did establish that this is a change from 1.6.x, where parent macros are written to the child. That was not intentional, and the behavior depends upon the setting of EXPORT_IN_THREAD. We can keep it as it is, but then we should make it consistent (and could remove useless code). Richard
Re: Math macros inside child documents
> > >>> 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. With this, in a document with thousand of pages I will obligated to generate all pages? I do not agree. > > 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. I think it would be good if LyX doesn't generate so much errors, 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? In the worst case, I'm in favor of a warning to the user about these "wrong" things. One reason is because I already submited a work with those "??". My fault indeed, but LyX could warn me anyway. ;-) > > Just make it very clear in the documentation that parent-document > > features are non-available in the child if compiled stand-alone (without > > include feature) even if rendered in the LyX window - this is a feature. > > > We did establish that this is a change from 1.6.x, where parent macros > are written to the child. That was not intentional, and the behavior > depends upon the setting of EXPORT_IN_THREAD. We can keep it as it is, > but then we should make it consistent (and could remove useless code). There are two things to note here: 1st: LyX interprets macros very well. It doesn't matter where they are (child/master/etc). If the documents are linked, LyX handles it in the screen. Fact. IMO, if it handles the content to the screen it should handle to the output. 2nd: AFAIK this feature was supported in later versions (I did not tested by myself, but people in this thread said it work). I won't be surprised if someone decide to stay with LyX 1.6 just because this "feature" was removed. Or just because "I am not able to compile my old doc anymore" or any other complaints. Cheers, --- Diego Queiroz
Math macros inside child documents
I'm not sure if this is a bug report or a feature request. Probably the second one. In LyX it's ok to define a Math Macro in a Master document and use it in a child one. It's also ok to use math macros that are defined in a child and use it in other child document. In both cases, I am able to view the Master document and it handles everything perfectly. But if I do so, I am unable to compile the child document alone. AFAIK the reason is simple: the child document doesn't have the math macros defined on its scope. And it doesn't really matter if the default master document is set or not. It simple doesn't work (at least, I don't know how to do without insert the math macros again, which in painful). My suggestion is to allow the generation of the childs alone. While working in the document, it's normal to compile only parts of the document instead of compile the whole set, so this feature would be very handy. Regards, --- Diego Queiroz
Re: Math macros inside child documents
On 05/09/2011 10:22 AM, Diego Queiroz wrote: I'm not sure if this is a bug report or a feature request. Probably the second one. In LyX it's ok to define a Math Macro in a Master document and use it in a child one. It's also ok to use math macros that are defined in a child and use it in other child document. In both cases, I am able to view the Master document and it handles everything perfectly. But if I do so, I am unable to compile the child document alone. AFAIK the reason is simple: the child document doesn't have the math macros defined on its scope. And it doesn't really matter if the default master document is set or not. It simple doesn't work (at least, I don't know how to do without insert the math macros again, which in painful). My suggestion is to allow the generation of the childs alone. While working in the document, it's normal to compile only parts of the document instead of compile the whole set, so this feature would be very handy. If you ask to compile just the child, then you are asking to compile it as a standalone document, so it is no surprise that this does not work. If you want to compile just one chapter as part of a larger document, then you need to use the \includeonly support, accessible from DocumentSettings. rh
Re: Math macros inside child documents
If you ask to compile just the child, then you are asking to compile it as a standalone document, so it is no surprise that this does not work. Exactly. :-) If you want to compile just one chapter as part of a larger document, then you need to use the \includeonly support, accessible from DocumentSettings. I was not aware of this feature. Thanks for the hint. But it is also painful to select the document I want to compile everytime. :/ When I am working in a document, I work on it as a standalone document, I don't handle with the Master document before I want to compile the whole set. Of course there are several workarounds, i.e you can create a document with all your macros and insert it on the beggining of all documents. This is a not so elegant solution, but it does the job. Probably one can suggest a better solution as well. But I really think LyX can do this automatically. Since LyX already stores all defined macros in somewhere for the editor, it is not so hard to dinamically include them in a document when needed. Cheers, Diego
Re: Math macros inside child documents
On 05/09/2011 11:05 AM, Diego Queiroz wrote: If you want to compile just one chapter as part of a larger document, then you need to use the \includeonly support, accessible from DocumentSettings. I was not aware of this feature. Thanks for the hint. It's new in 2.0.0. But it is also painful to select the document I want to compile everytime. :/ When I am working in a document, I work on it as a standalone document, I don't handle with the Master document before I want to compile the whole set. Of course there are several workarounds, i.e you can create a document with all your macros and insert it on the beggining of all documents. This is a not so elegant solution, but it does the job. Probably one can suggest a better solution as well. But I really think LyX can do this automatically. Since LyX already stores all defined macros in somewhere for the editor, it is not so hard to dinamically include them in a document when needed. But what if you really want to compile it as a standalone document? People do this. Richard
Re: Math macros inside child documents
But what if you really want to compile it as a standalone document? People do this. Richard But if it was really a standalone document, I would have to unset master document property, right? Anyway, in my case, the problem is that my child document with the macros also define Nomenclatures. When I include it on all files and decide to generate the Master document, the list of Nomenclatures repeats its entries several times (obviously because the entry was indeed included several times). I am just looking for a more user oriented behavior. I mean, if I can see everything right on the screen, what's the problem? This is how I feel about the current behavior. LyX is handling everything on the editor, since all math macros are interpreted correctly when I open any document, but I can't generate the file because of its internal structure. We should try to avoid consistency errors in LyX. If people decide to use ERT, we should expect unwanted behavior, but in a document using only LyX resources, it must never generate errors (or they should be rare, at least), doesn't matter what the user decides to do. Cheers, Diego
Re: Math macros inside child documents
On 09/05/2011 10:22 AM, Diego Queiroz wrote: I'm not sure if this is a bug report or a feature request. Probably the second one. In LyX it's ok to define a Math Macro in a Master document and use it in a child one. It's also ok to use math macros that are defined in a child and use it in other child document. In both cases, I am able to view the Master document and it handles everything perfectly. But if I do so, I am unable to compile the child document alone. AFAIK the reason is simple: the child document doesn't have the math macros defined on its scope. And it doesn't really matter if the default master document is set or not. It simple doesn't work (at least, I don't know how to do without insert the math macros again, which in painful). My suggestion is to allow the generation of the childs alone. While working in the document, it's normal to compile only parts of the document instead of compile the whole set, so this feature would be very handy. Regards, --- Diego Queiroz This works like a charm for me on 1.6.9 right now. My setup is Thesis.lyx: Frontmatter stuff Include: LyX-macros.lyx Table of Contents List of Tables List of Figures Include: Chapter-1.lyx Include: Chapter-2.lyx ... Start Appendix here Include: Appendix-1.lyx BibTeX Generated Bibliography Each child doc has the default master document set to Thesis.lyx and I use a branch named child only, which is activated in child docs but deactivated in the master, to include BibTeX bib in the childs. Math macros are defined in LyX-macros.lyx and are available when compiling each child individually without hassle. So, I do not experience your problem. However document settings and stuff that gets defined in the preamble need to be set in both master and child docs. -- Julien
Re: Math macros inside child documents
So, I do not experience your problem. However document settings and stuff that gets defined in the preamble need to be set in both master and child docs. -- Julien Actually, the answer is: yes, you do experience the very same problem. Otherwise you won't need to go after a workaround, right? :-) As I said before, I'm sure there are several ways to workaround this limitation (I am not searching for one). I just think we should focus on make LyX avoid these errors by itself. Cheers, --- Diego
Re: Math macros inside child documents
On 09/05/2011 1:44 PM, Diego Queiroz wrote: So, I do not experience your problem. However document settings and stuff that gets defined in the preamble need to be set in both master and child docs. -- Julien Actually, the answer is: yes, you do experience the very same problem. Otherwise you won't need to go after a workaround, right? :-) As I said before, I'm sure there are several ways to workaround this limitation (I am not searching for one). I just think we should focus on make LyX avoid these errors by itself. Cheers, --- Diego Which workaround? You said math macros don't work within child docs, I say they work for me. No workaround necessary. There must be something in your setup that we're missing at the moment and prevents math macros for working. Maybe you mean that the math macros in your preamble don't work? Regards, Julien
Re: Math macros inside child documents
On 09/05/2011 1:44 PM, Diego Queiroz wrote: So, I do not experience your problem. However document settings and stuff that gets defined in the preamble need to be set in both master and child docs. -- Julien Actually, the answer is: yes, you do experience the very same problem. Otherwise you won't need to go after a workaround, right? :-) As I said before, I'm sure there are several ways to workaround this limitation (I am not searching for one). I just think we should focus on make LyX avoid these errors by itself. Cheers, --- Diego Hi Diego, Thinking about this again, I'm guessing that one of the use x math package automatically option doesn't get triggered and is the cause of your child doc compilation failures. If that is the case then yes, LyX should detect that automatically, and yes, at the moment a workaround is needed: check use x math package in document settings. Regards, Julien
Re: Math macros inside child documents
Which workaround? You said math macros don't work within child docs, I say they work for me. No workaround necessary. Maybe I misunderstood you. I was citing your workaround to include bibtex in the childs. I use a branch named child only, which is activated in child docs but deactivated in the master Anyway, never mind. Sorry. Thinking about this again, I'm guessing that one of the use x math package automatically option doesn't get triggered and is the cause of your child doc compilation failures. If that is the case then yes, LyX should detect that automatically, and yes, at the moment a workaround is needed: check use x math package in document settings. I just tested and this is not enough. I am not able to generate child files in LyX 2.0 at all. If I include a simple macro in a document (the master), create another file (the child), link them and use the macro in the child. The standalone child don't compile, only the master document. Are you able to do this in LyX 1.6? If so, this is a bug report and not a feature request. Can someone confirm this / create ticket? I've attached two files: the child and the master document. I can't compile the child document. Can you try? Cheers, --- Diego child.lyx Description: Binary data master.lyx Description: Binary data
Re: Math macros inside child documents
On 09/05/2011 2:23 PM, Diego Queiroz wrote: Which workaround? You said math macros don't work within child docs, I say they work for me. No workaround necessary. Maybe I misunderstood you. I was citing your workaround to include bibtex in the childs. I use a branch named child only, which is activated in child docs but deactivated in the master Anyway, never mind. Sorry. Thinking about this again, I'm guessing that one of the use x math package automatically option doesn't get triggered and is the cause of your child doc compilation failures. If that is the case then yes, LyX should detect that automatically, and yes, at the moment a workaround is needed: check use x math package in document settings. I just tested and this is not enough. I am not able to generate child files in LyX 2.0 at all. If I include a simple macro in a document (the master), create another file (the child), link them and use the macro in the child. The standalone child don't compile, only the master document. Are you able to do this in LyX 1.6? If so, this is a bug report and not a feature request. Can someone confirm this / create ticket? I've attached two files: the child and the master document. I can't compile the child document. Can you try? Cheers, --- Diego Hi Diego, Yes I am able to do what you describe in 1.6. In your example child doc, you did not set the master setting, did you? But anyway, I corrected it and still in 2.1.0svn the compilation of the child is broken: Undefined control sequence \anymacro A bug. Regards, Julien
Re: Math macros inside child documents
On 05/09/2011 02:38 PM, Julien Rioux wrote: Yes I am able to do what you describe in 1.6. In your example child doc, you did not set the master setting, did you? But anyway, I corrected it and still in 2.1.0svn the compilation of the child is broken: Undefined control sequence \anymacro A bug. It's due to the fact that the clone of the child buffer has no parent. Enrico wins again. ;-) It would seem we must always clone the entire set of documents. I.e., start with: buf.masterBuffer()-clone(); or something to that effect. But then we need back a pointer to buf's clone, so clone() probably needs to return something like a map from Buffers to their clones. Note that, if we pass this around, we can perhaps avoid multiple clones of a single Buffer included multiple times, which I suspect we now have. Richard
Re: Math macros inside child documents
Yes I am able to do what you describe in 1.6. In your example child doc, you did not set the master setting, did you? Indeed. I was in a hurry and I forgot it. ;/ --- Diego Queiroz
Math macros inside child documents
I'm not sure if this is a bug report or a feature request. Probably the second one. In LyX it's ok to define a Math Macro in a Master document and use it in a child one. It's also ok to use math macros that are defined in a child and use it in other child document. In both cases, I am able to view the Master document and it handles everything perfectly. But if I do so, I am unable to compile the child document alone. AFAIK the reason is simple: the child document doesn't have the math macros defined on its scope. And it doesn't really matter if the default master document is set or not. It simple doesn't work (at least, I don't know how to do without insert the math macros again, which in painful). My suggestion is to allow the generation of the childs alone. While working in the document, it's normal to compile only parts of the document instead of compile the whole set, so this feature would be very handy. Regards, --- Diego Queiroz
Re: Math macros inside child documents
On 05/09/2011 10:22 AM, Diego Queiroz wrote: I'm not sure if this is a bug report or a feature request. Probably the second one. In LyX it's ok to define a Math Macro in a Master document and use it in a child one. It's also ok to use math macros that are defined in a child and use it in other child document. In both cases, I am able to view the Master document and it handles everything perfectly. But if I do so, I am unable to compile the child document alone. AFAIK the reason is simple: the child document doesn't have the math macros defined on its scope. And it doesn't really matter if the default master document is set or not. It simple doesn't work (at least, I don't know how to do without insert the math macros again, which in painful). My suggestion is to allow the generation of the childs alone. While working in the document, it's normal to compile only parts of the document instead of compile the whole set, so this feature would be very handy. If you ask to compile just the child, then you are asking to compile it as a standalone document, so it is no surprise that this does not work. If you want to compile just one chapter as part of a larger document, then you need to use the \includeonly support, accessible from DocumentSettings. rh