Re: mathmacros/testcases_speed.lyx: Handling unknown body token

2016-12-01 Thread Guenter Milde
On 2016-12-01, José Abílio Matos wrote:
> On Wednesday, November 30, 2016 10:44:21 AM WET Kornel Benko wrote:
>> I was/am reluctant. Preferring correction of lyx2lyx.
>> But since the expert is Günter, maybe I am wrong.

>> Kornel

> I agree with Kornel.

> The patch should be quite easy, since as far as I understand the purpose is 
> to 
> remove some keywords to have been removed at some version. What was that 
> version?

> OTOH the problem is not urgent... :-)

According to http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg131446.html
it was intentional omissed from lyx2lyx:

  During a fast-evolving period like this, with no public release in
  between, reversion of lyx2lyx is IMHO acceptable. In this particular
  case, if version 250 adds the manifest section, and 260 removes this
  section, all 1.5.0 to 1.6.0 conversion will go through this useless
  addition and removal, so I reverted part of version 250 (I do not
  remember the exact format number).
  
Even if this decision was not without controversy and discussion, it does
not make sense to change it 9 years later only because one file was
missed under the cleanup 9 years ago and unfortunately landed in the
ctest test pool.

Günter



Re: mathmacros/testcases_speed.lyx: Handling unknown body token

2016-12-01 Thread Enrico Forestieri
On Thu, Dec 01, 2016 at 05:20:33PM +0100, Kornel Benko wrote:
> 
> Please commit. Looks good.

Done at e8f480e7. Thanks for testing.

-- 
Enrico


Re: mathmacros/testcases_speed.lyx: Handling unknown body token

2016-12-01 Thread Kornel Benko
Am Donnerstag, 1. Dezember 2016 um 12:58:34, schrieb Kornel Benko 

> Am Donnerstag, 1. Dezember 2016 um 12:03:02, schrieb Enrico Forestieri 
> 
> > On Thu, Dec 01, 2016 at 11:47:19AM +0100, Kornel Benko wrote:
> > > Am Donnerstag, 1. Dezember 2016 um 01:01:44, schrieb Enrico Forestieri 
> > > 
> > > > 
> > > > Or we can add the braces on output, as done in the attached patch (also
> > > > including the previous one). The braces will be added anytime a macro
> > > > has optional arguments (not only when it is nested), but, given that 
> > > > this
> > > > avoids a latex error, I think it is acceptable.
> > > > 
> > > > The test case now displays and compiles fine for me.
> > > > 
> > > 
> > > Confirmed, works very nice. Please commit.
> > 
> > I found a small glitch with the previous patch. As the braces are always
> > added and lyx removes only the ones appearing in a macro argument, if you
> > copy/paste a macro with optional arguments you always get the outer braces,
> > which tend to accumulate. Instead, the attached patch only adds the braces
> > if the macro is actually in the argument of a math macro, thus avoiding
> > this issue. Please, also test this one.
> > 
> 
> First test looks good. Started export test suite ... this can take a while.
> I have to go now, so feel free to commit.
> 

Please commit. Looks good. There are export tests failing, but the reason is 
with unicode symbols because of iconv.
For example:
-- Executing /BUILD/BUILDMint17/BuildLyxGitQt5.7main-gcc6.2/bin/lyx2.3  
-userdir "/BUILD/BUILDMint17/BuildLyxGitQt5.7main-gcc6.2/Testing/.lyx" -E pdf2 
latex/unicodesymbols/001-4-latin_defaultF.pdf2 
"/BUILD/BUILDMint17/BuildLyxGitQt5.7main-gcc6.2/autotests/out-home/AbC_rYB0zt/latex/unicodesymbols/001-4-latin_pdf2_defaultF_cp437.lyx"
Error 22 returned from iconv_open(out_cd_): Invalid argument
Caught iconv exception: iconv problem in iconv_codecvt_facet 
initialization
Error: Iconv software exception Detected

Here 'iconv -l' shows the coding 'CP437', but not 'cp437'.
And, if I use this encoding, the test pass.

Kornel

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


Re: mathmacros/testcases_speed.lyx: Handling unknown body token

2016-12-01 Thread José Abílio Matos
On Wednesday, November 30, 2016 10:44:21 AM WET Kornel Benko wrote:
> I was/am reluctant. Preferring correction of lyx2lyx.
> But since the expert is Günter, maybe I am wrong.
> 
> Kornel

I agree with Kornel.

The patch should be quite easy, since as far as I understand the purpose is to 
remove some keywords to have been removed at some version. What was that 
version?

