Re: [patch] Theorem environment: set NextNoIndent to 0

2017-02-22 Thread Scott Kostyshak
On Sun, Feb 19, 2017 at 06:40:32PM -0500, Scott Kostyshak wrote:

> Attached are two patches.

Pushed at 2b1a99e5 and f9ee47df.

Scott


signature.asc
Description: PGP signature


Re: [patch] Theorem environment: set NextNoIndent to 0

2017-02-20 Thread Scott Kostyshak
On Mon, Feb 20, 2017 at 05:34:14PM +0100, Jean-Pierre Chrétien wrote:
> Le 20/02/2017 à 00:40, Scott Kostyshak a écrit :
> 
> > 
> > As noted in the commit log, hollywood and broadway are strange cases. I
> > attach some sample PDF output from them. I don't plan on thinking of a
> > fix for these.
> 
> These classes are useful to write plays or movie scripts and the use of
> theorems should not happen with them, so I guess no fix is required.

OK good.

> In addition, they are quite old (hollywood is dated 2001) and apparently
> only LyX knows about them as they are in the tex/ subdir of the LyX
> distribution (they cannot be found in CTAN).

Good to know. We should probably deprecate some old examples/templates
at some point to make the list cleaner, but it's hard to know who still
uses them.

Scott


signature.asc
Description: PGP signature


Re: [patch] Theorem environment: set NextNoIndent to 0

2017-02-20 Thread Jean-Pierre Chrétien

Le 20/02/2017 à 00:40, Scott Kostyshak a écrit :



As noted in the commit log, hollywood and broadway are strange cases. I
attach some sample PDF output from them. I don't plan on thinking of a
fix for these.


These classes are useful to write plays or movie scripts and the use of theorems 
should not happen with them, so I guess no fix is required.


In addition, they are quite old (hollywood is dated 2001) and apparently only 
LyX knows about them as they are in the tex/ subdir of the LyX distribution 
(they cannot be found in CTAN).


--
Jean-Pierre





Re: [patch] Theorem environment: set NextNoIndent to 0

2017-02-19 Thread Scott Kostyshak
On Sat, Feb 18, 2017 at 03:18:59AM -0500, Richard Heck wrote:
> On 02/16/2017 04:04 AM, Jürgen Spitzmüller wrote:
> > Am Donnerstag, den 16.02.2017, 00:22 -0500 schrieb Scott Kostyshak:
> >> Probably the ideal approach is to maximize a weighted average, where
> >> the
> >> weights are how often the document classes are used. Unfortunately, I
> >> don't know how to calculate the weights.
> > This would be an application of the IfStyle tag Richard once proposed
> > (but never implemented apparently):
> > http://marc.info/?l=lyx-devel&m=124967798121429&w=2
> >
> > You could use the most frequent setting in the module, and then in the
> > diverging classes:
> >
> > IfStyle Theorem
> >   NextNoIndent  0
> > End
> 
> This is called "ModifyStyle" now.
> 
> ModifyStyle Theorem
>   NextNoIndent  0
> End
> 
> Richard
> 

Attached are two patches. The first fixes ParIndent for a few styles.
The second implements the NextNoIndent 0. After looking at output from
many classes, I do not think a ModifyStyle is needed.

I only tested classes that would compile a simple document that
contained only standard text and a Theorem environment. If someone
thinks it's worth the effort to set up documents (e.g. use as a base our
templates) for the other classes, I will do it.

As noted in the commit log, hollywood and broadway are strange cases. I
attach some sample PDF output from them. I don't plan on thinking of a
fix for these.

Scott
From 086a222ddeb77e47db7d5dccd405a3fdb047845b Mon Sep 17 00:00:00 2001
From: Scott Kostyshak 
Date: Sun, 19 Feb 2017 18:20:52 -0500
Subject: [PATCH 1/2] Fix ParIndent for various styles

---
 lib/layouts/g-brief.layout  | 4 
 lib/layouts/g-brief2.layout | 4 
 lib/layouts/letter.layout   | 3 +++
 lib/layouts/scrlttr2.layout | 1 +
 4 files changed, 12 insertions(+)

