Re: AMS Article: need Theorems, and SUBSECTIONS to share counter.

2017-10-03 Thread rls

On 04/10/2017 01:22, Richard Heck wrote:

I just got the following question:
Why not reverse the process; Rather than modifying a dozen styles?
What would it take to create something like a "Subsection-v2" which
would just use as counter the "thm" counter?


This can be done, but it would mean creating your own version of
theorems-ams. It's easy to do this by copying the old files to new names
(in $USERDIR/layouts/) and then modifying them. I'll be happy to explain
the process a bit more if you want to do that.


Thank you for your generous offer. After a good night's sleep, I will 
probably do as you suggest and look at theorems-ams.



The reason you have to modify so many styles is that all the
declarations happen in Theorem, and then the other styles copy them. But
the copying happens when the file is originally read: Later
modifications to Theorem do not affect, say, Lemma. And each individual
counter (e.g., "Lemma \thesubsection") has to be declared independently,
anyway. Presumably, there would be a way to fix that, but no one has
ever really needed to do it, so it doesn't get done.


There's nothing like understanding what's really going on!

Regards
Ramez



Re: AMS Article: need Theorems, and SUBSECTIONS to share counter.

2017-10-03 Thread Richard Heck
On 10/03/2017 06:41 PM, rls wrote:
> Thanks once more!
>
> I truly understand the need to RTFM, but sometimes one is tired, just
> looking for a quick fix (having gone through Pascal, 8086 assembly, C,
> LateX Java, ML, and programmed a half dozen editors...)

I understand, of course, and did not mean to tell you to RTFM, as fine
as it is. Just, if you do want to understand the details.

> I just got the following question:
> Why not reverse the process; Rather than modifying a dozen styles?
> What would it take to create something like a "Subsection-v2" which
> would just use as counter the "thm" counter?

This can be done, but it would mean creating your own version of
theorems-ams. It's easy to do this by copying the old files to new names
(in $USERDIR/layouts/) and then modifying them. I'll be happy to explain
the process a bit more if you want to do that.

The reason you have to modify so many styles is that all the
declarations happen in Theorem, and then the other styles copy them. But
the copying happens when the file is originally read: Later
modifications to Theorem do not affect, say, Lemma. And each individual
counter (e.g., "Lemma \thesubsection") has to be declared independently,
anyway. Presumably, there would be a way to fix that, but no one has
ever really needed to do it, so it doesn't get done.

Richard



Re: AMS Article: need Theorems, and SUBSECTIONS to share counter.

2017-10-03 Thread rls

Thanks once more!

I truly understand the need to RTFM, but sometimes one is tired, just 
looking for a quick fix (having gone through Pascal, 8086 assembly, C, 
LateX Java, ML, and programmed a half dozen editors...)


I realize one has to modify every "construct" (Definition, Corollary etc.)

I just got the following question:
Why not reverse the process; Rather than modifying a dozen styles?
What would it take to create something like a "Subsection-v2" which 
would just use as counter the "thm" counter?


Regards,
Ramez
===
On 03/10/2017 23:16, Richard Heck wrote:

On 10/03/2017 03:35 PM, rls wrote:

Thank you for your reply.
I have tried your suggestion verbatim (after correcting a couple of 
misprints): modifying "Local Layout".


I don't really understand the details, 


See Ch 5 of the Customization manual again, and have a look at the file 
theorems-ams.inc, where the original definitions of these styles are. 
What we're adding to Local Layout is just modifying those definitions. 
The syntax takes a bit of getting used to, but it's not too bad, really.



but I noticed one problem:
- Inside a given section (say section 2), the theorem and lemma 
numbers are all displayed as "2.0".

- The subsection numbers are displayed correctley
- Printing gives correct results.


Sorry, I hadn't tested. You need also to add:

LabelString "Theorem \thesubsection."

and similarly for lemmas. Note that, if you want to use things other 
than theorems and lemmas, you'll need to add similar modifications for 
those styles.


You should also put, at the top of the Local Layout, "Format 60", that 
being the 2.2.x format. This will avoid any possible problems from LyX 
thinking you intend some other version.


Richard


Re: AMS Article: need Theorems, and SUBSECTIONS to share counter.