OTOH the problem is not urgent... :-)

Regards,
-- 
José Abílio


Re: mathmacros/testcases_speed.lyx: Handling unknown body token

2016-12-01 Thread Kornel Benko
Am Donnerstag, 1. Dezember 2016 um 12:03:02, schrieb Enrico Forestieri 

> On Thu, Dec 01, 2016 at 11:47:19AM +0100, Kornel Benko wrote:
> > Am Donnerstag, 1. Dezember 2016 um 01:01:44, schrieb Enrico Forestieri 
> > 
> > > 
> > > Or we can add the braces on output, as done in the attached patch (also
> > > including the previous one). The braces will be added anytime a macro
> > > has optional arguments (not only when it is nested), but, given that this
> > > avoids a latex error, I think it is acceptable.
> > > 
> > > The test case now displays and compiles fine for me.
> > > 
> > 
> > Confirmed, works very nice. Please commit.
> 
> I found a small glitch with the previous patch. As the braces are always
> added and lyx removes only the ones appearing in a macro argument, if you
> copy/paste a macro with optional arguments you always get the outer braces,
> which tend to accumulate. Instead, the attached patch only adds the braces
> if the macro is actually in the argument of a math macro, thus avoiding
> this issue. Please, also test this one.
> 

First test looks good. Started export test suite ... this can take a while.
I have to go now, so feel free to commit.

Kornel

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


Re: mathmacros/testcases_speed.lyx: Handling unknown body token

2016-12-01 Thread Guenter Milde
On 2016-12-01, Kornel Benko wrote:
> Am Mittwoch, 30. November 2016 um 19:24:48, schrieb Guenter Milde 
> 

>> ...

>> >> > Do you suggest that we at least manually remove the unknown tag
>> >> > from the file?

>> >> Already done.

>> > I was/am reluctant. Preferring correction of lyx2lyx.
>> > But since the expert is Günter, maybe I am wrong.

>> I am no expert here but after reading Enricos post and the following the
>> thread pointed to there, I concluded that the experts decided not to handle
>> this "temporary" token.

>> In case you want to investigate further (or just keep a record), I
>> can send or uplad a separate file for the "manifest" issue.

> No need to upload, since the original files are under development/mathmacros 
> too.
> But they deserve cleaning of the unwanted tags too IMHO.

This is also already done.

However, if you want to experiment with the unwanted tags, a minimal example
is available here. Otherwise we may put this issue to a rest.

Günter




Re: mathmacros/testcases_speed.lyx: Handling unknown body token

2016-12-01 Thread Kornel Benko
Am Mittwoch, 30. November 2016 um 19:24:48, schrieb Guenter Milde 

> On 2016-11-30, Kornel Benko wrote:
> > Am Mittwoch, 30. November 2016 um 06:38:23, schrieb Guenter Milde 
> > 
> >> On 2016-11-30, Scott Kostyshak wrote:
> >> > On Wed, Nov 30, 2016 at 01:35:01AM +0100, Kornel Benko wrote:
> >> >> Am Dienstag, 29. November 2016 um 18:56:13, schrieb Scott Kostyshak 
> >> >> 
> 
> ...
> 
> >> Unfortunately, the loading failure masked the compilation problem for a 
> >> long
> >> time.
> 
> >> > Do you suggest that we at least manually remove the unknown tag from the
> >> > file?
> 
> >> Already done.
> 
> > I was/am reluctant. Preferring correction of lyx2lyx.
> > But since the expert is Günter, maybe I am wrong.
> 
> I am no expert here but after reading Enricos post and the following the
> thread pointed to there, I concluded that the experts decided not to handle
> this "temporary" token.
> 
> In case you want to investigate further (or just keep a record), I
> can send or uplad a separate file for the "manifest" issue.
> 
> mfg,
> 
> Günter

No need to upload, since the original files are under development/mathmacros 
too.
But they deserve cleaning of the unwanted tags too IMHO.

Kornel

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


Re: mathmacros/testcases_speed.lyx: Handling unknown body token

2016-12-01 Thread Enrico Forestieri
On Thu, Dec 01, 2016 at 11:47:19AM +0100, Kornel Benko wrote:
> Am Donnerstag, 1. Dezember 2016 um 01:01:44, schrieb Enrico Forestieri 
> 
> > 
> > Or we can add the braces on output, as done in the attached patch (also
> > including the previous one). The braces will be added anytime a macro
> > has optional arguments (not only when it is nested), but, given that this
> > avoids a latex error, I think it is acceptable.
> > 
> > The test case now displays and compiles fine for me.
> > 
> 
> Confirmed, works very nice. Please commit.

