Re: Notes inherit surrounding font

2019-09-13 Thread Daniel

On 2019-09-13 10:51, Jean-Marc Lasgouttes wrote:

Le 13/09/2019 à 10:01, Daniel a écrit :

Did I answer all questions? ;)


Yes, but "let me say it again" in a strange way. ;)


Sorry for that, I was running out of wise words due to the impression 
that we are talking past each other. This was unwarranted.


No worries! I hope I wasn't too nit-picky.

I thought about the "it is only visual" reason. I think there are many 
things in LyX that are "only visual", i.e. don't affect the output. So, 
I am not sure how good a reason that is. But I fully understand that it 
is less pressing than many other things.


Daniel



Re: Notes inherit surrounding font

2019-09-13 Thread Jean-Marc Lasgouttes

Le 13/09/2019 à 10:01, Daniel a écrit :

Did I answer all questions? ;)


Yes, but "let me say it again" in a strange way. ;)


Sorry for that, I was running out of wise words due to the impression 
that we are talking past each other. This was unwarranted.


JMarc



Re: Notes inherit surrounding font

2019-09-13 Thread Daniel

On 13/9/19 9:23, Jean-Marc Lasgouttes wrote:

Le 13/09/2019 à 07:07, Daniel a écrit :

On 2019-09-04 16:30, Jean-Marc Lasgouttes wrote:
I propose in the following patch to reset the outer layout to Plain 
if it only contains the newly insert inset.


It seems to me that my original example had some specific features 
that triggered a solution of which I don't think it solves the whole 
problem. This makes me wonder whether there is a superior solution to 
the whole problem or at least something additional that should be fixed.


Actually, your message prompted me to fix an issue that bugged for 
years, but it seems that I needed a little nudge.


Attached is an example very similar to the original. However, this 
time do not select the document's whole content but only from part of 
the section heading, e.g. "tion", to the end of the enumerate item.


The result (also represented in the document) is an enumerate item 
within a note with a font matching the section font. This looks odd to 
me. Rather the enumerate should have a normal font.


This is the same result as it always has been. There is no good solution 
in this case, so my patch does nothing. However, I doubt that this last 
example is a typical user workflow


Furthermore, I don't think it is something that would be typeset this 
way in any inset. In particular, other insets I tested, e.g. Footnote, 
Program Listing, don't share this "feature". But I couldn't figure out 
why they differ.


Let me say it again a last time:
Yes, I think it is of lesser importance because this is only an issue of 
display, not document contents.
No, I did not touch that with my patch because I do not care much about 
it personally
Yes, somebody should eventually change the display of notes, although it 
is only visual.
No, I do not agree that all insets should do that, in particular it is 
good that Branches and Boxes inherit the font, because this is what 
happens on PDF output.


Did I answer all questions? ;)


Yes, but "let me say it again" in a strange way. ;)

Daniel



Re: Notes inherit surrounding font

2019-09-13 Thread Jean-Marc Lasgouttes

Le 13/09/2019 à 07:07, Daniel a écrit :

On 2019-09-04 16:30, Jean-Marc Lasgouttes wrote:
I propose in the following patch to reset the outer layout to Plain if 
it only contains the newly insert inset.


It seems to me that my original example had some specific features that 
triggered a solution of which I don't think it solves the whole problem. 
This makes me wonder whether there is a superior solution to the whole 
problem or at least something additional that should be fixed.


Actually, your message prompted me to fix an issue that bugged for 
years, but it seems that I needed a little nudge.


Attached is an example very similar to the original. However, this time 
do not select the document's whole content but only from part of the 
section heading, e.g. "tion", to the end of the enumerate item.


The result (also represented in the document) is an enumerate item 
within a note with a font matching the section font. This looks odd to 
me. Rather the enumerate should have a normal font.


This is the same result as it always has been. There is no good solution 
in this case, so my patch does nothing. However, I doubt that this last 
example is a typical user workflow


Furthermore, I don't think it is something that would be typeset this 
way in any inset. In particular, other insets I tested, e.g. Footnote, 
Program Listing, don't share this "feature". But I couldn't figure out 
why they differ.


Let me say it again a last time:
Yes, I think it is of lesser importance because this is only an issue of 
display, not document contents.
No, I did not touch that with my patch because I do not care much about 
it personally
Yes, somebody should eventually change the display of notes, although it 
is only visual.
No, I do not agree that all insets should do that, in particular it is 
good that Branches and Boxes inherit the font, because this is what 
happens on PDF output.


Did I answer all questions? ;)

JMarc


Re: Notes inherit surrounding font

2019-09-12 Thread Daniel

On 2019-09-04 16:30, Jean-Marc Lasgouttes wrote:
I propose in the following patch to reset the outer layout to Plain if 
it only contains the newly insert inset.