2017-10-03 Thread Richard Heck
On 10/03/2017 03:35 PM, rls wrote:
> Thank you for your reply.
> I have tried your suggestion verbatim (after correcting a couple of
> misprints): modifying "Local Layout".
>
> I don't really understand the details, 

See Ch 5 of the Customization manual again, and have a look at the file
theorems-ams.inc, where the original definitions of these styles are.
What we're adding to Local Layout is just modifying those definitions.
The syntax takes a bit of getting used to, but it's not too bad, really.

> but I noticed one problem:
> - Inside a given section (say section 2), the theorem and lemma
> numbers are all displayed as "2.0".
> - The subsection numbers are displayed correctley
> - Printing gives correct results.

Sorry, I hadn't tested. You need also to add:

LabelString "Theorem \thesubsection."

and similarly for lemmas. Note that, if you want to use things other
than theorems and lemmas, you'll need to add similar modifications for
those styles.

You should also put, at the top of the Local Layout, "Format 60", that
being the 2.2.x format. This will avoid any possible problems from LyX
thinking you intend some other version.

Richard




> =
> On 03/10/2017 17:15, Richard Heck wrote:
>>
>> The LyX display is controlled by 'layout' information, which is defined
>> in a number of places:
>>
>> (i) The layout file for the document class (e.g., amsart.layout)
>> (ii) Modules, which are to LyX as packages are to LaTeX (e.g.,
>> theorems-ams.module)
>> (iii) Document-specific "local" layout, found at Document> Settings>
>> Local Layout
>>
>> It seems to me as if you will probably be best off creating a new module
>> of your own, perhaps starting with and modifying theorems-ams.module.
>> Documentation concerning this is in Ch 5 of the Customization manual. As
>> far as the counters are concerned, you will want to modify the
>> LabelCounter defined for the various styles so that it uses the one for
>> subsections.
>>
>> Note that you can just make modifications in Local Layout, e.g.:
>>
>> Style Theorem
>>  LabelCounter subsection
>>  Preamble
>>      \theoremstyle{plain}
>>  \newtheorem{thm}[subsection]{\protect\theoremname}
>>  EndPreamable
>> End
>> Style Lemma
>>  LabelCounter subsection
>>  Preamble
>>      \theoremstyle{plain}
>>  \newtheorem{lem}[subsection]{\protect\theoremname}
>>  EndPreamable
>> End
>>
>> Then you could just use the usual Theorems (AMS) module, and these
>> modifications might be enough to get you what you want. But if you are
>> going to want to re-use them, then putting them in a module of their own
>> will make that easier.
>>
>> Richard
>


Re: AMS Article: need Theorems, and SUBSECTIONS to share counter.

2017-10-03 Thread rls

Thank you for your reply.
I have tried your suggestion verbatim (after correcting a couple of 
misprints): modifying "Local Layout".


I don't really understand the details, but I noticed one problem:
- Inside a given section (say section 2), the theorem and lemma numbers 
are all displayed as "2.0".

- The subsection numbers are displayed correctley
- Printing gives correct results.

Any ideas? Thanks,
Ramez Labib Sami
=
On 03/10/2017 17:15, Richard Heck wrote:


The LyX display is controlled by 'layout' information, which is defined
in a number of places:

(i) The layout file for the document class (e.g., amsart.layout)
(ii) Modules, which are to LyX as packages are to LaTeX (e.g.,
theorems-ams.module)
(iii) Document-specific "local" layout, found at Document> Settings>
Local Layout

It seems to me as if you will probably be best off creating a new module
of your own, perhaps starting with and modifying theorems-ams.module.
Documentation concerning this is in Ch 5 of the Customization manual. As
far as the counters are concerned, you will want to modify the
LabelCounter defined for the various styles so that it uses the one for
subsections.

Note that you can just make modifications in Local Layout, e.g.:

Style Theorem
     LabelCounter subsection
     Preamble
         \theoremstyle{plain}
     \newtheorem{thm}[subsection]{\protect\theoremname}
     EndPreamable
End
Style Lemma
     LabelCounter subsection
     Preamble
         \theoremstyle{plain}
     \newtheorem{lem}[subsection]{\protect\theoremname}
     EndPreamable
End