I found a small glitch with the previous patch. As the braces are always
added and lyx removes only the ones appearing in a macro argument, if you
copy/paste a macro with optional arguments you always get the outer braces,
which tend to accumulate. Instead, the attached patch only adds the braces
if the macro is actually in the argument of a math macro, thus avoiding
this issue. Please, also test this one.

-- 
Enrico
diff --git a/src/mathed/MathData.cpp b/src/mathed/MathData.cpp
index f2100af..2a36e55 100644
--- a/src/mathed/MathData.cpp
+++ b/src/mathed/MathData.cpp
@@ -659,12 +659,15 @@ void MathData::collectOptionalParameters(Cursor * cur,
if (operator[](pos)->getChar() != '[')
break;
 
-   // found possible optional argument, look for "]"
+   // found possible optional argument, look for pairing "]"
+   int count = 1;
size_t right = pos + 1;
for (; right < size(); ++right) {
MathAtom & cell = operator[](right);
 
-   if (cell->getChar() == ']')
+   if (cell->getChar() == '[')
+   ++count;
+   else if (cell->getChar() == ']' && --count == 0)
// found right end
break;
 
diff --git a/src/mathed/MathMacro.cpp b/src/mathed/MathMacro.cpp
index 34b5160..afc40a4 100644
--- a/src/mathed/MathMacro.cpp
+++ b/src/mathed/MathMacro.cpp
@@ -1068,6 +1068,15 @@ void MathMacro::write(WriteStream & os) const
// we should be ok to continue even if this fails.
LATTEST(d->macro_);
 
+   // We may already be in the argument of a macro
+   bool const inside_macro = os.insideMacro();
+   os.insideMacro(true);
+
+   // Enclose in braces to avoid latex errors with xargs if we have
+   // optional arguments and are in the optional argument of a macro
+   if (d->optionals_ && inside_macro)
+   os << '{';
+
// Always protect macros in a fragile environment
if (os.fragile())
os << "\\protect";
@@ -1106,9 +1115,13 @@ void MathMacro::write(WriteStream & os) const
first = false;
}
 
-   // add space if there was no argument
-   if (first)
+   // Close the opened brace or add space if there was no argument
+   if (d->optionals_ && inside_macro)
+   os << '}';
+   else if (first)
os.pendingSpace(true);
+
+   os.insideMacro(inside_macro);
 }
 
 
diff --git a/src/mathed/MathStream.cpp b/src/mathed/MathStream.cpp
index ee65835..cf3fb51 100644
--- a/src/mathed/MathStream.cpp
+++ b/src/mathed/MathStream.cpp
@@ -128,10 +128,10 @@ WriteStream & operator<<(WriteStream & ws, docstring 
const & s)
 WriteStream::WriteStream(otexrowstream & os, bool fragile, bool latex,
 OutputType output, Encoding 
const * encoding)
: os_(os), fragile_(fragile), firstitem_(false), latex_(latex),
- output_(output), pendingspace_(false), pendingbrace_(false),
- textmode_(false), locked_(0), ascii_(0), canbreakline_(true),
- mathsout_(false), ulemcmd_(NONE), line_(0), encoding_(encoding),
- row_entry_(TexRow::row_none)
+ output_(output), insidemacro_(false), pendingspace_(false),
+ pendingbrace_(false), textmode_(false), locked_(0), ascii_(0),
+ canbreakline_(true), mathsout_(false), ulemcmd_(NONE), line_(0),
+ encoding_(encoding), row_entry_(TexRow::row_none)
 {}
 
 
diff --git a/src/mathed/MathStream.h b/src/mathed/MathStream.h
index 2a4d4d7..271330e 100644
--- a/src/mathed/MathStream.h
+++ b/src/mathed/MathStream.h
@@ -81,6 +81,10 @@ public:
void ulemCmd(UlemCmdType ulemcmd) { ulemcmd_ = ulemcmd; }
/// tell which ulem command type we are inside
UlemCmdType ulemCmd() const { return ulemcmd_; }
+   /// record whether we are in the argument of a math macro
+   void insideMacro(bool insidemacro) { insidemacro_ = insidemacro; }
+   /// tell whether we are in the argument of a math macro
+   bool insideMacro() const { return insidemacro_; }
/// writes space if next thing is isalpha()
void pendingSpace(bool how);
/// writes space if next thing is isalpha()
@@ -120,6 +124,8 @@ private:
int latex_;
/// output ty

