Re: optional line break, ldots (patch, fileformat)

2017-04-18 Thread Jürgen Spitzmüller
Am Dienstag, den 18.04.2017, 22:34 + schrieb Guenter Milde:
> It is an undocumented internal. At least some developers don't bother
> about
> the actual LaTeX written, so the difference between specialchar and
> literal
> char went unnoticed until now.

Note that I am not talking about the difference between the unicode
char and the special char. I am talking about the fact that the special
char outputs \ldots, not \dots. This I would not call "undocumented".

> > It is obvious that the special char
> > inset outputs \ldots, so I need to redefine that macro. Would the
> > special char output \dots, I would have re-defined that.
> 
> What would you have done, if both, the literal character and the
> specialchar had output \dots?

I would have refefined \dots and used \ldots in ERT for the unbalanced
dots, probably.

> > In any case, we should not replace one macro by the other behind
> > the
> > back of users, just because they are equivalent by default (outside
> > math, that is).
> 
> They are equivalent in text on purpose.

So what? They can be redefined, and we have to consider that.

> > > I read a bit about \ldots, \dots and friends (in the LaTeX
> > > companion),  and it seems now that the situation is not very
> > > simple.
> > > It looks to me  like a case where the SpecialChar inset should
> > > output
> > > different things  depending on the language.
> > I don't think so. Rather than that, we could consider to support
> > the
> > ellipsis (or xellipsis) package, or csquotes, or a combination of
> > those.
> 
> The ellipsis package ignores \ldots (in both, implementation and
> documentation). I am not sure whether this is intedend or just an
> oversight.
> 
> We can support the ellipsis package by using \textellipsis or \dots
> as
> LICR for the ellipsis character. \usepackage{ellipsis} in the user
> preamble should also solve your problem with […].

Look, I am talking about backwards compatibility. I can easily deal
with future documents, but I do not want to edit hundreds of old
documents because you insist to let lyx2lyx change \ldots to \dots.

So please make sure lyx2lyx generates identical LaTeX output if you
insist to ditch the special char.

Jürgen

> > > What is a good reference on the subject?
> > The ellipsis manual, for a start:
> > http://mirrors.ctan.org/macros/latex/contrib/ellipsis/ellipsis.pdf
> 
> I studied this and appended a test document to the ticket.
> http://www.lyx.org/trac/ticket/10543
> 
> Günter
> 
> 

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


Re: [LyX/master] lyx2lyx/lyx_2_2.py: correct reversion of boxes

2017-04-18 Thread Scott Kostyshak
On Mon, Apr 17, 2017 at 04:06:56AM +0200, Uwe Stöhr wrote:
> commit 5b4cc6b6c84b4d3b35e7122a6ee9160816d2e108
> Author: Uwe Stöhr 
> Date:   Mon Apr 17 04:06:52 2017 +0200
> 
> lyx2lyx/lyx_2_2.py: correct reversion of boxes

git bisect suggests that this commit broke the test

  export/doc/Math_lyx21

Uwe, can you take a look?

Scott


signature.asc
Description: PGP signature


Re: [patch] support for document class option leqno

2017-04-18 Thread Uwe Stöhr

El 19.04.2017 a las 00:27, Uwe Stöhr escribió:


Attached is the patch.


Hi JMarc,

the patch misses the visualization within LYX. I have the same problem 
as with the visualization of mathindent. I cannot find where in the code 
we set draw the general math inset. You said that you will do something 
for mathindent maybe you could give me also a hint for the formula number?


thanks and regards
Uwe


Re: optional line break, ldots (patch, fileformat)

2017-04-18 Thread Guenter Milde
On 2017-04-18, Jürgen Spitzmüller wrote:
> Am Dienstag, den 18.04.2017, 10:26 +0200 schrieb Jean-Marc Lasgouttes:

>> > Why?

>> The fact is the you rely on an undocumented behavior of LyX to
>> obtain  what you want :)

> I wouldn't count it undocumented.

It is an undocumented internal. At least some developers don't bother about
the actual LaTeX written, so the difference between specialchar and literal
char went unnoticed until now.

> It is obvious that the special char
> inset outputs \ldots, so I need to redefine that macro. Would the
> special char output \dots, I would have re-defined that.

What would you have done, if both, the literal character and the
specialchar had output \dots?

> In any case, we should not replace one macro by the other behind the
> back of users, just because they are equivalent by default (outside
> math, that is).

They are equivalent in text on purpose.

>> I read a bit about \ldots, \dots and friends (in the LaTeX
>> companion),  and it seems now that the situation is not very simple.
>> It looks to me  like a case where the SpecialChar inset should output
>> different things  depending on the language.