diff --git a/lib/layouts/g-brief.layout b/lib/layouts/g-brief.layout
index 93233aa..abc78f8 100644
--- a/lib/layouts/g-brief.layout
+++ b/lib/layouts/g-brief.layout
@@ -9,6 +9,10 @@ Input stdinsets.inc
 Input stdfloats.inc
 Input stdcounters.inc
 
+ModifyStyle Standard
+   ParIndent   ""
+End
+
 Columns 1
 Sides   1
 PageStyle   Empty
diff --git a/lib/layouts/g-brief2.layout b/lib/layouts/g-brief2.layout
index 9224c78..aa6f5b7 100644
--- a/lib/layouts/g-brief2.layout
+++ b/lib/layouts/g-brief2.layout
@@ -1024,3 +1024,7 @@ NoStyle   Verse
 # Remove some unwanted styles.
 # NoStyle  Right_Address
 # NoStyle  Address
+
+ModifyStyle Standard
+  ParIndent""
+End
diff --git a/lib/layouts/letter.layout b/lib/layouts/letter.layout
index 382dc6e..53943b2 100644
--- a/lib/layouts/letter.layout
+++ b/lib/layouts/letter.layout
@@ -17,3 +17,6 @@ Input stdlayouts.inc
 NoStyle Right_Address
 NoStyle Address
 
+ModifyStyle Standard
+  ParIndent  ""
+End
diff --git a/lib/layouts/scrlttr2.layout b/lib/layouts/scrlttr2.layout
index da7ab97..de96843 100644
--- a/lib/layouts/scrlttr2.layout
+++ b/lib/layouts/scrlttr2.layout
@@ -13,6 +13,7 @@ Style Standard
LatexName dummy
ParSep0.4
AlignPossible Block, Left, Right, Center
+   ParIndent MM
 End
 
 Input stdlists.inc
-- 
2.7.4

From 54399c4030d3d8c4bc49d4a44c7b226b77f5d95b Mon Sep 17 00:00:00 2001
From: Scott Kostyshak 
Date: Fri, 11 Nov 2016 11:55:31 -0500
Subject: [PATCH 2/2] Theorem style: set NextNoIndent to 0

After a Theorem environment, LaTeX does by default indent the
following paragraph.

I checked various classes and no ModifyStyle was needed. The
hollywood and broadway classes are strange cases where there is an
indent after the Theorem environment, but it is much smaller than
the normal indent. The indent is the same as the opening indent of
normal text, which we currently ignore. Further, I don't expect it
is common to use theorems in these classes.
---
 lib/layouts/theorems-ams.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/layouts/theorems-ams.inc b/lib/layouts/theorems-ams.inc
index a05b781..c4345be 100644
--- a/lib/layouts/theorems-ams.inc
+++ b/lib/layouts/theorems-ams.inc
@@ -29,7 +29,7 @@ Style Theorem
MarginFirst_Dynamic
LatexType Environment
LatexName thm
-   NextNoIndent  1
+   NextNoIndent  0
ResetArgs 1
AddToToc  thm
IsTocCaption  1
-- 
2.7.4



broadway.pdf
Description: Adobe PDF document


hollywood.pdf
Description: Adobe PDF document


signature.asc
Description: PGP signature


Re: [patch] Theorem environment: set NextNoIndent to 0

2017-02-18 Thread Richard Heck
On 02/16/2017 04:04 AM, Jürgen Spitzmüller wrote:
> Am Donnerstag, den 16.02.2017, 00:22 -0500 schrieb Scott Kostyshak:
>> Probably the ideal approach is to maximize a weighted average, where
>> the
>> weights are how often the document classes are used. Unfortunately, I
>> don't know how to calculate the weights.
> This would be an application of the IfStyle tag Richard once proposed
> (but never implemented apparently):
> http://marc.info/?l=lyx-devel&m=124967798121429&w=2
>
> You could use the most frequent setting in the module, and then in the
> diverging classes:
>
> IfStyle Theorem
>   NextNoIndent  0
> End

This is called "ModifyStyle" now.

ModifyStyle Theorem
  NextNoIndent  0
End

Richard



Re: [patch] Theorem environment: set NextNoIndent to 0