It seems to me that my original example had some specific features that 
triggered a solution of which I don't think it solves the whole problem. 
This makes me wonder whether there is a superior solution to the whole 
problem or at least something additional that should be fixed.


Attached is an example very similar to the original. However, this time 
do not select the document's whole content but only from part of the 
section heading, e.g. "tion", to the end of the enumerate item.


The result (also represented in the document) is an enumerate item 
within a note with a font matching the section font. This looks odd to 
me. Rather the enumerate should have a normal font.


Furthermore, I don't think it is something that would be typeset this 
way in any inset. In particular, other insets I tested, e.g. Footnote, 
Program Listing, don't share this "feature". But I couldn't figure out 
why they differ.


Daniel
#LyX 2.3 created this file. For more info see http://www.lyx.org/
\lyxformat 544
\begin_document
\begin_header
\save_transient_properties true
\origin unavailable
\textclass article
\use_default_options true
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding global
\font_roman "default" "default"
\font_sans "default" "default"
\font_typewriter "default" "default"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\use_microtype false
\use_dash_ligatures true
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\use_hyperref false
\papersize default
\use_geometry false
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 1
\use_minted 0
\index Index
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\is_math_indent 0
\math_numbering_side default
\quotes_style english
\dynamic_quotes 0
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header

\begin_body

\begin_layout Itemize
Select from "tion" to the end of the first enumeration item and insert a
 note:
\end_layout

\begin_layout Section
Section
\end_layout

\begin_layout Standard

\end_layout

\begin_layout Enumerate
Text
\end_layout

\begin_layout Standard
\begin_inset Separator plain
\end_inset


\end_layout

\begin_layout Itemize
The result will be this:
\end_layout

\begin_layout Section
Sec
\begin_inset Note Note
status open

\begin_layout Section
tion
\end_layout

\begin_layout Plain Layout

\end_layout

\begin_layout Enumerate
Text
\end_layout

\end_inset


\end_layout

\end_body
\end_document


Re: Notes inherit surrounding font

2019-09-12 Thread Daniel

On 2019-09-12 17:22, Jean-Marc Lasgouttes wrote:

Le 12/09/2019 à 17:02, Daniel a écrit :
By the way, what happens with your patch if one dissolves the inset? 
Currently, if I try to recreate the behaviour in LyX (as far as I 
understood it) by setting the sourrounding layout to normal, the first 
paragraph is changed to Standard. That does not seem ideal  because I 
would have thought that dissolving the inset is just the inverse of 
inserting it.


The patch also takes care of that.


Great.

Daniel



Re: Notes inherit surrounding font

2019-09-12 Thread Jean-Marc Lasgouttes

Le 12/09/2019 à 17:02, Daniel a écrit :
By the way, what happens with your patch if one dissolves the inset? 
Currently, if I try to recreate the behaviour in LyX (as far as I 
understood it) by setting the sourrounding layout to normal, the first 
paragraph is changed to Standard. That does not seem ideal  because I 
would have thought that dissolving the inset is just the inverse of 
inserting it.


The patch also takes care of that.

JMarc


Re: Notes inherit surrounding font

2019-09-12 Thread Daniel

On 2019-09-12 16:35, Daniel wrote:

On 2019-09-12 14:41, Jean-Marc Lasgouttes wrote:

Le 12/09/2019 à 12:53, Daniel a écrit :
I suspect that as well now. With 2.3, if I typeset my example, I get 
an empty document. This is because the section layout is a starred one.


That's cheating :) You have a section that takes vertical space, but 
you do not see it.


Do you mean, that I get a bold 1 if I change the section layout to 
the non-starred version and typeset?


Try it!


I did. (The question was whether you meant that.)

In case you talk about the latter, I don't see a reason why the one 
with the 1 does not sense. Maybe I intentionally wanted to get only 
the 1 typeset. This is possible in LyX by adding a note. And there 
are a couple of cases where it has been recommended in the past 
(maybe unfortunately?) that one should insert empty notes to keep 
layouts without contents when nesting one layout into another without 
adding any content to the outer one, e.g. to create a quote that only 
contains a numbered list.


The behavior that I implemented only trigeers when
1/ one selects the whole paragraph
2/ an inset is inserted over this selection.
3/ the inset is able to contains layouts different from Plain Layout 
(i.e. it is not a CharStyle type of inset)


So inserting an empty note in an empty paragraph does not count

And even when the layout has been reset, one can set it back, the 
Thought Police is not threatening you for non-LyXian behavior.


It is just suppose to help, not to force anything.

I am not saying that this is the way to go. I am only saying that it 
is far from obvious to me that this is the way and it wasn't my 
original concern.


So you tell me that when you sent your original message, it was clear 
for you that the Paragraph that contains the note was still in 
Section* layout?


Yes. I have worked for a while with LyX now. :)