> I don't think so. Rather than that, we could consider to support the
> ellipsis (or xellipsis) package, or csquotes, or a combination of
> those.

The ellipsis package ignores \ldots (in both, implementation and
documentation). I am not sure whether this is intedend or just an oversight.

We can support the ellipsis package by using \textellipsis or \dots as
LICR for the ellipsis character. \usepackage{ellipsis} in the user
preamble should also solve your problem with […].

>> What is a good reference on the subject?

> The ellipsis manual, for a start:
> http://mirrors.ctan.org/macros/latex/contrib/ellipsis/ellipsis.pdf

I studied this and appended a test document to the ticket.
http://www.lyx.org/trac/ticket/10543

Günter




Re: [LyX/master] BufferParams: get rid of the HSpace class for mathindent as requested by JMarc

2017-04-18 Thread Uwe Stöhr

El 18.04.2017 a las 22:45, Uwe Stöhr escribió:


I am insisting because I will send right now a patch


I sent it now and CCed you. Could you please have a look?

thanks and regards
Uwe


[patch] support for document class option leqno

2017-04-18 Thread Uwe Stöhr
LyX 2.3 will support the document class option fleqn so I thin the other 
generic math document class option "leqno" should be supported as well.


Attached is the patch.

There shouldn't be controversies except of the place of the combobox (an 
the name of its label of course ;-) ). I put it in the document settings 
math panel because i thinks it belongs there together with the fleqn 
setting (that is currently in the text layout panel).


regards Uwe
 lib/lyx2lyx/lyx_2_3.py| 43 ++-
 src/BufferParams.cpp  |  7 +++
 src/BufferParams.h|  3 ++
 src/frontends/qt4/GuiDocument.cpp | 24 ++-
 src/frontends/qt4/ui/MathsUi.ui   | 90 +++
 src/tex2lyx/Preamble.cpp  |  9 
 src/tex2lyx/Preamble.h|  1 +
 src/version.h |  4 +-
 8 files changed, 150 insertions(+), 31 deletions(-)

diff --git a/lib/lyx2lyx/lyx_2_3.py b/lib/lyx2lyx/lyx_2_3.py
index e03b2b9ee6..f89f73c4a5 100644
--- a/lib/lyx2lyx/lyx_2_3.py
+++ b/lib/lyx2lyx/lyx_2_3.py
@@ -2123,6 +2123,45 @@ def revert_rotfloat(document):
 i = i + 1
 
 
+def convert_mathnumberside(document):
+" add the \\math_number_left tag "
+# check if the document uses the class option "leqno"
+k = find_token(document.header, "\\quotes_style", 0)
+regexp = re.compile(r'^.*leqno.*')
+i = find_re(document.header, regexp, 0)
+if i != -1:
+document.header.insert(k, "\\math_number_left 1")
+# delete the found option
+document.header[i] = document.header[i].replace(",leqno", "")
+document.header[i] = document.header[i].replace(", leqno", "")
+document.header[i] = document.header[i].replace("leqno,", "")
+j = find_re(document.header, regexp, 0)
+if i == j:
+# then we have fleqn as the only option
+del document.header[i]
+else:
+document.header.insert(k, "\\math_number_left 0")
+
+
+def revert_mathnumberside(document):
+" add the document class option leqno"
+regexp = re.compile(r'(\\math_number_left 1)')
+i = find_re(document.header, regexp, 0)
+if i == -1:
+regexp = re.compile(r'(\\math_number_left)')
+j = find_re(document.header, regexp, 0)
+del document.header[j]
+else:
+k = find_token(document.header, "\\options", 0)
+if k != -1:
+   document.header[k] = document.header[k].replace("\\options", 
"\\options leqno,")
+   del document.header[i]
+else:
+l = find_token(document.header, "\\use_default_options", 0)
+document.header.insert(l, "\\options leqno")
+del document.header[i + 1]
+
+
 ##
 # Conversion hub
 #