2017-02-16 Thread Scott Kostyshak
On Thu, Feb 16, 2017 at 10:04:03AM +0100, Jürgen Spitzmüller wrote:
> Am Donnerstag, den 16.02.2017, 00:22 -0500 schrieb Scott Kostyshak:
> > Probably the ideal approach is to maximize a weighted average, where
> > the
> > weights are how often the document classes are used. Unfortunately, I
> > don't know how to calculate the weights.
> 
> This would be an application of the IfStyle tag Richard once proposed
> (but never implemented apparently):
> http://marc.info/?l=lyx-devel&m=124967798121429&w=2
> 
> You could use the most frequent setting in the module, and then in the
> diverging classes:
> 
> IfStyle Theorem
>   NextNoIndent  0
> End

Interesting. That is exactly the issue.

Scott


signature.asc
Description: PGP signature


Re: [patch] Theorem environment: set NextNoIndent to 0

2017-02-16 Thread Jürgen Spitzmüller
Am Donnerstag, den 16.02.2017, 00:22 -0500 schrieb Scott Kostyshak:
> Probably the ideal approach is to maximize a weighted average, where
> the
> weights are how often the document classes are used. Unfortunately, I
> don't know how to calculate the weights.

This would be an application of the IfStyle tag Richard once proposed
(but never implemented apparently):
http://marc.info/?l=lyx-devel&m=124967798121429&w=2

You could use the most frequent setting in the module, and then in the
diverging classes:

IfStyle Theorem
  NextNoIndent  0
End

Jürgen

signature.asc
Description: This is a digitally signed message part


Re: [patch] Theorem environment: set NextNoIndent to 0

2017-02-15 Thread Scott Kostyshak
On Wed, Feb 15, 2017 at 09:07:26AM +, Guenter Milde wrote:

> >> >> NextNoIndent was set to 1 at 46611ba1, but the commit message only
> >> >> states "Fixes to the theorem modules." so I'm not sure how else to
> >> >> check.
> 
> Some suggestions:
> 
> * Ask the developer of 46611ba1 for possible reasons of the change.

Richard, how good is your memory? :)

> * Change the document class of your examples and compare output and LyX-GUI

Why? I think the module should provide correct output for the default
(article class). (update: ah, now I see what you mean. Let's discuss
this below)

> * Can indentation/start of a new paragraph be influenced by the new 
>   "new paragraph" special? (the curly arrow popping up every now and then in
>   files converted with lyx2lyx)

I'm not sure.

> No. I am not against the change (just wanted to avoid a situation where
> we solve display in half of the cases but break it in the other half.)

I see what you meant above now. It seems we took different approaches.

My approach: make things work for the default document class.

Your approach: make things work for as many document classes as
possible.

Probably the ideal approach is to maximize a weighted average, where the
weights are how often the document classes are used. Unfortunately, I
don't know how to calculate the weights.

Whatever our decision is we might want to document it (in
Development.lyx or in Customization.lyx?)

> >> Please do commit. I find this very annoying and keep meaning to commit
> >> it myself.
> 
> > OK, I'll wait a couple of days to see if Günter has an objection. He
> > might see something that I missed.
> 
> Please go ahead.

I think the above discussion is important first.

Scott


signature.asc
Description: PGP signature


Re: [patch] Theorem environment: set NextNoIndent to 0

2017-02-15 Thread Guenter Milde
On 2017-02-15, Scott Kostyshak wrote:
> On Tue, Feb 14, 2017 at 10:51:44PM -0500, Richard Heck wrote:
>> On 02/14/2017 10:12 PM, Scott Kostyshak wrote:
>> > On Mon, Nov 14, 2016 at 04:36:12PM -0500, Scott Kostyshak wrote:
>> >> On Sun, Nov 13, 2016 at 07:18:43PM +, Guenter Milde wrote:
>> >>> On 2016-11-11, Scott Kostyshak wrote:
>> >>>
>>  The attached patch fixes the display of the attached .lyx file. When
>>  compiled, the .lyx file indents the first line of the environment
>>  following the Theorem environment. But LyX shows the line as not
>>  indented.
>>  There might be similar fixes needed, such as in elsart.layout

...

>> >> NextNoIndent was set to 1 at 46611ba1, but the commit message only
>> >> states "Fixes to the theorem modules." so I'm not sure how else to
>> >> check.

Some suggestions:

* Ask the developer of 46611ba1 for possible reasons of the change.

* Change the document class of your examples and compare output and LyX-GUI