I think it is a good idea that one can set an inset to not inherit 
the font.


However, my latest compromise suggestion was that only the first 
paragraph enherits the font of the enclosing text. It will then 
reflect the format that the text will take if the note gets dissolved.


I think this is too complicated.


I think it is less complicated than to understanding when the behavior 
triggers as you explain in the 1-3 context above.


By the way, what happens with your patch if one dissolves the inset? 
Currently, if I try to recreate the behaviour in LyX (as far as I 
understood it) by setting the sourrounding layout to normal, the first 
paragraph is changed to Standard. That does not seem ideal  because I 
would have thought that dissolving the inset is just the inverse of 
inserting it.




Re: Notes inherit surrounding font

2019-09-12 Thread Daniel

On 2019-09-12 14:41, Jean-Marc Lasgouttes wrote:

Le 12/09/2019 à 12:53, Daniel a écrit :
I suspect that as well now. With 2.3, if I typeset my example, I get 
an empty document. This is because the section layout is a starred one.


That's cheating :) You have a section that takes vertical space, but you 
do not see it.


Do you mean, that I get a bold 1 if I change the section layout to the 
non-starred version and typeset?


Try it!


I did. (The question was whether you meant that.)

In case you talk about the latter, I don't see a reason why the one 
with the 1 does not sense. Maybe I intentionally wanted to get only 
the 1 typeset. This is possible in LyX by adding a note. And there are 
a couple of cases where it has been recommended in the past (maybe 
unfortunately?) that one should insert empty notes to keep layouts 
without contents when nesting one layout into another without adding 
any content to the outer one, e.g. to create a quote that only 
contains a numbered list.


The behavior that I implemented only trigeers when
1/ one selects the whole paragraph
2/ an inset is inserted over this selection.
3/ the inset is able to contains layouts different from Plain Layout 
(i.e. it is not a CharStyle type of inset)


So inserting an empty note in an empty paragraph does not count

And even when the layout has been reset, one can set it back, the 
Thought Police is not threatening you for non-LyXian behavior.


It is just suppose to help, not to force anything.

I am not saying that this is the way to go. I am only saying that it 
is far from obvious to me that this is the way and it wasn't my 
original concern.


So you tell me that when you sent your original message, it was clear 
for you that the Paragraph that contains the note was still in Section* 
layout?


Yes. I have worked for a while with LyX now. :)

I think it is a good idea that one can set an inset to not inherit the 
font.


However, my latest compromise suggestion was that only the first 
paragraph enherits the font of the enclosing text. It will then 
reflect the format that the text will take if the note gets dissolved.


I think this is too complicated.


I think it is less complicated than to understanding when the behavior 
triggers as you explain in the 1-3 context above.


Daniel



Re: Notes inherit surrounding font

2019-09-12 Thread Jean-Marc Lasgouttes

Le 12/09/2019 à 12:53, Daniel a écrit :
I suspect that as well now. With 2.3, if I typeset my example, I get an 
empty document. This is because the section layout is a starred one.


That's cheating :) You have a section that takes vertical space, but you 
do not see it.


Do you mean, that I get a bold 1 if I change the section layout to the 
non-starred version and typeset?


Try it!

In case you talk about the latter, I don't see a reason why the one with 
the 1 does not sense. Maybe I intentionally wanted to get only the 1 
typeset. This is possible in LyX by adding a note. And there are a 
couple of cases where it has been recommended in the past (maybe 
unfortunately?) that one should insert empty notes to keep layouts 
without contents when nesting one layout into another without adding any 
content to the outer one, e.g. to create a quote that only contains a 
numbered list.


The behavior that I implemented only trigeers when
1/ one selects the whole paragraph
2/ an inset is inserted over this selection.
3/ the inset is able to contains layouts different from Plain Layout 
(i.e. it is not a CharStyle type of inset)


So inserting an empty note in an empty paragraph does not count

And even when the layout has been reset, one can set it back, the 
Thought Police is not threatening you for non-LyXian behavior.


It is just suppose to help, not to force anything.

I am not saying that this is the way to go. I am only saying that it is 
far from obvious to me that this is the way and it wasn't my original 
concern.


So you tell me that when you sent your original message, it was clear 
for you that the Paragraph that contains the note was still in Section* 
layout?


I think it is a good idea that one can set an inset to not inherit the 
font.


However, my latest compromise suggestion was that only the first 
paragraph enherits the font of the enclosing text. It will then reflect 
the format that the text will take if the note gets dissolved.


I think this is too complicated.

JMarc


Re: Notes inherit surrounding font

2019-09-12 Thread Daniel

On 2019-09-12 10:08, Jean-Marc Lasgouttes wrote:

Le 11/09/2019 à 21:56, Daniel a écrit :

On 11/9/19 15:47, Jean-Marc Lasgouttes wrote:

Le 06/09/2019 à 18:09, Daniel a écrit :

The 'surrounding layout' problem is actually more general. Suppose you
have a section, with header and associated text. Select the whole 
thing
and make it a branch. It will not do what you want. We really do 
need to
change the 'outside' layout in this case. (I think there might be a 
bug

about this, and I have done some work on the problem.)


I never used branches. So maybe that is why I never came across the
problem and cannot evaluate the benefits over the costs correctly.


Replace branch with Note or Box and the issue is the same.


I don't see what is the difference to the example I originally posted. 
Just from the description you give it seems the same and I still don't 
see why the 'sourrounding layout' is necessarily the problem.


I suspect we are not talking about the same thing. With 2.3, if you 
typeset your example, you will get a bold "1" alone on the page. This is 
an empty section. IN master, you will get an empty document. Which is 
the one that makes sense to you?


I suspect that as well now. With 2.3, if I typeset my example, I get an 
empty document. This is because the section layout is a starred one.


Do you mean, that I get a bold 1 if I change the section layout to the 
non-starred version and typeset?


In case you talk about the latter, I don't see a reason why the one with 
the 1 does not sense. Maybe I intentionally wanted to get only the 1 
typeset. This is possible in LyX by adding a note. And there are a 
couple of cases where it has been recommended in the past (maybe 
unfortunately?) that one should insert empty notes to keep layouts 
without contents when nesting one layout into another without adding any 
content to the outer one, e.g. to create a quote that only contains a 
numbered list.


I am not saying that this is the way to go. I am only saying that it is 
far from obvious to me that this is the way and it wasn't my original 
concern.


Now that the real issue is fixed (hopefully correctly), you can 
change the Note font as you want, AFAIAC.


Doesn't ring a bell. I guess I could better understand what you mean 
if I could test the patch.


Currently, the note inset inherits on screen the font of the enclosing 
text (here a section layout). It is possible to change that so that, in 
a Section heading with large and bold characters, the note uses default 
font.


I think it is a good idea that one can set an inset to not inherit the font.

However, my latest compromise suggestion was that only the first 
paragraph enherits the font of the enclosing text. It will then reflect 
the format that the text will take if the note gets dissolved.


I am not sure whether the non-inheritance or the first-paragraph 
inheritance option is preferable as default, but the current 
all-inheritance option seems confusing.


Daniel



Re: Notes inherit surrounding font

2019-09-12 Thread Jean-Marc Lasgouttes

Le 11/09/2019 à 21:56, Daniel a écrit :

On 11/9/19 15:47, Jean-Marc Lasgouttes wrote:

Le 06/09/2019 à 18:09, Daniel a écrit :

The 'surrounding layout' problem is actually more general. Suppose you
have a section, with header and associated text. Select the whole thing
and make it a branch. It will not do what you want. We really do 
need to

change the 'outside' layout in this case. (I think there might be a bug
about this, and I have done some work on the problem.)


I never used branches. So maybe that is why I never came across the
problem and cannot evaluate the benefits over the costs correctly.


Replace branch with Note or Box and the issue is the same.


I don't see what is the difference to the example I originally posted. 
Just from the description you give it seems the same and I still don't 
see why the 'sourrounding layout' is necessarily the problem.


I suspect we are not talking about the same thing. With 2.3, if you 
typeset your example, you will get a bold "1" alone on the page. This is 
an empty section. IN master, you will get an empty document. Which is 
the one that makes sense to you?


Now that the real issue is fixed (hopefully correctly), you can change 
the Note font as you want, AFAIAC.


Doesn't ring a bell. I guess I could better understand what you mean if 
I could test the patch.


Currently, the note inset inherits on screen the font of the enclosing 
text (here a section layout). It is possible to change that so that, in 
a Section heading with large and bold characters, the note uses default 
font.


JMarc


Re: Notes inherit surrounding font

2019-09-11 Thread Daniel

On 11/9/19 15:47, Jean-Marc Lasgouttes wrote:

Le 06/09/2019 à 18:09, Daniel a écrit :

The 'surrounding layout' problem is actually more general. Suppose you
have a section, with header and associated text. Select the whole thing
and make it a branch. It will not do what you want. We really do need to
change the 'outside' layout in this case. (I think there might be a bug
about this, and I have done some work on the problem.)


I never used branches. So maybe that is why I never came across the
problem and cannot evaluate the benefits over the costs correctly.


Replace branch with Note or Box and the issue is the same.


I don't see what is the difference to the example I originally posted. 
Just from the description you give it seems the same and I still don't 
see why the 'sourrounding layout' is necessarily the problem.



I have fixed this in master now.


Unfortunately, I can't test master currently.


I see. One intermediate solution would be to inherit the font only for
the first paragraph. Then my example case would still come out right in
that it will preview what the text looks like if the inset is dissolved.
And one could add smaller notes, at least at the end of a section
heading, by leaving the first line empty. Maybe not perfect but IMO a
clear improvement over the current situation.