Then you could just use the usual Theorems (AMS) module, and these
modifications might be enough to get you what you want. But if you are
going to want to re-use them, then putting them in a module of their own
will make that easier.

Richard




Re: AMS Article: need Theorems, and SUBSECTIONS to share counter.

2017-10-03 Thread Richard Heck
On 10/03/2017 08:56 AM, rls wrote:
> I am Lyx beginner. Sorry if it's in the docs. Thanks in advance for
> your help.
>
> I need to have Theorems (and Lemmas, etc.) to share the same counter
> with subsectons.
>
> I can't find a way to do it with Lyx.
>
> === Example of Section 2, in a document 
>
>    2. Reals simply defined ...[Section 2 title here]
>
> 2.1. Recall ... [1st subsection here]
>
> 2.2. Lemma. Any 
>
> Proof. ...
>
> 2.3. Given f ... [2nd subsection here]
>
> 
> Before using Lyx, I would just use the preamble:
>
> \documentclass[12pt]{amsart}
> \usepackage{amsmath}
>
> \swapnumbers
> \theoremstyle{plain}
> \newtheorem{theorem}[subsection]{Theorem}
> \newtheorem{proposition}[subsection]{Proposition}
> \newtheorem{lemma}[subsection]{Lemma}
> \newtheorem{corollary}[subsection]{Corollary}
> \newtheorem*{theoremNoNum}{Theorem}
> .
> ---
> I could include in the Lyx Document > Settings > LaTex Preamble, some
> hack to identify the two counters, like:
> \makeatletter
> \let\c@subsection\c@thm
> \makeatother
>
> But then, the numbers displayed in the Lyx editor aren't what's printed.

The LyX display is controlled by 'layout' information, which is defined
in a number of places:

(i) The layout file for the document class (e.g., amsart.layout)
(ii) Modules, which are to LyX as packages are to LaTeX (e.g.,
theorems-ams.module)
(iii) Document-specific "local" layout, found at Document> Settings>
Local Layout

It seems to me as if you will probably be best off creating a new module
of your own, perhaps starting with and modifying theorems-ams.module.
Documentation concerning this is in Ch 5 of the Customization manual. As
far as the counters are concerned, you will want to modify the
LabelCounter defined for the various styles so that it uses the one for
subsections.

Note that you can just make modifications in Local Layout, e.g.:

Style Theorem
    LabelCounter subsection
    Preamble
        \theoremstyle{plain}
    \newtheorem{thm}[subsection]{\protect\theoremname}
    EndPreamable
End
Style Lemma
    LabelCounter subsection
    Preamble
        \theoremstyle{plain}
    \newtheorem{lem}[subsection]{\protect\theoremname}
    EndPreamable
End

Then you could just use the usual Theorems (AMS) module, and these
modifications might be enough to get you what you want. But if you are
going to want to re-use them, then putting them in a module of their own
will make that easier.

Richard




AMS Article: need Theorems, and SUBSECTIONS to share counter.

2017-10-03 Thread rls
I am Lyx beginner. Sorry if it's in the docs. Thanks in advance for your 
help.


I need to have Theorems (and Lemmas, etc.) to share the same counter 
with subsectons.


I can't find a way to do it with Lyx.

=== Example of Section 2, in a document 

   2. Reals simply defined ...[Section 2 title here]

2.1. Recall ... [1st subsection here]

2.2. Lemma. Any 

Proof. ...

2.3. Given f ... [2nd subsection here]


Before using Lyx, I would just use the preamble:

\documentclass[12pt]{amsart}
\usepackage{amsmath}

\swapnumbers
\theoremstyle{plain}
\newtheorem{theorem}[subsection]{Theorem}
\newtheorem{proposition}[subsection]{Proposition}
\newtheorem{lemma}[subsection]{Lemma}
\newtheorem{corollary}[subsection]{Corollary}
\newtheorem*{theoremNoNum}{Theorem}
.
---
I could include in the Lyx Document > Settings > LaTex Preamble, some 
hack to identify the two counters, like:

\makeatletter
\let\c@subsection\c@thm
\makeatother

But then, the numbers displayed in the Lyx editor aren't what's printed.
--
Ramez Labib Sami
Université Paris-Diderot
Paros, France