* Can indentation/start of a new paragraph be influenced by the new 
  "new paragraph" special? (the curly arrow popping up every now and then in
  files converted with lyx2lyx)
  

>> > Günter (or anyone else), do you object to me committing the patch?

No. I am not against the change (just wanted to avoid a situation where
we solve display in half of the cases but break it in the other half.)


>> Please do commit. I find this very annoying and keep meaning to commit
>> it myself.

> OK, I'll wait a couple of days to see if Günter has an objection. He
> might see something that I missed.

Please go ahead.

Thanks,

Günter



Re: [patch] Theorem environment: set NextNoIndent to 0

2017-02-14 Thread Scott Kostyshak
On Tue, Feb 14, 2017 at 10:51:44PM -0500, Richard Heck wrote:
> On 02/14/2017 10:12 PM, Scott Kostyshak wrote:
> > On Mon, Nov 14, 2016 at 04:36:12PM -0500, Scott Kostyshak wrote:
> >> On Sun, Nov 13, 2016 at 07:18:43PM +, Guenter Milde wrote:
> >>> On 2016-11-11, Scott Kostyshak wrote:
> >>>
>  [-- Type: text/plain, Encoding:  --]
>  The attached patch fixes the display of the attached .lyx file. When
>  compiled, the .lyx file indents the first line of the environment
>  following the Theorem environment. But LyX shows the line as not
>  indented.
>  There might be similar fixes needed, such as in elsart.layout
> >>>
> >>>
> >>> This might depend on several points, e.g. the "indentfirst" setting of the
> >>> document class or language settings. Some language's typographic tradition
> >>> does not indent the first line after section heading etc. (This may 
> >>> include
> >>> theorems.) 
> >> Agreed. But I think all of these things are taken into consideration
> >> when LyX decides whether to show an indentation. From what I understand,
> >> setting NextNoIndent is just whatever the default class behavior is. And
> >> I believe that behavior is to indent (i.e. NextNoIndent = 0).
> >>
> >>> It may also depend on nesting the theorem inside some paragraph or 
> >>> exporting
> >>> a parbreak (empty line) after the environment or not.
> >>> I don't know the
> >>> current state of the art but I think it should be checked why the current
> >>> setting is as it is.
> >> NextNoIndent was set to 1 at 46611ba1, but the commit message only
> >> states "Fixes to the theorem modules." so I'm not sure how else to
> >> check.
> > Günter (or anyone else), do you object to me committing the patch?
> 
> Please do commit. I find this very annoying and keep meaning to commit
> it myself.

OK, I'll wait a couple of days to see if Günter has an objection. He
might see something that I missed.

Scott


signature.asc
Description: PGP signature


Re: [patch] Theorem environment: set NextNoIndent to 0

2017-02-14 Thread Richard Heck
On 02/14/2017 10:12 PM, Scott Kostyshak wrote:
> On Mon, Nov 14, 2016 at 04:36:12PM -0500, Scott Kostyshak wrote:
>> On Sun, Nov 13, 2016 at 07:18:43PM +, Guenter Milde wrote:
>>> On 2016-11-11, Scott Kostyshak wrote:
>>>
 [-- Type: text/plain, Encoding:  --]
 The attached patch fixes the display of the attached .lyx file. When
 compiled, the .lyx file indents the first line of the environment
 following the Theorem environment. But LyX shows the line as not
 indented.
 There might be similar fixes needed, such as in elsart.layout
>>>
>>>
>>> This might depend on several points, e.g. the "indentfirst" setting of the
>>> document class or language settings. Some language's typographic tradition
>>> does not indent the first line after section heading etc. (This may include
>>> theorems.) 
>> Agreed. But I think all of these things are taken into consideration
>> when LyX decides whether to show an indentation. From what I understand,
>> setting NextNoIndent is just whatever the default class behavior is. And
>> I believe that behavior is to indent (i.e. NextNoIndent = 0).
>>
>>> It may also depend on nesting the theorem inside some paragraph or exporting
>>> a parbreak (empty line) after the environment or not.
>>> I don't know the
>>> current state of the art but I think it should be checked why the current
>>> setting is as it is.
>> NextNoIndent was set to 1 at 46611ba1, but the commit message only
>> states "Fixes to the theorem modules." so I'm not sure how else to
>> check.
> Günter (or anyone else), do you object to me committing the patch?