Now that the real issue is fixed (hopefully correctly), you can change 
the Note font as you want, AFAIAC.


Doesn't ring a bell. I guess I could better understand what you mean if 
I could test the patch.


Daniel



Re: Notes inherit surrounding font

2019-09-11 Thread Jean-Marc Lasgouttes

Le 06/09/2019 à 18:09, Daniel a écrit :

The 'surrounding layout' problem is actually more general. Suppose you
have a section, with header and associated text. Select the whole thing
and make it a branch. It will not do what you want. We really do need to
change the 'outside' layout in this case. (I think there might be a bug
about this, and I have done some work on the problem.)


I never used branches. So maybe that is why I never came across the
problem and cannot evaluate the benefits over the costs correctly.


Replace branch with Note or Box and the issue is the same.

I have fixed this in master now.


I see. One intermediate solution would be to inherit the font only for
the first paragraph. Then my example case would still come out right in
that it will preview what the text looks like if the inset is dissolved.
And one could add smaller notes, at least at the end of a section
heading, by leaving the first line empty. Maybe not perfect but IMO a
clear improvement over the current situation.


Now that the real issue is fixed (hopefully correctly), you can change 
the Note font as you want, AFAIAC.


JMarc


Re: Notes inherit surrounding font

2019-09-06 Thread Daniel

On 6/9/19 17:56, Richard Kimberly Heck wrote:

On 9/6/19 11:48 AM, Daniel wrote:

On 5/9/19 13:46, Jean-Marc Lasgouttes wrote:

Le 05/09/2019 à 06:54, Daniel a écrit :

Can't test currently and I am not sure I understand correctly what
the patch does. But as far as I do, I don't think I like it. If I
understood you correctly, I can replicate the behavior of the patch
in stable LyX by inserting the inset and setting the surrounding
paragraph to Standard. But this is not intended in some cases. For
example, in order to keep description labels together, I use a label
inset that does nothing but surround the containing content with
brackets {}. So, set a paragraph to Description, enter the label
text, mark it and insert the label inset. But with your patch this
will reset the description to plain, right?


This is exact, but note that the behavior will not happen if you
insert your magic inset first and type into it afterwards. Moreover,
the patch will be tweaked to not touch layouts if the collapsible
inset forces plain layout, which I guess your label inset does (it
should anyway).

So my position is
1/ I am OK with a patch which changes the default font of note insets

2/ BUT we should be aware that this will hide a real bug (and not a
mere annoyance) that is that the layout surrounding the inset in your
example at the top of this thread should not be there. We should be
grateful for the inset to tell us that, not propose to shot the
messenger ;)

So I would like to go forward with some changes of how layouts are
set/transferred when inserting insets, regardless of the cosmetic
changes in display.

I am not convinced yet that changing the surrounding layout is the
right thing to do.

First, it seems good to get the same effect independent of the order
of inserting inset and setting layout.

Second, aren't there cases where one wants to have an inset embedded
in a non-standard layout? If so, the user might have to reset the
layout even if it was set as desired before inserting the inset.


I think there's some confusion about the issues here.

The 'surrounding layout' problem is actually more general. Suppose you
have a section, with header and associated text. Select the whole thing
and make it a branch. It will not do what you want. We really do need to
change the 'outside' layout in this case. (I think there might be a bug
about this, and I have done some work on the problem.)


I never used branches. So maybe that is why I never came across the
problem and cannot evaluate the benefits over the costs correctly.


The other issue is the font displayed within notes. JMarc is worried
about the case where the note is the only thing in the section heading
(say). I think you and I are more worried about the case where there are
other things in the section heading, but the font of the note ends up
looking too big. I see JMarc's point: There's no visual indication in
the text that we're in a section. But I also see our point: I want to
put notes in section headings sometimes, and it's annoying that they are
so huge.


I see. One intermediate solution would be to inherit the font only for
the first paragraph. Then my example case would still come out right in
that it will preview what the text looks like if the inset is dissolved.
And one could add smaller notes, at least at the end of a section
heading, by leaving the first line empty. Maybe not perfect but IMO a
clear improvement over the current situation.

Daniel


Re: Notes inherit surrounding font