Re: mathmacros/testcases_speed.lyx: Handling unknown body token

2016-12-01 Thread Kornel Benko
Am Donnerstag, 1. Dezember 2016 um 01:01:44, schrieb Enrico Forestieri 

> On Thu, Dec 01, 2016 at 12:35:49AM +0100, Enrico Forestieri wrote:
> > On Wed, Nov 30, 2016 at 05:23:59PM +0100, Enrico Forestieri wrote:
> > > On Wed, Nov 30, 2016 at 10:40:09AM -0500, Scott Kostyshak wrote:
> > > > 
> > > > Thanks for the explanations. It seems we should report the LyX display
> > > > bug you mention above, and then just not worry about the compilation
> > > > failures.
> > > 
> > > I found that enclosing the nested macros in brace insets circumvents
> > > both issues (display glitch and latex error). Unfortunately, lyx duly
> > > removes the braces when reloading the document, so that this only
> > > takes care of the display issue, in practice. See attached.
> > 
> > The attached patch fixes the display glitch for me.
> > 
> > > So, the conclusion is that the error is actually due to a limitation
> > > of xkeyval.
> > 
> > The only way to avoid this error still remains enclosing a nested macro
> > and its parameters in a brace inset. However, this workaround will be
> > frustrated by lyx on reloading the document.
> 
> Or we can add the braces on output, as done in the attached patch (also
> including the previous one). The braces will be added anytime a macro
> has optional arguments (not only when it is nested), but, given that this
> avoids a latex error, I think it is acceptable.
> 
> The test case now displays and compiles fine for me.
> 

Confirmed, works very nice. Please commit.

Kornel

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


Re: mathmacros/testcases_speed.lyx: Handling unknown body token

2016-11-30 Thread Enrico Forestieri
On Thu, Dec 01, 2016 at 12:35:49AM +0100, Enrico Forestieri wrote:
> On Wed, Nov 30, 2016 at 05:23:59PM +0100, Enrico Forestieri wrote:
> > On Wed, Nov 30, 2016 at 10:40:09AM -0500, Scott Kostyshak wrote:
> > > 
> > > Thanks for the explanations. It seems we should report the LyX display
> > > bug you mention above, and then just not worry about the compilation
> > > failures.
> > 
> > I found that enclosing the nested macros in brace insets circumvents
> > both issues (display glitch and latex error). Unfortunately, lyx duly
> > removes the braces when reloading the document, so that this only
> > takes care of the display issue, in practice. See attached.
> 
> The attached patch fixes the display glitch for me.
> 
> > So, the conclusion is that the error is actually due to a limitation
> > of xkeyval.
> 
> The only way to avoid this error still remains enclosing a nested macro
> and its parameters in a brace inset. However, this workaround will be
> frustrated by lyx on reloading the document.

Or we can add the braces on output, as done in the attached patch (also
including the previous one). The braces will be added anytime a macro
has optional arguments (not only when it is nested), but, given that this
avoids a latex error, I think it is acceptable.

The test case now displays and compiles fine for me.

-- 
Enrico
diff --git a/src/mathed/MathData.cpp b/src/mathed/MathData.cpp
index f2100af..44a5055 100644
--- a/src/mathed/MathData.cpp
+++ b/src/mathed/MathData.cpp
@@ -659,12 +659,15 @@ void MathData::collectOptionalParameters(Cursor * cur,
if (operator[](pos)->getChar() != '[')
break;
 
-   // found possible optional argument, look for "]"
+   // found possible optional argument, look for pairing "]"
+   int count = 1;
size_t right = pos + 1;
for (; right < size(); ++right) {
MathAtom & cell = operator[](right);
 
-   if (cell->getChar() == ']')
+   if (cell->getChar() == '[')
+   ++count;
+   else if (cell->getChar() == ']' && --count == 0)
// found right end
break;
 
diff --git a/src/mathed/MathMacro.cpp b/src/mathed/MathMacro.cpp
index 34b5160..af24634 100644
--- a/src/mathed/MathMacro.cpp
+++ b/src/mathed/MathMacro.cpp
@@ -1068,6 +1068,11 @@ void MathMacro::write(WriteStream & os) const
// we should be ok to continue even if this fails.
LATTEST(d->macro_);
 
+   // Enclose in braces to avoid errors with xargs in case the
+   // optional argument is another macro with optional arguments
+   if (d->optionals_)
+   os << '{';
+
// Always protect macros in a fragile environment
if (os.fragile())
os << "\\protect";
@@ -1106,8 +,10 @@ void MathMacro::write(WriteStream & os) const
first = false;
}
 
-   // add space if there was no argument
-   if (first)
+   // Close the opened brace or add space if there was no argument
+   if (d->optionals_)
+   os << '}';
+   else if (first)
os.pendingSpace(true);
 }
 