Please do commit. I find this very annoying and keep meaning to commit
it myself.

rh



Re: [patch] Theorem environment: set NextNoIndent to 0

2017-02-14 Thread Scott Kostyshak
On Mon, Nov 14, 2016 at 04:36:12PM -0500, Scott Kostyshak wrote:
> On Sun, Nov 13, 2016 at 07:18:43PM +, Guenter Milde wrote:
> > On 2016-11-11, Scott Kostyshak wrote:
> > 
> > > [-- Type: text/plain, Encoding:  --]
> > 
> > > The attached patch fixes the display of the attached .lyx file. When
> > > compiled, the .lyx file indents the first line of the environment
> > > following the Theorem environment. But LyX shows the line as not
> > > indented.
> > 
> > > There might be similar fixes needed, such as in elsart.layout
> > 
> > 
> > 
> > This might depend on several points, e.g. the "indentfirst" setting of the
> > document class or language settings. Some language's typographic tradition
> > does not indent the first line after section heading etc. (This may include
> > theorems.) 
> 
> Agreed. But I think all of these things are taken into consideration
> when LyX decides whether to show an indentation. From what I understand,
> setting NextNoIndent is just whatever the default class behavior is. And
> I believe that behavior is to indent (i.e. NextNoIndent = 0).
> 
> > It may also depend on nesting the theorem inside some paragraph or exporting
> > a parbreak (empty line) after the environment or not.
> 
> > I don't know the
> > current state of the art but I think it should be checked why the current
> > setting is as it is.
> 
> NextNoIndent was set to 1 at 46611ba1, but the commit message only
> states "Fixes to the theorem modules." so I'm not sure how else to
> check.

Günter (or anyone else), do you object to me committing the patch?

Compile the .lyx file I attached in the first email of the thread, and
compare the compiled output to LyX output and you should see a
difference. The patch addresses this difference.

Scott


signature.asc
Description: PGP signature


Re: [patch] Theorem environment: set NextNoIndent to 0

2016-11-14 Thread Scott Kostyshak
On Sun, Nov 13, 2016 at 07:18:43PM +, Guenter Milde wrote:
> On 2016-11-11, Scott Kostyshak wrote:
> 
> > [-- Type: text/plain, Encoding:  --]
> 
> > The attached patch fixes the display of the attached .lyx file. When
> > compiled, the .lyx file indents the first line of the environment
> > following the Theorem environment. But LyX shows the line as not
> > indented.
> 
> > There might be similar fixes needed, such as in elsart.layout
> 
> 
> 
> This might depend on several points, e.g. the "indentfirst" setting of the
> document class or language settings. Some language's typographic tradition
> does not indent the first line after section heading etc. (This may include
> theorems.) 

Agreed. But I think all of these things are taken into consideration
when LyX decides whether to show an indentation. From what I understand,
setting NextNoIndent is just whatever the default class behavior is. And
I believe that behavior is to indent (i.e. NextNoIndent = 0).

> It may also depend on nesting the theorem inside some paragraph or exporting
> a parbreak (empty line) after the environment or not.

> I don't know the
> current state of the art but I think it should be checked why the current
> setting is as it is.

NextNoIndent was set to 1 at 46611ba1, but the commit message only
states "Fixes to the theorem modules." so I'm not sure how else to
check.

Thanks for the feedback.

Scott


signature.asc
Description: PGP signature


Re: [patch] Theorem environment: set NextNoIndent to 0

2016-11-13 Thread Guenter Milde
On 2016-11-11, Scott Kostyshak wrote:

> [-- Type: text/plain, Encoding:  --]

> The attached patch fixes the display of the attached .lyx file. When
> compiled, the .lyx file indents the first line of the environment
> following the Theorem environment. But LyX shows the line as not
> indented.

> There might be similar fixes needed, such as in elsart.layout



This might depend on several points, e.g. the "indentfirst" setting of the
document class or language settings. Some language's typographic tradition
does not indent the first line after section heading etc. (This may include
theorems.) 

It may also depend on nesting the theorem inside some paragraph or exporting
a parbreak (empty line) after the environment or not. I don't know the
current state of the art but I think it should be checked why the current
setting is as it is.

Günter