2019-09-06 Thread Richard Kimberly Heck
On 9/6/19 11:48 AM, Daniel wrote:
> On 5/9/19 13:46, Jean-Marc Lasgouttes wrote:
>> Le 05/09/2019 à 06:54, Daniel a écrit :
>>> Can't test currently and I am not sure I understand correctly what
>>> the patch does. But as far as I do, I don't think I like it. If I
>>> understood you correctly, I can replicate the behavior of the patch
>>> in stable LyX by inserting the inset and setting the surrounding
>>> paragraph to Standard. But this is not intended in some cases. For
>>> example, in order to keep description labels together, I use a label
>>> inset that does nothing but surround the containing content with
>>> brackets {}. So, set a paragraph to Description, enter the label
>>> text, mark it and insert the label inset. But with your patch this
>>> will reset the description to plain, right?
>>
>> This is exact, but note that the behavior will not happen if you
>> insert your magic inset first and type into it afterwards. Moreover,
>> the patch will be tweaked to not touch layouts if the collapsible
>> inset forces plain layout, which I guess your label inset does (it
>> should anyway).
>>
>> So my position is
>> 1/ I am OK with a patch which changes the default font of note insets
>>
>> 2/ BUT we should be aware that this will hide a real bug (and not a
>> mere annoyance) that is that the layout surrounding the inset in your
>> example at the top of this thread should not be there. We should be
>> grateful for the inset to tell us that, not propose to shot the
>> messenger ;)
>>
>> So I would like to go forward with some changes of how layouts are
>> set/transferred when inserting insets, regardless of the cosmetic
>> changes in display.
> I am not convinced yet that changing the surrounding layout is the
> right thing to do.
>
> First, it seems good to get the same effect independent of the order
> of inserting inset and setting layout.
>
> Second, aren't there cases where one wants to have an inset embedded
> in a non-standard layout? If so, the user might have to reset the
> layout even if it was set as desired before inserting the inset.

I think there's some confusion about the issues here.

The 'surrounding layout' problem is actually more general. Suppose you
have a section, with header and associated text. Select the whole thing
and make it a branch. It will not do what you want. We really do need to
change the 'outside' layout in this case. (I think there might be a bug
about this, and I have done some work on the problem.)

The other issue is the font displayed within notes. JMarc is worried
about the case where the note is the only thing in the section heading
(say). I think you and I are more worried about the case where there are
other things in the section heading, but the font of the note ends up
looking too big. I see JMarc's point: There's no visual indication in
the text that we're in a section. But I also see our point: I want to
put notes in section headings sometimes, and it's annoying that they are
so huge.

Riki


>
> Daniel
>



Re: Notes inherit surrounding font

2019-09-06 Thread Daniel

On 5/9/19 13:46, Jean-Marc Lasgouttes wrote:

Le 05/09/2019 à 06:54, Daniel a écrit :
Can't test currently and I am not sure I understand correctly what the 
patch does. But as far as I do, I don't think I like it. If I 
understood you correctly, I can replicate the behavior of the patch in 
stable LyX by inserting the inset and setting the surrounding 
paragraph to Standard. But this is not intended in some cases. For 
example, in order to keep description labels together, I use a label 
inset that does nothing but surround the containing content with 
brackets {}. So, set a paragraph to Description, enter the label text, 
mark it and insert the label inset. But with your patch this will 
reset the description to plain, right?


This is exact, but note that the behavior will not happen if you insert 
your magic inset first and type into it afterwards. Moreover, the patch 
will be tweaked to not touch layouts if the collapsible inset forces 
plain layout, which I guess your label inset does (it should anyway).


So my position is
1/ I am OK with a patch which changes the default font of note insets

2/ BUT we should be aware that this will hide a real bug (and not a mere 
annoyance) that is that the layout surrounding the inset in your example 
at the top of this thread should not be there. We should be grateful for 
the inset to tell us that, not propose to shot the messenger ;)


So I would like to go forward with some changes of how layouts are 
set/transferred when inserting insets, regardless of the cosmetic 
changes in display.
I am not convinced yet that changing the surrounding layout is the right 
thing to do.


First, it seems good to get the same effect independent of the order of 
inserting inset and setting layout.


Second, aren't there cases where one wants to have an inset embedded in 
a non-standard layout? If so, the user might have to reset the layout 
even if it was set as desired before inserting the inset.


Daniel



Re: Notes inherit surrounding font

2019-09-05 Thread Jean-Marc Lasgouttes

Le 05/09/2019 à 06:54, Daniel a écrit :
Can't test currently and I am not sure I understand correctly what the 
patch does. But as far as I do, I don't think I like it. If I understood 
you correctly, I can replicate the behavior of the patch in stable LyX 
by inserting the inset and setting the surrounding paragraph to 
Standard. But this is not intended in some cases. For example, in order 
to keep description labels together, I use a label inset that does 
nothing but surround the containing content with brackets {}. So, set a 
paragraph to Description, enter the label text, mark it and insert the 
label inset. But with your patch this will reset the description to 
plain, right?


This is exact, but note that the behavior will not happen if you insert 
your magic inset first and type into it afterwards. Moreover, the patch 
will be tweaked to not touch layouts if the collapsible inset forces 
plain layout, which I guess your label inset does (it should anyway).


So my position is
1/ I am OK with a patch which changes the default font of note insets