Re: mathmacros/testcases_speed.lyx: Handling unknown body token

2016-11-30 Thread Enrico Forestieri
On Wed, Nov 30, 2016 at 05:23:59PM +0100, Enrico Forestieri wrote:
> On Wed, Nov 30, 2016 at 10:40:09AM -0500, Scott Kostyshak wrote:
> > 
> > Thanks for the explanations. It seems we should report the LyX display
> > bug you mention above, and then just not worry about the compilation
> > failures.
> 
> I found that enclosing the nested macros in brace insets circumvents
> both issues (display glitch and latex error). Unfortunately, lyx duly
> removes the braces when reloading the document, so that this only
> takes care of the display issue, in practice. See attached.

The attached patch fixes the display glitch for me.

> So, the conclusion is that the error is actually due to a limitation
> of xkeyval.

The only way to avoid this error still remains enclosing a nested macro
and its parameters in a brace inset. However, this workaround will be
frustrated by lyx on reloading the document.

-- 
Enrico
diff --git a/src/mathed/MathData.cpp b/src/mathed/MathData.cpp
index f2100af..44a5055 100644
--- a/src/mathed/MathData.cpp
+++ b/src/mathed/MathData.cpp
@@ -659,12 +659,15 @@ void MathData::collectOptionalParameters(Cursor * cur,
if (operator[](pos)->getChar() != '[')
break;
 
-   // found possible optional argument, look for "]"
+   // found possible optional argument, look for pairing "]"
+   int count = 1;
size_t right = pos + 1;
for (; right < size(); ++right) {
MathAtom & cell = operator[](right);
 
-   if (cell->getChar() == ']')
+   if (cell->getChar() == '[')
+   ++count;
+   else if (cell->getChar() == ']' && --count == 0)
// found right end
break;
 


Re: mathmacros/testcases_speed.lyx: Handling unknown body token

2016-11-30 Thread Guenter Milde
On 2016-11-30, Kornel Benko wrote:
> Am Mittwoch, 30. November 2016 um 06:38:23, schrieb Guenter Milde 
> 
>> On 2016-11-30, Scott Kostyshak wrote:
>> > On Wed, Nov 30, 2016 at 01:35:01AM +0100, Kornel Benko wrote:
>> >> Am Dienstag, 29. November 2016 um 18:56:13, schrieb Scott Kostyshak 
>> >> 

...

>> Unfortunately, the loading failure masked the compilation problem for a long
>> time.

>> > Do you suggest that we at least manually remove the unknown tag from the
>> > file?

>> Already done.

> I was/am reluctant. Preferring correction of lyx2lyx.
> But since the expert is Günter, maybe I am wrong.

I am no expert here but after reading Enricos post and the following the
thread pointed to there, I concluded that the experts decided not to handle
this "temporary" token.

In case you want to investigate further (or just keep a record), I
can send or uplad a separate file for the "manifest" issue.

mfg,

Günter



Re: mathmacros/testcases_speed.lyx: Handling unknown body token

2016-11-30 Thread Enrico Forestieri
On Wed, Nov 30, 2016 at 04:27:53PM +0100, Enrico Forestieri wrote:
>
> This display bug has not changed until lyx 2.2 but now it becomes worse in
> lyx 2.3, where the default parameters are not shown anymore and an empty
> blue rectangle takes their place (see foo3.png).

This is now http://www.lyx.org/trac/ticket/10508

-- 
Enrico


Re: mathmacros/testcases_speed.lyx: Handling unknown body token

2016-11-30 Thread Enrico Forestieri
On Wed, Nov 30, 2016 at 10:40:09AM -0500, Scott Kostyshak wrote:
> 
> Thanks for the explanations. It seems we should report the LyX display
> bug you mention above, and then just not worry about the compilation
> failures.

I found that enclosing the nested macros in brace insets circumvents
both issues (display glitch and latex error). Unfortunately, lyx duly
removes the braces when reloading the document, so that this only
takes care of the display issue, in practice. See attached.

So, the conclusion is that the error is actually due to a limitation
of xkeyval.

-- 
Enrico
#LyX 1.6.10 created this file. For more info see http://www.lyx.org/
\lyxformat 345
\begin_document
\begin_header
\textclass scrartcl
\begin_preamble
\usepackage{a4wide}
\end_preamble
\options fleqn
\use_default_options false
\language ngerman
\inputencoding auto
\font_roman ae
\font_sans default
\font_typewriter default
\font_default_family default
\font_sc false
\font_osf false
\font_sf_scale 100
\font_tt_scale 100

\graphics default
\float_placement h
\paperfontsize 12
\spacing single
\use_hyperref false
\papersize default
\use_geometry false
\use_amsmath 2
\use_esint 0
\cite_engine basic
\use_bibtopic false
\paperorientation portrait
\secnumdepth 3
\tocdepth 3
\paragraph_separation skip
\defskip medskip
\quotes_language german
\papercolumns 1
\papersides 1
\paperpagestyle plain
\tracking_changes false
\output_changes false
\author "" 
\author "" 
\end_header

\begin_body

\begin_layout Standard
\begin_inset FormulaMacro
\renewcommand{\xyz}[2][42][28]{\sqrt{#1}+\ln\left(\frac{#2}{82}\right)}
\end_inset


\begin_inset Formula \[
\xyz[1][{\xyz[{\xyz[{\xyz[1][2]}][2]}][{\xyz[1][2]}]}]\]

\end_inset


\end_layout

\end_body
\end_document


Re: mathmacros/testcases_speed.lyx: Handling unknown body token

2016-11-30 Thread Scott Kostyshak
On Wed, Nov 30, 2016 at 04:27:53PM +0100, Enrico Forestieri wrote:

> I see two different issues here. The first one is a display glitch in LyX,
> but this is a very old issue because I get it also with lyx 1.6 (see the
> attached document foo.lyx). Indeed, by manually entering the nested macros
> (looking at the latex code) I get a display as shown in foo1.png. However,
> after saving and reloading I get what is shown in foo2.png. Note that the
> produced latex code is the same, so this is simply a display bug.
> This display bug has not changed until lyx 2.2 but now it becomes worse in
> lyx 2.3, where the default parameters are not shown anymore and an empty
> blue rectangle takes their place (see foo3.png).
> This is most probably due to some recent tampering in mathed code.
> 
> The second issue is the latex error you report above. Given that the
> produced latex seems to be legal code, I think this is a latex bug (or,
> more precisely, a bug or limitation of the xargs or xkeyval packages).

Thanks for the explanations. It seems we should report the LyX display
bug you mention above, and then just not worry about the compilation
failures.

Scott


signature.asc
Description: PGP signature


Re: mathmacros/testcases_speed.lyx: Handling unknown body token

2016-11-30 Thread Kornel Benko
Am Mittwoch, 30. November 2016 um 06:38:23, schrieb Guenter Milde 

> On 2016-11-30, Scott Kostyshak wrote:
> 
> > [-- Type: text/plain, Encoding:  --]
> 
> > On Wed, Nov 30, 2016 at 01:35:01AM +0100, Kornel Benko wrote:
> >> Am Dienstag, 29. November 2016 um 18:56:13, schrieb Scott Kostyshak 
> >> 
> 
> >> The nesting is intended to test the math-macro.
> 
> > OK, so it is a LyX bug then? Because compilation fails.
> 
> We don't know whether it is a LyX bug or a LaTeX problem.
> 
> Unfortunately, the loading failure masked the compilation problem for a long
> time.
> 
> 
> > Do you suggest that we at least manually remove the unknown tag from the
> > file?
> 
> Already done.

I was/am reluctant. Preferring correction of lyx2lyx.
But since the expert is Günter, maybe I am wrong.

Kornel

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


Re: mathmacros/testcases_speed.lyx: Handling unknown body token

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

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

> On Wed, Nov 30, 2016 at 01:35:01AM +0100, Kornel Benko wrote:
>> Am Dienstag, 29. November 2016 um 18:56:13, schrieb Scott Kostyshak 
>> 

>> The nesting is intended to test the math-macro.

> OK, so it is a LyX bug then? Because compilation fails.

We don't know whether it is a LyX bug or a LaTeX problem.

Unfortunately, the loading failure masked the compilation problem for a long
time.


> Do you suggest that we at least manually remove the unknown tag from the
> file?

Already done.



Re: mathmacros/testcases_speed.lyx: Handling unknown body token

2016-11-29 Thread Scott Kostyshak
On Wed, Nov 30, 2016 at 01:35:01AM +0100, Kornel Benko wrote:
> Am Dienstag, 29. November 2016 um 18:56:13, schrieb Scott Kostyshak 
> 

> The nesting is intended to test the math-macro.

OK, so it is a LyX bug then? Because compilation fails.

Do you suggest that we at least manually remove the unknown tag from the
file?

Scott


signature.asc
Description: PGP signature


Re: mathmacros/testcases_speed.lyx: Handling unknown body token

2016-11-29 Thread Kornel Benko
Am Dienstag, 29. November 2016 um 18:56:13, schrieb Scott Kostyshak 

> On Tue, Nov 29, 2016 at 12:09:39PM +0100, Enrico Forestieri wrote:
> > On Sat, Nov 26, 2016 at 01:20:42AM -0500, Scott Kostyshak wrote:
> > 
> > > When opening the file
> > > 
> > >   autotests/mathmacros/testcases_speed.lyx
> > > 
> > > I get the following terminal output:
> > > 
> > > Text.cpp (1851): Handling unknown body token: `\begin_manifest'
> > > Text.cpp (1851): Handling unknown body token: `\use_refstyle'
> > > Text.cpp (1851): Handling unknown body token: `0'
> > > Text.cpp (1851): Handling unknown body token: `\use_non_tex_fonts'
> > > Text.cpp (1851): Handling unknown body token: `0'
> > > Text.cpp (1851): Handling unknown body token: `\font_math'
> > > Text.cpp (1851): Handling unknown body token: `"auto" "auto"'
> > > Text.cpp (1851): Handling unknown body token: `\end_manifest'
> > > 
> > > Does this correspond with a known bug?
> > 
> > This file was most probably created by a development version at the
> > time when the "embedded files" feature was worked on. Those tags were
> > later removed but lyx2lyx was not updated accordingly. See this thread:
> > http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg131411.html

I moved it here from development/mathmacros (created by Stefan Schimanski) to 
use them
in our test environment.

> > Simply remove the tags and everything between them using a text editor.
> 
> Thanks for this information. I removed the tags, but I still get:
> 
> ! Argument of \xargs@grab@opt has an extra }.
> 
> I don't know if it is worth the time to investigate fixing the file or
> if we should just remove it. My guess is that it was originally used to
> test the speed of navigating macros within LyX so probably compilation
> was never the point.

In contrary, the test is also about nesting. Please don't remove it.

> There seem to be many nested \xyz commands. The following causes the
> error:
> 
> \begin{align*}
> \xyz[1][\xyz[\xyz[\xyz[1][2]][2]][\xyz[1][2]]] & 
> \xyz[1][\xyz[\xyz[\xyz[1][2]][2]][\xyz[1][2]]]\\
> \xyz[1][\xyz[\xyz[\xyz[1][2]][2]][\xyz[1][2]]] & 
> \xyz[1][\xyz[\xyz[\xyz[1][2]][2]][\xyz[1][2]]]
> \end{align*}
> 
> Scott

The nesting is intended to test the math-macro.

Kornel

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


Re: mathmacros/testcases_speed.lyx: Handling unknown body token

2016-11-29 Thread Scott Kostyshak
On Tue, Nov 29, 2016 at 12:09:39PM +0100, Enrico Forestieri wrote:
> On Sat, Nov 26, 2016 at 01:20:42AM -0500, Scott Kostyshak wrote:
> 
> > When opening the file
> > 
> >   autotests/mathmacros/testcases_speed.lyx
> > 
> > I get the following terminal output:
> > 
> > Text.cpp (1851): Handling unknown body token: `\begin_manifest'
> > Text.cpp (1851): Handling unknown body token: `\use_refstyle'
> > Text.cpp (1851): Handling unknown body token: `0'
> > Text.cpp (1851): Handling unknown body token: `\use_non_tex_fonts'
> > Text.cpp (1851): Handling unknown body token: `0'
> > Text.cpp (1851): Handling unknown body token: `\font_math'
> > Text.cpp (1851): Handling unknown body token: `"auto" "auto"'
> > Text.cpp (1851): Handling unknown body token: `\end_manifest'
> > 
> > Does this correspond with a known bug?
> 
> This file was most probably created by a development version at the
> time when the "embedded files" feature was worked on. Those tags were
> later removed but lyx2lyx was not updated accordingly. See this thread:
> http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg131411.html
> 
> Simply remove the tags and everything between them using a text editor.

Thanks for this information. I removed the tags, but I still get:

! Argument of \xargs@grab@opt has an extra }.

I don't know if it is worth the time to investigate fixing the file or
if we should just remove it. My guess is that it was originally used to
test the speed of navigating macros within LyX so probably compilation
was never the point.

There seem to be many nested \xyz commands. The following causes the
error:

\begin{align*}
\xyz[1][\xyz[\xyz[\xyz[1][2]][2]][\xyz[1][2]]] & 
\xyz[1][\xyz[\xyz[\xyz[1][2]][2]][\xyz[1][2]]]\\
\xyz[1][\xyz[\xyz[\xyz[1][2]][2]][\xyz[1][2]]] & 
\xyz[1][\xyz[\xyz[\xyz[1][2]][2]][\xyz[1][2]]]
\end{align*}

Scott


signature.asc
Description: PGP signature


Re: mathmacros/testcases_speed.lyx: Handling unknown body token

2016-11-29 Thread Scott Kostyshak
On Tue, Nov 29, 2016 at 06:43:11AM +, Guenter Milde wrote:

> a) it is invalid and we can change/delete testcases_speed.lyx

Seems that we should remove the invalid tag. But after that I still get
the error you mention below.

> When viewing PDF, the error is
> 
>   ! Argument of \xargs@grab@opt has an extra }.
>
>  \par 
>   l.33 \end{align*}