@@ -2160,10 +2199,12 @@ convert = [
[537, []],
[538, [convert_mathindent]],
[539, []],
-   [540, []]
+   [540, []],
+   [541, [convert_mathnumberside]]
   ]
 
 revert =  [
+   [540, [revert_mathnumberside]],
[539, [revert_rotfloat]],
[538, [revert_baselineskip]],
[537, [revert_mathindent]],
diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp
index 9f05fe8156..305f6a8b6b 100644
--- a/src/BufferParams.cpp
+++ b/src/BufferParams.cpp
@@ -385,6 +385,7 @@ BufferParams::BufferParams()
paragraph_separation = ParagraphIndentSeparation;
is_math_indent = false;
math_indentation = "default";
+   math_number_left = false;
quotes_style = InsetQuotesParams::EnglishQuotes;
dynamic_quotes = false;
fontsize = "default";
@@ -839,6 +840,8 @@ string BufferParams::readToken(Lexer & lex, string const & 
token,
lex >> is_math_indent;
} else if (token == "\\math_indentation") {
lex >> math_indentation;
+   } else if (token == "\\math_number_left") {
+   lex >> math_number_left;
} else if (token == "\\quotes_style") {
string qstyle;
lex >> qstyle;
@@ -1339,6 +1342,7 @@ void BufferParams::writeFile(ostream & os, Buffer const * 
buf) const
os << "\n\\is_math_indent " << is_math_indent;
if (is_math_indent && math_indentation != "default")
os << "\n\\math_indentation " << math_indentation;
+   os << "\n\\math_number_left " << math_number_left;
os << "\n\\quotes_style "
   << string_quotes_style[quotes_style]
   << "\n\\dynamic_quotes " << dynamic_quotes
@@ -1623,6 +1627,9 @@ bool BufferParams::writeLaTeX(otexstream & os, 
LaTeXFeatures & features,
if (is_math_indent)
clsoptions << "fleqn,";
 
+   if (math_number_left)
+   clsoptions << "leqno,";
+
// language should be a parameter to \documentclass
if (language->babel() == "hebrew"
&& default_language->babel() != "hebrew")
diff --git a/src/BufferParams.h b/src/BufferParams.h
index 437d00b700..6fdfe3ad31

Re: [patch] for LyX 2.2.3 - box reversion lyx2lyx

2017-04-18 Thread Uwe Stöhr

El 17.04.2017 a las 21:57, Richard Heck escribió:


I will look these over and commit them if they're acceptable.


Attached are the obvious "\\" fixes that should be backported.

regards
Uwe
diff --git 
"a/C:\\Users\\Usti\\AppData\\Local\\Temp\\TortoiseGit\\lyx_2_0-0271602.002.py" 
"b/D:\\LyXGit\\2.2.x\\lib\\lyx2lyx\\lyx_2_0.py"
index 324c4130b8..1515e3cf12 100644
--- 
"a/C:\\Users\\Usti\\AppData\\Local\\Temp\\TortoiseGit\\lyx_2_0-0271602.002.py"
+++ "b/D:\\LyXGit\\2.2.x\\lib\\lyx2lyx\\lyx_2_0.py"
@@ -1,6 +1,5 @@
 # -*- coding: utf-8 -*-
 # This file is part of lyx2lyx
-# -*- coding: utf-8 -*-
 # Copyright (C) 2011 The LyX team
 #
 # This program is free software; you can redistribute it and/or
@@ -279,8 +278,8 @@ def revert_xetex(document):
 pretext.append(tw)
 if osf:
 pretext.append('\\defaultfontfeatures{Numbers=OldStyle}')
-pretext.append('\usepackage{xunicode}')
-pretext.append('\usepackage{xltxtra}')
+pretext.append('\\usepackage{xunicode}')
+pretext.append('\\usepackage{xltxtra}')
 insert_to_preamble(document, pretext)
 
 
@@ -1686,7 +1685,7 @@ def revert_nameref(document):
   document.body[stins:endins + 1] = newcontent
 
   if foundone:
-add_to_preamble(document, ["\usepackage{nameref}"])
+add_to_preamble(document, ["\\usepackage{nameref}"])
 
 
 def remove_Nameref(document):
diff --git 
"a/C:\\Users\\Usti\\AppData\\Local\\Temp\\TortoiseGit\\lyx_2_1-0271602.001.py" 
"b/D:\\LyXGit\\2.2.x\\lib\\lyx2lyx\\lyx_2_1.py"
index 259d51e328..b0d751cd57 100644
--- 
"a/C:\\Users\\Usti\\AppData\\Local\\Temp\\TortoiseGit\\lyx_2_1-0271602.001.py"
+++ "b/D:\\LyXGit\\2.2.x\\lib\\lyx2lyx\\lyx_2_1.py"
@@ -1,6 +1,5 @@
 # -*- coding: utf-8 -*-
 # This file is part of lyx2lyx
-# -*- coding: utf-8 -*-
 # Copyright (C) 2011 The LyX team
 #
 # This program is free software; you can redistribute it and/or
@@ -980,7 +979,7 @@ def revert_cell_rotation(document):
 
   finally:
 if load_rotating:
-  add_to_preamble(document, 
["\\@ifundefined{turnbox}{\usepackage{rotating}}{}"])
+  add_to_preamble(document, 
["\\@ifundefined{turnbox}{\\usepackage{rotating}}{}"])
 
 
 def convert_cell_rotation(document):
@@ -1039,7 +1038,7 @@ def revert_table_rotation(document):
 
   finally:
 if load_rotating:
-  add_to_preamble(document, 
["\\@ifundefined{turnbox}{\usepackage{rotating}}{}"])
+  add_to_preamble(document, 
["\\@ifundefined{turnbox}{\\usepackage{rotating}}{}"])
 
 
 def convert_table_rotation(document):


Re: [LyX/master] BufferParams: rename formula_indent to math_indent etc. as requested

2017-04-18 Thread Uwe Stöhr

El 18.04.2017 a las 22:57, Uwe Stöhr escribió:


Since the default is now no longer "default" this fails.


Ah, I see now that you already fixed this.

regards Uwe


Re: [LyX/master] BufferParams: rename formula_indent to math_indent etc. as requested

2017-04-18 Thread Uwe Stöhr

El 18.04.2017 a las 14:52, Jean-Marc Lasgouttes escribió:


Do I?


Yes, always get

\paragraph_separation indent
\paragraph_indentation default

but it should simply be

\paragraph_separation indent

There is no need to pollute the LyX file with unnecessary info. We only 
output the things that we really need. This is LyX's behavior even prior 
to my appearance at LyX.
Just look in buffer.cpp for .erase() for how many fileformat tags we do 
this.


Now that I checked, paragraph indentation was already written to file in 
2.2, although the value was "default". I will fix that, since I have no 
interest in fixing the file format for now.


OK. Then \paragraph_indentation is an exception of our "rule".

regards Uwe


Re: [LyX/master] BufferParams: rename formula_indent to math_indent etc. as requested

2017-04-18 Thread Uwe Stöhr

El 18.04.2017 a las 14:59, Jean-Marc Lasgouttes escribió:


Does it really break, or do you think it does?


In lyx_2_0.py we have:

---
def revert_paragraph_indentation(document):
" Revert custom paragraph indentation to preamble code "
i = find_token(document.header, "\\paragraph_indentation", 0)
if i == -1:
  return
length = get_value(document.header, "\\paragraph_indentation", i)
# we need only remove the line if indentation is default
if length != "default":
  # handle percent lengths
  length = latex_length(length)[1]
  insert_to_preamble(document, ["\\setlength{\\parindent}{" + 
length + "}"])

del document.header[i]
---

Since the default is now no longer "default" this fails.

I once introduced the HSpace class mainly to support \hspace{} 
completely. I also used it for the paragraph indentation. I agree that 
today this is no longer sensible. So it is OK to transform it but the 
fileformat should be kept stable. If you change it, a fileformat change 
is necessary.


It is time to output correct files, especially wrt spaces. It would be a 
good thing to use everywhere quotes as good space guard. We had a large 
number of bugs where people cannot read their file back because they put 
a space somewhere (cf recent thread on space in branch names).


I don't understand. it is a length so t cannot change spaces.

Nevertheless, this is not my point here, and I will revert the quotes. 
Especially since I just checked that even GlueLength cannot have spaces 
in them.


Exactly.

regards Uwe


Re: [LyX/master] BufferParams: get rid of the HSpace class for mathindent as requested by JMarc

2017-04-18 Thread Uwe Stöhr

El 18.04.2017 a las 15:54, Jean-Marc Lasgouttes escribió:

Getting rid of the proper length in favor of the weird string version 
was definitely not what I had in mind.


I cannot follow you anymore. What i did is just what the HSpace class 
does - it is a string using "default" ads default value. If you prefer 
an empty string or the Length class, fine by me. If possible I would had 
it over to you because i think you have something different in mind as I 
have. So please feel free to override my changes and to transform it as 
you like.


Besides this I insist on having the math indentation settings in the 
math panel for LyX 2.3. Günter agreed as well and I haven't heard other 
opinions. I am insisting because I will send right now a patch that also 
supports the document class option "lineno". No matter if this will make 
it in for LyX 2.3.0 or not, I think both options belong together and the 
place of the formula numbering is definitely nothing that belongs to text.


thanks and regards
Uwe


Re: [LyX/master] BufferParams: rename formula_indent to math_indent etc. as requested

2017-04-18 Thread Kornel Benko
Am Dienstag, 18. April 2017 um 20:52:07, schrieb Jean-Marc Lasgouttes 

> Le 18/04/2017 à 18:57, Kornel Benko a écrit :
> > Am Dienstag, 18. April 2017 um 18:22:00, schrieb Jean-Marc Lasgouttes 
> > 
> >> Le 18/04/2017 à 14:52, Jean-Marc Lasgouttes a écrit :
> >>> The default value has unit==NONE, which is the definition of an empty
> >>> length. An empty length is not of size 0, it is undefined. This is what
> >>> is obtained when the entry field is left empty. What is wrong with that?
> >>
> >> The Length constructor with an empty string did not do what it should
> >> have done. I fixed that now.
> >>
> >> With my latest commit, everything should be OK.
> >>
> >> JMarc
> >
> > Really?
> > # ctest -R export/doc/Math_lyx21
> > gives in LastTest.log
> 
> Is this my doing? I'll check it out tomorrow.
> 
> JMarc

If I interpret Uwe well
> >   No, it introduces bugs.
> > 
> > You also use now
> > 
> > \paragraph_indentation "23bp"
> > 
> > instead of the former
> > 
> > \paragraph_indentation 23bp
> > 
> > the quotes change the fileformat and break lyx2lyx routines.
then yes.
But I was checking the message from Scott.
> On master (17a53bbc), the command
> 
> ctest -R "Math_lyx"
> 
> gives
> 
> ...
> The following tests FAILED:
> 1530 - export/doc/Math_lyx16 (Failed)
> 1531 - export/doc/Math_lyx21 (Failed)
> 
> Scott

It's maybe coincidence only.

Kornel


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


Re: [LyX/master] BufferParams: rename formula_indent to math_indent etc. as requested

2017-04-18 Thread Jean-Marc Lasgouttes

Le 18/04/2017 à 18:57, Kornel Benko a écrit :

Am Dienstag, 18. April 2017 um 18:22:00, schrieb Jean-Marc Lasgouttes 


Le 18/04/2017 à 14:52, Jean-Marc Lasgouttes a écrit :

The default value has unit==NONE, which is the definition of an empty
length. An empty length is not of size 0, it is undefined. This is what
is obtained when the entry field is left empty. What is wrong with that?


The Length constructor with an empty string did not do what it should
have done. I fixed that now.

With my latest commit, everything should be OK.

JMarc


Really?
# ctest -R export/doc/Math_lyx21
gives in LastTest.log


Is this my doing? I'll check it out tomorrow.

JMarc



Re: [LyX/master] BufferParams: rename formula_indent to math_indent etc. as requested

2017-04-18 Thread Kornel Benko
Am Dienstag, 18. April 2017 um 18:22:00, schrieb Jean-Marc Lasgouttes 

> Le 18/04/2017 à 14:52, Jean-Marc Lasgouttes a écrit :
> > The default value has unit==NONE, which is the definition of an empty
> > length. An empty length is not of size 0, it is undefined. This is what
> > is obtained when the entry field is left empty. What is wrong with that?
> 
> The Length constructor with an empty string did not do what it should 
> have done. I fixed that now.
> 
> With my latest commit, everything should be OK.
> 
> JMarc

Really?
# ctest -R export/doc/Math_lyx21
gives in LastTest.log
...
-- Expected result file "Math.21.21.lyx" exists
-- Error line = insets/InsetQuotes.cpp (110): ERROR 
(InsetQuotes::InsetQuotes): bad string length.
-- Error line = insets/InsetQuotes.cpp (143): ERROR 
(InsetQuotes::InsetQuotes): bad string length.
-- Error line = insets/InsetQuotes.cpp (176): ERROR 
(InsetQuotes::InsetQuotes): bad string length.
-- Error line = Lexer.cpp (933): Missing '\end_inset'-tag in 
InsetQuotes::read. Got shadowsize instead. Line: 10646
-- Error line = Paragraph ended in line 10650
-- Error line = Missing \end_layout.
-- Exporting Math.lyx to lyx21x

Kornel


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


Re: [LyX/master] BufferParams: rename formula_indent to math_indent etc. as requested

2017-04-18 Thread Jean-Marc Lasgouttes

Le 18/04/2017 à 14:52, Jean-Marc Lasgouttes a écrit :

The default value has unit==NONE, which is the definition of an empty
length. An empty length is not of size 0, it is undefined. This is what
is obtained when the entry field is left empty. What is wrong with that?


The Length constructor with an empty string did not do what it should 
have done. I fixed that now.


With my latest commit, everything should be OK.

JMarc


Re: [LyX/master] BufferParams: get rid of the HSpace class for mathindent as requested by JMarc

2017-04-18 Thread Jean-Marc Lasgouttes

Le 17/04/2017 à 20:32, Uwe Stöhr a écrit :

commit d9a2a4026800865b15da186620ffab4c6b409765
Author: Uwe Stöhr 
Date:   Mon Apr 17 20:32:31 2017 +0200

BufferParams: get rid of the HSpace class for mathindent as requested by 
JMarc


Getting rid of the proper length in favor of the weird string version 
was definitely not what I had in mind. What I meant is that the HSpace 
class is not useful and that a simple Length class would have been a 
better choice.


I'll see what I can do. I will propose a patch that reverts your this 
commit and does something similar to what I did for parindent.


JMarc


Re: [LyX/master] BufferParams: rename formula_indent to math_indent etc. as requested

2017-04-18 Thread Jean-Marc Lasgouttes

Le 17/04/2017 à 19:57, Uwe Stöhr a écrit :

El 17.04.2017 a las 19:53, Uwe Stöhr escribió:


No, it introduces bugs.


You also use now

\paragraph_indentation "23bp"

instead of the former

\paragraph_indentation 23bp

the quotes change the fileformat and break lyx2lyx routines.


Does it really break, or do you think it does?

It is time to output correct files, especially wrt spaces. It would be a 
good thing to use everywhere quotes as good space guard. We had a large 
number of bugs where people cannot read their file back because they put 
a space somewhere (cf recent thread on space in branch names).


Nevertheless, this is not my point here, and I will revert the quotes. 
Especially since I just checked that even GlueLength cannot have spaces 
in them.


JMarc


Re: [LyX/master] BufferParams: rename formula_indent to math_indent etc. as requested

2017-04-18 Thread Jean-Marc Lasgouttes

Le 17/04/2017 à 19:53, Uwe Stöhr a écrit :

El 17.04.2017 a las 18:32, Jean-Marc Lasgouttes escribió:


I do not have time right now, but I just committed a patch for
parindent. Does it help?


No, it introduces bugs. Noe you use "0pt" as default value but this is
not correct. We don't know the default value of parindent.


The default value has unit==NONE, which is the definition of an empty 
length. An empty length is not of size 0, it is undefined. This is what 
is obtained when the entry field is left empty. What is wrong with that?



Moreover you write now parindent to the LyX file in every case, no matter if the
default is chosen.


Do I? This is not on purpose. OTOH, I think that it is a very bad idea 
to output different preamble entries depending on variables. It serves 
to real purpose, and can only confuse lyx2lyx.
Now that I checked, paragraph indentation was already written to file in 
2.2, although the value was "default". I will fix that, since I have no 
interest in fixing the file format for now.


JMarc




Re: optional line break, ldots (patch, fileformat)

2017-04-18 Thread Jürgen Spitzmüller
Am Dienstag, den 18.04.2017, 10:26 +0200 schrieb Jean-Marc Lasgouttes:
> > Why?
> 
> The fact is the you rely on an undocumented behavior of LyX to
> obtain 
> what you want :)

I wouldn't count it undocumented. It is obvious that the special char
inset outputs \ldots, so I need to redefine that macro. Would the
special char output \dots, I would have re-defined that.

In any case, we should not replace one macro by the other behind the
back of users, just because they are equivalent by default (outside
math, that is).

> I read a bit about \ldots, \dots and friends (in the LaTeX
> companion), 
> and it seems now that the situation is not very simple. It looks to
> me 
> like a case where the SpecialChar inset should output different
> things 
> depending on the language.

I don't think so. Rather than that, we could consider to support the
ellipsis (or xellipsis) package, or csquotes, or a combination of
those.

> What is a good reference on the subject?

The ellipsis manual, for a start:
http://mirrors.ctan.org/macros/latex/contrib/ellipsis/ellipsis.pdf

> 
> JMarc
> 
> 

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


Re: [LyX/master] findadv: avoid crash when regexp-based search fails (mitigates #10625).

2017-04-18 Thread Kornel Benko
Am Dienstag, 18. April 2017 um 01:46:46, schrieb Tommaso Cucinotta 

> On 18/04/2017 01:04, Kornel Benko wrote:
> >> So, I'd be in favor of using -SIGQUIT immediately on "TestEnd" in 
> >> keytest.py, falling back to "kill -9" if LyX doesn't quit within  0.5 
> >> secs ?
> >> (without adding the \Ax work-around in test cases, that should not bee 
> >> needed anymore).
> >
> > It may be too early. We should know first if the previously sent keystrokes 
> > ere processed.
> > But at least we could try.
> 
> right, I saw your other comment. I had somewhere in keytest.py code that 
> doesn't send a key press unless the process is sleeping :-); this was needed 
> otherwise when we have "KK: [long] sequence of keypresses", it was possible 
> to loose keys on the go; however, the lyx_sleeping() might not be too 
> precise, perhaps another way is to catch the end of LFUN processing via 
> logging ?
> 
> Thanks,
> 
>   T.

ATM I am in favour of a new function, say "lyx-exit-hard" which could be 
implemented in
src/frontends/qt4/GuiApplication.cpp, like:
case LFUN_LYX_EXIT_HARD:
BufferList::iterator bit = theBufferList().begin();
BufferList::iterator const bend = theBufferList().end();
for (; bit != bend; ++bit) {
Buffer * buf = *bit;
buf->markClean();
}
if (theApp())
theApp()->exit(0);
else
exit(0);

Kornel

P.S. I tried a new signal handler for SIGTERM (because SIGHUP is not defined on 
Windows)
but then I could not find a suitable place to check for the variable set in 
this handler.

Do you know how can we create an event from inside the handler so that this 
function will be called?


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


Re: [LyX/master] findadv: avoid crash when regexp-based search fails (mitigates #10625).

2017-04-18 Thread Jean-Marc Lasgouttes

Le 17/04/2017 à 23:35, Tommaso Cucinotta a écrit :

that's one of the drawbacks of a clean shutdown, we'd have to wait for
it, slowing down tests. Perhaps alternate ways might be to just kill -9
as it is already now, but introduce:
-) either a command-line option to force lyxerr << flush on every
LYXERR() call, that we'd only use on tests


I am not sure that I understand. LYXERR uses endl, so I am not sure that 
there is something to flush.


JMarc



Re: Tentative schedule for 2.3.0 release

2017-04-18 Thread Stephan Witt
Am 15.04.2017 um 15:06 schrieb mn :
> 
> On 15.04.17 14:29, Stephan Witt wrote:
>> 
>>> Am 15.04.2017 um 10:08 schrieb mn :
>>> 
>>> On 14.04.17 22:31, Stephan Witt wrote:
 Am 12.04.2017 um 21:51 schrieb mn :
>>> 
>> SVGs are already compressed. What procedure do you propose at
>>> shipping time?
> 
> 
> To use for example this: https://github.com/RazrFalcon/svgcleaner
 
 I don’t think such things belong to the packaging process. 
>>> 
>>> 
>>> That it is postponeed to shippping time was a concern regarding
>>> editability of the files.
>>> It seems nobody edits them in the lyx-git, they are imported?
>>> So it would be just as good to recompress them now.
>> 
>> You can offer to do that yourself, can’t you?
>> 
> 
> Were do I have to send them?

IMO the icons were provided by different developers. I don’t know
who cares - perhaps it would be best to pick one and post your change
with an explanation to the list. Later a GPL-statement would be
required to include your work in LyX if we don’t have one already.

Stephan

Re: [LyX/2.2.x] French Tutorial.lyx: some typographic fixes

2017-04-18 Thread Jean-Pierre Chrétien

Le 17/04/2017 à 20:25, Guenter Milde a écrit :




... just after the word which refers to the footnote, ...


What happens in French, if the footnote refers not just to a word but a
complete sentence?


I reviewed the web literature about the subject. The French typographic 
tradition forbids footnote reference after a punctuation mark, and the "Lexique 
des règles typographiques en usage à l'imprimerie nationale" enforces this.


I found the distinction mentioned when the footnote references a citation in the 
text, the footnote reference *may* be positioned after the closing guillemet.


In all the French documentation, I have consistently put the footnote reference 
before any punctuation mark (I did not review the literature for this, this is 
how I learned long ago).


--
Jean-Pierre




Re: [LyX/master] findadv: avoid crash when regexp-based search fails (mitigates #10625).

2017-04-18 Thread Kornel Benko
Am Dienstag, 18. April 2017 um 01:46:46, schrieb Tommaso Cucinotta 

> On 18/04/2017 01:04, Kornel Benko wrote:
> >> So, I'd be in favor of using -SIGQUIT immediately on "TestEnd" in 
> >> keytest.py, falling back to "kill -9" if LyX doesn't quit within  0.5 
> >> secs ?
> >> (without adding the \Ax work-around in test cases, that should not bee 
> >> needed anymore).
> >
> > It may be too early. We should know first if the previously sent keystrokes 
> > ere processed.
> > But at least we could try.
> 
> right, I saw your other comment. I had somewhere in keytest.py code that 
> doesn't send a key press unless the process is sleeping :-); this was needed 
> otherwise when we have "KK: [long] sequence of keypresses", it was possible 
> to loose keys on the go; however, the lyx_sleeping() might not be too 
> precise, perhaps another way is to catch the end of LFUN processing via 
> logging ?

Hm, we may wait for log which is not yet flushed. Bad.
The only (reliable?) response I know of is through the lyx-server.
Still the handling of dialog-boxes as result of commands will be troubling.

> Thanks,
> 
>   T.

Kornel

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


Re: optional line break, ldots (patch, fileformat)

2017-04-18 Thread Jean-Marc Lasgouttes

Le 18/04/2017 à 07:33, Jürgen Spitzmüller a écrit :

Am Montag, den 17.04.2017, 21:14 + schrieb Guenter Milde:

On 2017-04-17, Jürgen Spitzmüller wrote:

Am Montag, den 17.04.2017, 09:54 + schrieb Guenter Milde:
The more important issue is commented on trac: Some people redefine
\ldots


a bad idea...


Why?


The fact is the you rely on an undocumented behavior of LyX to obtain 
what you want :)


I read a bit about \ldots, \dots and friends (in the LaTeX companion), 
and it seems now that the situation is not very simple. It looks to me 
like a case where the SpecialChar inset should output different things 
depending on the language.


What is a good reference on the subject?

JMarc




Re: [PATCH] Expansion of tilde for users home directory in prefs is broken on Mac

2017-04-18 Thread Kornel Benko
Am Dienstag, 18. April 2017 um 09:38:31, schrieb Stephan Witt 
> > You are right. I even complained about this but got no answer.
> > http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg198564.html
> 
> It’s easy to fix. IMO either this or remove the lyxrc variable.
> 
> Stephan

+1 for commit (to master).

Kornel

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


Re: Warning while loading PDF-form.21.lyx

2017-04-18 Thread Kornel Benko
Am Dienstag, 18. April 2017 um 01:43:30, schrieb Uwe Stöhr 
> El 17.04.2017 a las 22:04, Kornel Benko escribió:
> 
> > It may be that the python output is not in the messages pane, only messages 
> > created by lyx executable.
> > I am in favour of bug report.
> 
> I reported a bug:
> http://www.lyx.org/trac/ticket/10628
> 
> However, I am stuck. open the attached LyX file (which I mangled 
> purposely) with LyX 2.3master.
> In the messages pane you get the correct warning:
> 
> test.21.lyx opened.D:\LyXGit\Master\src\Lexer.cpp (933): Missing 
> 'use_makebox'-tag in InsetBoxParams::read. Got width instead. Line: 228
> LyX: Bad boolean `width'. Use "false" or "true" [around line 228 of file 
> ~\AppData\Local\Temp\lyx_tmpdir.RfyLqswa2692\Buffer_convertLyXFormatEn2692.lyx
>  
> current token: 'width' context: 'InsetBoxParams::read']
> D:\LyXGit\Master\src\Lexer.cpp (933): Missing 'width'-tag in 
> InsetBoxParams::read. Got 5cm instead. Line: 228
> 
> But when I open the file using using the -batch tag and the command line 
> as for the tests:
> 
> lyx -batch test.21.lyx
> 
> I get nothing. Therefore I might think the file is OK and the test is 
> passed but it is not.
> 
> What am I doing wrong here?

Nothing, I see the same. I think, this is a real bug.

> thanks and regards
> Uwe

Kornel

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


Re: [PATCH] Expansion of tilde for users home directory in prefs is broken on Mac

2017-04-18 Thread Stephan Witt
Am 17.04.2017 um 21:57 schrieb Kornel Benko :
> 
> Am Montag, 17. April 2017 um 21:15:02, schrieb Stephan Witt 
>> 
>>> Am 17.04.2017 um 17:23 schrieb Kornel Benko :
>>> 
>>> Am Montag, 17. April 2017 um 15:40:51, schrieb Stephan Witt 
>>> 
 Am 16.04.2017 um 22:45 schrieb Scott Kostyshak :
> 
> On Sat, Apr 15, 2017 at 08:44:59AM +0200, Stephan Witt wrote:
> 
>>> Also, do you think we should consider reverting 9b64d7bd? I hope not,
>>> but I ask you since I think at this point you have the best
>>> understanding of the situation.
>> 
>> No, I don’t think so. You had good reasons and shouldn’t be reverted.
> 
> OK good.
> 
>> For me it looks a little bit strange to access the contents of the lyxrc
>> object directly. This would be another possibility: to make all (path)
>> member variables private and use setter and getter for accesses. The 
>> tilde
>> logic could be placed inside the getter then.
 
 ATM, I’m trying to avoid that. I fear it’s too much changed then.
 
 So, I’m reviewing the affected path variables in LyXrc now.
 
 1. document_path - most usages are with FileName. 
 But I’m not sure if the usage of it in browseRelToSub() is ok.
 On Mac it’s ignored because of USE_NATIVE_FILEDIALOG being true.
 
 2. example_path - isn’t used anymore !!???

git blame tells me it was never used. Change 58135f8 introduced it.
But at this time it was added to preferences only w/o using it.
Later the change to use it seems to be forgotten.

>>> 
>>> It is used in non-native file selector dialog, (ergo not on Mac)
>> 
>> I’m making a code review and not a debugger session ;)
>> 
>> I’m not so sure it is really used now. I’m quite confident
>> the path for the button you’re talking about is hard coded
>> and not retrieved from lyxrc.
> 
> You are right. I even complained about this but got no answer.
> http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg198564.html

It’s easy to fix. IMO either this or remove the lyxrc variable.

Stephan


lyxrc-example_path.patch
Description: Binary data