2/ BUT we should be aware that this will hide a real bug (and not a mere 
annoyance) that is that the layout surrounding the inset in your example 
at the top of this thread should not be there. We should be grateful for 
the inset to tell us that, not propose to shot the messenger ;)


So I would like to go forward with some changes of how layouts are 
set/transferred when inserting insets, regardless of the cosmetic 
changes in display.


JMarc


Re: Notes inherit surrounding font

2019-09-04 Thread Daniel

On 2019-09-04 19:42, Richard Kimberly Heck wrote:

On 9/4/19 10:30 AM, Jean-Marc Lasgouttes wrote:

Le 24/08/2019 à 07:49, Daniel a écrit :

Currently, IMO, notes behave in an unfortunate way in that they
inherit the surrounding font.

Consider the attached document which has the following structure:

*Section*
Text

The first line is formatted as a section heading and the second as
standard text.

In Lyx, select all text in the document and insert a note.

The actual result is that all the text looks as if it where formatted
as section. This is misleading. It is also in many cases annoying.
For example, when adding a longer note to a section heading it
becomes huge.


This is not misleading.


I don't know if it's misleading, but I find it slightly annoying that
the font of the note is so huge. I might want a note in a non-empty
section heading to remind me of something, but I don't need it to be the
same size as the heading itself. There's no real need for it to be, either.

Riki


I could not agree more.

Daniel




Re: Notes inherit surrounding font

2019-09-04 Thread Daniel

On 2019-09-04 16:30, Jean-Marc Lasgouttes wrote:

Le 24/08/2019 à 07:49, Daniel a écrit :
Currently, IMO, notes behave in an unfortunate way in that they 
inherit the surrounding font.


Consider the attached document which has the following structure:

*Section*
Text

The first line is formatted as a section heading and the second as 
standard text.


In Lyx, select all text in the document and insert a note.

The actual result is that all the text looks as if it where formatted 
as section. This is misleading. It is also in many cases annoying. For 
example, when adding a longer note to a section heading it becomes huge.


This is not misleading. This indicates that your note is actuall 
embedded in a paragraph with style Section, so that the empty paragraph 
will be output as

   \section{]

This is the behavior that we shall fix.

I propose in the following patch to reset the outer layout to Plain if 
it only contains the newly insert inset.


I'd appreciate if somebody could try t out to see whether I missed 
something obvious. This behavior has been annoying me for ages and I am 
sure we have several bug reports about that.


JMarc

Can't test currently and I am not sure I understand correctly what the 
patch does. But as far as I do, I don't think I like it. If I understood 
you correctly, I can replicate the behaviour of the patch in stable LyX 
by inserting the inset and setting the sourrounding paragraph to 
Standard. But this is not intended in some cases. For example, in order 
to keep description labels together, I use a label inset that does 
nothing but sourround the containing content with brackets {}. So, set a 
paragraph to Description, enter the label text, mark it and insert the 
label inset. But with your patch this will reset the description to 
plain, right?


Daniel



Re: Notes inherit surrounding font

2019-09-04 Thread Richard Kimberly Heck
On 9/4/19 10:30 AM, Jean-Marc Lasgouttes wrote:
> Le 24/08/2019 à 07:49, Daniel a écrit :
>> Currently, IMO, notes behave in an unfortunate way in that they
>> inherit the surrounding font.
>>
>> Consider the attached document which has the following structure:
>>
>> *Section*
>> Text
>>
>> The first line is formatted as a section heading and the second as
>> standard text.
>>
>> In Lyx, select all text in the document and insert a note.
>>
>> The actual result is that all the text looks as if it where formatted
>> as section. This is misleading. It is also in many cases annoying.
>> For example, when adding a longer note to a section heading it
>> becomes huge.
>
> This is not misleading. 

I don't know if it's misleading, but I find it slightly annoying that
the font of the note is so huge. I might want a note in a non-empty
section heading to remind me of something, but I don't need it to be the
same size as the heading itself. There's no real need for it to be, either.

Riki




Re: Notes inherit surrounding font

2019-09-04 Thread Jean-Marc Lasgouttes

Le 24/08/2019 à 07:49, Daniel a écrit :
Currently, IMO, notes behave in an unfortunate way in that they inherit 
the surrounding font.


Consider the attached document which has the following structure:

*Section*
Text

The first line is formatted as a section heading and the second as 
standard text.


In Lyx, select all text in the document and insert a note.

The actual result is that all the text looks as if it where formatted as 
section. This is misleading. It is also in many cases annoying. For 
example, when adding a longer note to a section heading it becomes huge.


This is not misleading. This indicates that your note is actuall 
embedded in a paragraph with style Section, so that the empty paragraph 
will be output as

  \section{]

This is the behavior that we shall fix.

