Re: Custom layout file: in preamble styles with custom latex commands
I figured out the problem: on the Mac LyX stores the UserDir under ~/Library/Application Support/LyX-. I still had version 2.0 and was editing my layout file in that folder, rather than the one in the 2.1 folder. I now works as expected. Thanks again. On Fri, Nov 14, 2014 at 3:46 AM, Jürgen Spitzmüller wrote: > Jürgen Spitzmüller wrote: > > > Is it possible that LyX caches layout files somewhere and it's not > picking > > > up a new version (I'm on OS X Mavericks with LyX 2.1.2.1 for what it's > > > worth). > > > > No. You are sure that you do not have a copy of the layout file which is > > used by LyX? > > Also assure that your document does not have a local layout that overwrites > the layout definition. > > Jürgen > -- Ernesto Posse Zeligsoft.com
Re: Custom layout file: in preamble styles with custom latex commands
Jürgen Spitzmüller wrote: > > Is it possible that LyX caches layout files somewhere and it's not picking > > up a new version (I'm on OS X Mavericks with LyX 2.1.2.1 for what it's > > worth). > > No. You are sure that you do not have a copy of the layout file which is > used by LyX? Also assure that your document does not have a local layout that overwrites the layout definition. Jürgen
Re: Custom layout file: in preamble styles with custom latex commands
Ernesto Posse wrote: > That's exactly what I tried but got exactly the same result as using > 'post:'. I think that for some reason, when I reconfigure and restart, LyX > is not catching the changes in the layout file. I've tried running it from > the command-line with different debug options, but I don't see anything > about it, other than a comment saying that it's loading layout files, but > not mention of whether it was successful or not. > > Is it possible that LyX caches layout files somewhere and it's not picking > up a new version (I'm on OS X Mavericks with LyX 2.1.2.1 for what it's > worth). No. You are sure that you do not have a copy of the layout file which is used by LyX? Jürgen
Re: Custom layout file: in preamble styles with custom latex commands
Thanks. Comments inline below. On Thu, Nov 13, 2014 at 9:57 AM, Jürgen Spitzmüller wrote: > 2014-11-13 15:38 GMT+01:00 Ernesto Posse: > >> Thanks. That is what I want to achieve and your example does accomplish >> this, but I don't understand why using the first form of "Argument" >> declaration in the layout file, without 'post:', the second argument to the >> command is always the text from the work area, this is, >> >> \command{arg1}{work area text}{arg2}{arg3} ... >> >> I understand that's what 'post:' does, but without it, I obtain the same >> result. What if I want to generate the following? >> >> \command{arg1}{arg2}{arg3}{work area text} >> > > If you do not use post:, you need to stick with the pre numbering, that is > > Argument 1 > >Mandatory 1 > >LabelString "CR number" > > EndArgument > >Argument 2 > >Mandatory 1 > >LabelString "Sub-Category" > > EndArgument > > Argument 3 > >LabelString "Subject Descriptor" > > EndArgument > > > That's exactly what I tried but got exactly the same result as using 'post:'. I think that for some reason, when I reconfigure and restart, LyX is not catching the changes in the layout file. I've tried running it from the command-line with different debug options, but I don't see anything about it, other than a comment saying that it's loading layout files, but not mention of whether it was successful or not. Is it possible that LyX caches layout files somewhere and it's not picking up a new version (I'm on OS X Mavericks with LyX 2.1.2.1 for what it's worth). > In my particular case, it seems to me that there is no particularly good >> reason why the "category" field should be treated differently than the >> others (CR code, sub-category, subject). >> > > Maybe you are looking for a flex inset rather than a style? > > I've read a bit about those, but I don't think so. I just need a plain command, and the documentation explicitly says that the output should be such that the work area text is the last argument to the command. > >> Also, why doesn't the "Mandatory 0" flag work? I would expect it to >> produce an argument enclosed in [...], not in {...}. >> > > > Works for me. Although it is superfluous (Mandatory is false by default). > > In your example it seems to work. I've no idea why it's not working for my other test files. The only difference seems to be that I'm not using a local layout. > Jürgen > > >> >> Thanks >> >> PS: The style I want to use is ACM small journals ( >> http://www.acm.org/publications/submissions/latex_style). I'm not sure >> if it's the same as the one for SIG proceedings, but I'm guessing there >> will be some differences. >> > > -- Ernesto Posse Zeligsoft.com
Re: Custom layout file: in preamble styles with custom latex commands
2014-11-13 15:38 GMT+01:00 Ernesto Posse: > Thanks. That is what I want to achieve and your example does accomplish > this, but I don't understand why using the first form of "Argument" > declaration in the layout file, without 'post:', the second argument to the > command is always the text from the work area, this is, > > \command{arg1}{work area text}{arg2}{arg3} ... > > I understand that's what 'post:' does, but without it, I obtain the same > result. What if I want to generate the following? > > \command{arg1}{arg2}{arg3}{work area text} > If you do not use post:, you need to stick with the pre numbering, that is Argument 1 Mandatory 1 LabelString "CR number" EndArgument Argument 2 Mandatory 1 LabelString "Sub-Category" EndArgument Argument 3 LabelString "Subject Descriptor" EndArgument > In my particular case, it seems to me that there is no particularly good > reason why the "category" field should be treated differently than the > others (CR code, sub-category, subject). > Maybe you are looking for a flex inset rather than a style? > > Also, why doesn't the "Mandatory 0" flag work? I would expect it to > produce an argument enclosed in [...], not in {...}. > Works for me. Although it is superfluous (Mandatory is false by default). Jürgen > > Thanks > > PS: The style I want to use is ACM small journals ( > http://www.acm.org/publications/submissions/latex_style). I'm not sure if > it's the same as the one for SIG proceedings, but I'm guessing there will > be some differences. >
Re: Custom layout file: in preamble styles with custom latex commands
Thanks. That is what I want to achieve and your example does accomplish this, but I don't understand why using the first form of "Argument" declaration in the layout file, without 'post:', the second argument to the command is always the text from the work area, this is, \command{arg1}{work area text}{arg2}{arg3} ... I understand that's what 'post:' does, but without it, I obtain the same result. What if I want to generate the following? \command{arg1}{arg2}{arg3}{work area text} In my particular case, it seems to me that there is no particularly good reason why the "category" field should be treated differently than the others (CR code, sub-category, subject). Also, why doesn't the "Mandatory 0" flag work? I would expect it to produce an argument enclosed in [...], not in {...}. Thanks PS: The style I want to use is ACM small journals ( http://www.acm.org/publications/submissions/latex_style). I'm not sure if it's the same as the one for SIG proceedings, but I'm guessing there will be some differences. On Thu, Nov 13, 2014 at 4:01 AM, Jürgen Spitzmüller wrote: > 2014-11-12 21:14 GMT+01:00 Ernesto Posse: > >> Thanks. That's quite nice, but it doesn't work quite as expected. >> >> I tried the two forms, arguments with and without 'post:' and I get the >> same result: the second argument of the command is the "body" (the text >> that follows all arguments) and "Mandatory 0" seems to be ignored (the >> generated argument is enclosed in {...} rather than [...]). For example, if >> in the LyX work area I write the following (with text enclosed in <...> >> representing the style name and <...>[ ... ] representing an argument inset) >> >> [D.2.4.1] [Software Engineering] >> [Software/Program Verification] [Formal methods] >> Some other text >> >> Then the resulting code is >> >> \category{D.2.4.1}{Some other text}{Software >> Engineering}{Software/Program Verification}{Formal methods} >> >> So it looks like all arguments after the first are treated as if they >> where tagged with 'post:' and the optional flag seems to be ignored. >> >> Is this a bug or am I missing something? >> > > Maybe I misunderstand you, but don't you want to achieve this output: > > \category{CR-Number}{Category}{Sub-Category}[Subject Descriptor] > > > Whereas the second mandatory argument ("Category") is what is inserted in > the main text? > > (I figured that you want to use this style: > > http://www.acm.org/sigs/publications/sigguide-v2.2sp) > > > The attached document shows this (the definition is in Document > Local > Layout). > > > Jürgen > > -- Ernesto Posse Zeligsoft.com
Re: Custom layout file: in preamble styles with custom latex commands
2014-11-12 21:14 GMT+01:00 Ernesto Posse: > Thanks. That's quite nice, but it doesn't work quite as expected. > > I tried the two forms, arguments with and without 'post:' and I get the > same result: the second argument of the command is the "body" (the text > that follows all arguments) and "Mandatory 0" seems to be ignored (the > generated argument is enclosed in {...} rather than [...]). For example, if > in the LyX work area I write the following (with text enclosed in <...> > representing the style name and <...>[ ... ] representing an argument inset) > > [D.2.4.1] [Software Engineering] > [Software/Program Verification] [Formal methods] > Some other text > > Then the resulting code is > > \category{D.2.4.1}{Some other text}{Software Engineering}{Software/Program > Verification}{Formal methods} > > So it looks like all arguments after the first are treated as if they > where tagged with 'post:' and the optional flag seems to be ignored. > > Is this a bug or am I missing something? > Maybe I misunderstand you, but don't you want to achieve this output: \category{CR-Number}{Category}{Sub-Category}[Subject Descriptor] Whereas the second mandatory argument ("Category") is what is inserted in the main text? (I figured that you want to use this style: http://www.acm.org/sigs/publications/sigguide-v2.2sp) The attached document shows this (the definition is in Document > Local Layout). Jürgen category.lyx Description: application/lyx
Re: Custom layout file: in preamble styles with custom latex commands
Thanks. That's quite nice, but it doesn't work quite as expected. I tried the two forms, arguments with and without 'post:' and I get the same result: the second argument of the command is the "body" (the text that follows all arguments) and "Mandatory 0" seems to be ignored (the generated argument is enclosed in {...} rather than [...]). For example, if in the LyX work area I write the following (with text enclosed in <...> representing the style name and <...>[ ... ] representing an argument inset) [D.2.4.1] [Software Engineering] [Software/Program Verification] [Formal methods] Some other text Then the resulting code is \category{D.2.4.1}{Some other text}{Software Engineering}{Software/Program Verification}{Formal methods} So it looks like all arguments after the first are treated as if they where tagged with 'post:' and the optional flag seems to be ignored. Is this a bug or am I missing something? On Wed, Nov 12, 2014 at 2:08 PM, Jürgen Spitzmüller wrote: > 2014-11-12 20:01 GMT+01:00 Jürgen Spitzmüller: > > >> However, if you use LyX 2.1, you do not need an own command, since the >> command in question is possible with the help of the new argument syntax: >> >> Style Category >> InPreamble1 >> LabelTypeStatic >> LabelString"Category" >> LatexTypeCommand >> LatexNamecategory >> Argument 1 >> Mandatory 1 >> LabelString"CR number" >> EndArgument >> Argument 2 >> Mandatory 1 >> LabelString"Category" >> EndArgument >> Argument 3 >> Mandatory 1 >> LabelString"Sub-Category" >> EndArgument >> Argument 4 >> LabelString"Subject Descriptor" >> EndArgument >> MarginDynamic >> Labelsepxx >> LabelFont >> FamilySans >> SeriesBold >> ShapeSlanted >> SizeNormal >> ColorBlue >> EndFont >> End >> > > > Sorry, this should be: > > Style Category > InPreamble1 > LabelTypeStatic > LabelString"Category" > LatexTypeCommand > LatexNamecategory > Argument 1 > Mandatory 1 > LabelString"CR number" > EndArgument > Argument post:1 > Mandatory 1 > LabelString"Sub-Category" > EndArgument > Argument post:2 > LabelString"Subject Descriptor" > EndArgument > MarginDynamic > Labelsepxx > LabelFont > FamilySans > SeriesBold > ShapeSlanted > SizeNormal > ColorBlue > EndFont > End > > > Jürgen > > -- Ernesto Posse Zeligsoft.com
Re: Custom layout file: in preamble styles with custom latex commands
2014-11-12 20:01 GMT+01:00 Jürgen Spitzmüller: > > However, if you use LyX 2.1, you do not need an own command, since the > command in question is possible with the help of the new argument syntax: > > Style Category > InPreamble1 > LabelTypeStatic > LabelString"Category" > LatexTypeCommand > LatexNamecategory > Argument 1 > Mandatory 1 > LabelString"CR number" > EndArgument > Argument 2 > Mandatory 1 > LabelString"Category" > EndArgument > Argument 3 > Mandatory 1 > LabelString"Sub-Category" > EndArgument > Argument 4 > LabelString"Subject Descriptor" > EndArgument > MarginDynamic > Labelsepxx > LabelFont > FamilySans > SeriesBold > ShapeSlanted > SizeNormal > ColorBlue > EndFont > End > Sorry, this should be: Style Category InPreamble1 LabelTypeStatic LabelString"Category" LatexTypeCommand LatexNamecategory Argument 1 Mandatory 1 LabelString"CR number" EndArgument Argument post:1 Mandatory 1 LabelString"Sub-Category" EndArgument Argument post:2 LabelString"Subject Descriptor" EndArgument MarginDynamic Labelsepxx LabelFont FamilySans SeriesBold ShapeSlanted SizeNormal ColorBlue EndFont End Jürgen
Re: Custom layout file: in preamble styles with custom latex commands
2014-11-12 19:18 GMT+01:00 Ernesto Posse: > Hi. I'm trying to define my own layout file and I ran into this situation: > I need a style whose latex command must go into the preamble (as required > by the underlying latex class), but I need to define my own command for the > style because the one provided by the base class doesn't work well with the > way styles work in the LyX UI. > > The problem is that styles which have been declared as "InPreamble 1" get > their code generated before the user preamble which defines the required > latex command, and therefore, when compiling, LaTeX will stop with an error > saying that the control sequence is not defined (because it is defined > later). The style in question is the following: > > Style Category > InPreamble 1 > LabelType Static > LabelString "Category" > LatexType Command > LatexName ACMCCScategory > RequiredArgs 3 > Margin Dynamic > Labelsep xx > LabelFont > Family Sans > Series Bold > Shape Slanted > Size Normal > Color Blue > EndFont > Preamble > \newcommand{\ACMCCScategory}[4]{\category{#1}{#2}{#3}[4]} > EndPreamble > End > > So as you see, the style uses the custom-defined command \ACMCCScategory, > but the generated code is this: > > \makeatletter > > > %% LyX specific LaTeX commands. > > > \ACMCCScategory{D.2.4}{Software Engineering}{Software/Program > Verification}{Formal methods} > > > %% Textclass specific LaTeX commands. > > \newcommand{\ACMCCScategory}[4]{\category{#1}{#2}{#3}[4]} > > > %% User specified LaTeX commands. > > \usepackage{aadl} > > > \makeatother > > > So the problem is evident: the command is defined after it is being used. > > > Is there a way to tell LyX to produce the preamble commands before the "in > preamble" styles? > No, this is not yet possible. However, if you use LyX 2.1, you do not need an own command, since the command in question is possible with the help of the new argument syntax: Style Category InPreamble1 LabelTypeStatic LabelString"Category" LatexTypeCommand LatexNamecategory Argument 1 Mandatory 1 LabelString"CR number" EndArgument Argument 2 Mandatory 1 LabelString"Category" EndArgument Argument 3 Mandatory 1 LabelString"Sub-Category" EndArgument Argument 4 LabelString"Subject Descriptor" EndArgument MarginDynamic Labelsepxx LabelFont FamilySans SeriesBold ShapeSlanted SizeNormal ColorBlue EndFont End This also gives a much better UI, since both the Insert menu and the argument insets tell you which argument you are actually dealing with. And the order of insertion does not matter (in contrast to the pre 2.1 argument insets) HTH, Jürgen
Custom layout file: in preamble styles with custom latex commands
Hi. I'm trying to define my own layout file and I ran into this situation: I need a style whose latex command must go into the preamble (as required by the underlying latex class), but I need to define my own command for the style because the one provided by the base class doesn't work well with the way styles work in the LyX UI. The problem is that styles which have been declared as "InPreamble 1" get their code generated before the user preamble which defines the required latex command, and therefore, when compiling, LaTeX will stop with an error saying that the control sequence is not defined (because it is defined later). The style in question is the following: Style Category InPreamble 1 LabelType Static LabelString "Category" LatexType Command LatexName ACMCCScategory RequiredArgs 3 Margin Dynamic Labelsep xx LabelFont Family Sans Series Bold Shape Slanted Size Normal Color Blue EndFont Preamble \newcommand{\ACMCCScategory}[4]{\category{#1}{#2}{#3}[4]} EndPreamble End So as you see, the style uses the custom-defined command \ACMCCScategory, but the generated code is this: \makeatletter %% LyX specific LaTeX commands. \ACMCCScategory{D.2.4}{Software Engineering}{Software/Program Verification}{Formal methods} %% Textclass specific LaTeX commands. \newcommand{\ACMCCScategory}[4]{\category{#1}{#2}{#3}[4]} %% User specified LaTeX commands. \usepackage{aadl} \makeatother So the problem is evident: the command is defined after it is being used. Is there a way to tell LyX to produce the preamble commands before the "in preamble" styles? -- Ernesto Posse Zeligsoft.com