Scott


signature.asc
Description: PGP signature


Re: mathmacros/testcases_speed.lyx: Handling unknown body token

2016-11-29 Thread Enrico Forestieri
On Sat, Nov 26, 2016 at 01:20:42AM -0500, Scott Kostyshak wrote:

> When opening the file
> 
>   autotests/mathmacros/testcases_speed.lyx
> 
> I get the following terminal output:
> 
> Text.cpp (1851): Handling unknown body token: `\begin_manifest'
> Text.cpp (1851): Handling unknown body token: `\use_refstyle'
> Text.cpp (1851): Handling unknown body token: `0'
> Text.cpp (1851): Handling unknown body token: `\use_non_tex_fonts'
> Text.cpp (1851): Handling unknown body token: `0'
> Text.cpp (1851): Handling unknown body token: `\font_math'
> Text.cpp (1851): Handling unknown body token: `"auto" "auto"'
> Text.cpp (1851): Handling unknown body token: `\end_manifest'
> 
> Does this correspond with a known bug?

This file was most probably created by a development version at the
time when the "embedded files" feature was worked on. Those tags were
later removed but lyx2lyx was not updated accordingly. See this thread:
http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg131411.html

Simply remove the tags and everything between them using a text editor.

-- 
Enrico


Re: mathmacros/testcases_speed.lyx: Handling unknown body token

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

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