I propose in the following patch to reset the outer layout to Plain if 
it only contains the newly insert inset.


I'd appreciate if somebody could try t out to see whether I missed 
something obvious. This behavior has been annoying me for ages and I am 
sure we have several bug reports about that.


JMarc

From 68872c28ebf8c479e08580d4b5f785f5c99f9561 Mon Sep 17 00:00:00 2001
From: Jean-Marc Lasgouttes 
Date: Wed, 4 Sep 2019 16:13:22 +0200
Subject: [PATCH] Reset layout when inserting an inset over full paragraph(s)

When inserting an inset over a selection, it makes sense if the
selection covers a complete or several paragraphs to reset the layout of
the paragraph that contains the inset to plain layout. In general the
inner inset will have the needed layout information and it does not
make sense to keep this information outside.

Note that this does not work as intended when change tracking is enabled.
---
 src/Text3.cpp | 16 ++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/Text3.cpp b/src/Text3.cpp
index 57d44a1..0ba8083 100644
--- a/src/Text3.cpp
+++ b/src/Text3.cpp
@@ -293,11 +293,22 @@ static bool doInsertInset(Cursor & cur, Text * text,
 	}
 
 	bool gotsel = false;
+	bool reset_layout = false;
 	if (cur.selection()) {
 		if (cmd.action() == LFUN_INDEX_INSERT)
 			copySelectionToTemp(cur);
-		else
+		else {
 			cutSelectionToTemp(cur, pastesel);
+			/* No need to keep layout information if the inset has
+			 * eaten the whole paragraph.
+			 * FIXME: this does not work as expected when change tracking is on
+			 *   However, we do not really know what to do in this case.
+			 */
+			if (cur.paragraph().empty()) {
+cur.paragraph().setPlainOrDefaultLayout(bparams.documentClass());
+reset_layout = true;
+			}
+		}
 		cur.clearSelection();
 		gotsel = true;
 	} else if (cmd.action() == LFUN_INDEX_INSERT) {
@@ -320,7 +331,8 @@ static bool doInsertInset(Cursor & cur, Text * text,
 	InsetText * inset_text = inset->asInsetText();
 	if (inset_text) {
 		inset_text->fixParagraphsFont();
-		if (!inset_text->allowMultiPar() || cur.lastpit() == 0) {
+		if (!inset_text->allowMultiPar()
+		|| (cur.lastpit() == 0 && !reset_layout)) {
 			// reset first par to default
 			cur.text()->paragraphs().begin()
 ->setPlainOrDefaultLayout(bparams.documentClass());
-- 
2.7.4



Notes inherit surrounding font

2019-08-23 Thread Daniel
Currently, IMO, notes behave in an unfortunate way in that they inherit 
the surrounding font.


Consider the attached document which has the following structure:

*Section*
Text

The first line is formatted as a section heading and the second as 
standard text.


In Lyx, select all text in the document and insert a note.

The actual result is that all the text looks as if it where formatted as 
section. This is misleading. It is also in many cases annoying. For 
example, when adding a longer note to a section heading it becomes huge.


The basic problem is that everything that is formatted as Standard/Plain 
Layout inherits the font the paragraph the note is placed in.


Arguably, there are also positive aspects of the current behavior. For 
example, a one paragraph note with plain text will give the user a 
preview of what the text will look like if the note is dissolved. 
However, I don't think this aspect is outweighs the costs, in 
particular, it is inconsistent as the example from the attached document 
shows above shows.


In another thread 
(https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg209605.html) 
Riki suggest the following two cures:


1. Explicitly set a font on the note:

InsetLayout Note:Note
Font
Size normal
Shape up
Series medium
EndFont
End

This works fine for me.

2. Let the font automatically reset in the note:

InsetLayout Note:Note
ResetsFont true
End

The documentation sounds like this should work as well:

ResetsFont [0, 1] Whether this inset should use the font of its 
surrounding environment or uses its own. Default is false: use the font 
of the surrounding environment.


However, as Riki notes, it does not work. And the documentation seems a 
bit ambiguous to me.


I'd be happy to hear what people think about changing the notes behavior 
and what might be the best way to do it.


Daniel
#LyX 2.3 created this file. For more info see http://www.lyx.org/
\lyxformat 544
\begin_document
\begin_header
\save_transient_properties true
\origin unavailable
\textclass article
\use_default_options true
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding global
\font_roman "default" "default"
\font_sans "default" "default"
\font_typewriter "default" "default"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\use_microtype false
\use_dash_ligatures true
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\use_hyperref false
\papersize default
\use_geometry false
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 1
\use_minted 0
\index Index
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\is_math_indent 0
\math_numbering_side default
\quotes_style english
\dynamic_quotes 0
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header

\begin_body

\begin_layout Section*
Section
\end_layout

\begin_layout Standard
Text
\end_layout

\end_body
\end_document