> When opening the file

>   autotests/mathmacros/testcases_speed.lyx

> I get the following terminal output:

> Text.cpp (1851): Handling unknown body token: `\begin_manifest'
> Text.cpp (1851): Handling unknown body token: `\use_refstyle'
> Text.cpp (1851): Handling unknown body token: `0'
> Text.cpp (1851): Handling unknown body token: `\use_non_tex_fonts'
> Text.cpp (1851): Handling unknown body token: `0'
> Text.cpp (1851): Handling unknown body token: `\font_math'
> Text.cpp (1851): Handling unknown body token: `"auto" "auto"'
> Text.cpp (1851): Handling unknown body token: `\end_manifest'

> Does this correspond with a known bug?

Not to my knowledge.

However, when opening the file testcases_speed.lyx in a text editor, I see:

* It is very old:

#LyX 1.5.2 created this file. For more info see http://www.lyx.org/
\lyxformat 295

  we do not even test export to 1.5 series.

* The "unknown" settings between \begin_manifest and \end_manifest
  are all newer.
  
  In the original document, there is nothing inbetween begin_manifest and 
  end_manifest.
  
* \begin_manifest \end_manifest is rare or unknown in LyX documents: 

   I did not find any occurence in the documents in lib/.
  
   The tokens are removed when converting to 2.2 or 2.3 format.

It seems the lyx2lyx converter has a problem with this setting:

a) it is invalid and we can change/delete testcases_speed.lyx

b) it is rare but valid, then lyx2lyx needs a fix.

c) it is valid but testcases_speed.lyx is corrupted.

When viewing PDF, the error is

  ! Argument of \xargs@grab@opt has an extra }.
   
 \par 
  l.33 \end{align*}

which may or may not be caused by the other error.

Günter