Re: onehalfspace mystery

2008-01-11 Thread Donn
Bump. Apropos my last post.
Any suggestions for the search/replace of the lyx file in a text editor?

\d


Re: onehalfspace mystery

2008-01-11 Thread Donn
Bump. Apropos my last post.
Any suggestions for the search/replace of the lyx file in a text editor?

\d


Re: onehalfspace mystery

2008-01-11 Thread Donn
Bump. Apropos my last post.
Any suggestions for the search/replace of the lyx file in a text editor?

\d


Re: onehalfspace mystery

2008-01-10 Thread Donn
Hi - my net went down suddenly and I don't know when it will come up. This is 
in the outbox waiting to go. There may have been replies since that make it 
redundant.

On Wednesday, 09 January 2008 15:07:39 Juergen Spitzmueller wrote:
 For the time being, you can use the ERT workarounds outlines on the wiki
 page I referred to.
Okay, so I have to try search/replace in an editor. I get this kind of thing-

In the lyx file (in a text editor) it was:
\begin_layout Standard
\paragraph_spacing double
\align center
\size largest
\begin_inset Formula $\thickapprox$
\end_inset
\newpage
\end_layout

I change it to (see second line from top):
\begin_layout Standard
\DoubleSpacing
\align center
\size largest
\begin_inset Formula $\thickapprox$
\end_inset
\newpage
\end_layout

I get an error:
Unknown token:
Unknown token: \DoubleSpacing \align center

It's ignoring the newline between the two.

What's the best way to repair the entire file because it's too long to go to 
each element and format to 'spacing default' via the gui.

\d
-- 
Fonty Python and other dev news at:
http://otherwiseingle.blogspot.com/


Re: onehalfspace mystery

2008-01-10 Thread Donn
Hi - my net went down suddenly and I don't know when it will come up. This is 
in the outbox waiting to go. There may have been replies since that make it 
redundant.

On Wednesday, 09 January 2008 15:07:39 Juergen Spitzmueller wrote:
 For the time being, you can use the ERT workarounds outlines on the wiki
 page I referred to.
Okay, so I have to try search/replace in an editor. I get this kind of thing-

In the lyx file (in a text editor) it was:
\begin_layout Standard
\paragraph_spacing double
\align center
\size largest
\begin_inset Formula $\thickapprox$
\end_inset
\newpage
\end_layout

I change it to (see second line from top):
\begin_layout Standard
\DoubleSpacing
\align center
\size largest
\begin_inset Formula $\thickapprox$
\end_inset
\newpage
\end_layout

I get an error:
Unknown token:
Unknown token: \DoubleSpacing \align center

It's ignoring the newline between the two.

What's the best way to repair the entire file because it's too long to go to 
each element and format to 'spacing default' via the gui.

\d
-- 
Fonty Python and other dev news at:
http://otherwiseingle.blogspot.com/


Re: onehalfspace mystery

2008-01-10 Thread Donn
Hi - my net went down suddenly and I don't know when it will come up. This is 
in the outbox waiting to go. There may have been replies since that make it 
redundant.

On Wednesday, 09 January 2008 15:07:39 Juergen Spitzmueller wrote:
> For the time being, you can use the ERT workarounds outlines on the wiki
> page I referred to.
Okay, so I have to try search/replace in an editor. I get this kind of thing-

In the lyx file (in a text editor) it was:
\begin_layout Standard
\paragraph_spacing double
\align center
\size largest
\begin_inset Formula $\thickapprox$
\end_inset
\newpage
\end_layout

I change it to (see second line from top):
\begin_layout Standard
\DoubleSpacing
\align center
\size largest
\begin_inset Formula $\thickapprox$
\end_inset
\newpage
\end_layout

I get an error:
Unknown token:
Unknown token: \DoubleSpacing \align center

It's ignoring the newline between the two.

What's the best way to repair the entire file because it's too long to go to 
each element and format to 'spacing default' via the gui.

\d
-- 
Fonty Python and other dev news at:
http://otherwiseingle.blogspot.com/


Re: onehalfspace mystery

2008-01-09 Thread Jean-Marc Lasgouttes
Donn [EMAIL PROTECTED] writes:

 Repeating this here as it's the start of the day for me and I'd like to get 
 past this error:
 onehalfspace and doublespace missing environments.

So probably LyX does not output the \usepackage{setspace} command that
it needs in the preamble.

Did you set spacing globally or in a given paragraph? Could you send
an example file?

JMarc


Re: onehalfspace mystery

2008-01-09 Thread Donn
 So probably LyX does not output the \usepackage{setspace} command that
 it needs in the preamble.
Tried that too, still no effect.

 Did you set spacing globally or in a given paragraph? Could you send
 an example file?
I don't think I did anything special globally. I attach a cut-down sample of 
the file that gives me the errors.

Thanks.
\d


error_sample.lyx
Description: application/lyx


Re: onehalfspace mystery

2008-01-09 Thread Jean-Marc Lasgouttes
Donn [EMAIL PROTECTED] writes:

 So probably LyX does not output the \usepackage{setspace} command that
 it needs in the preamble.
 Tried that too, still no effect.

 Did you set spacing globally or in a given paragraph? Could you send
 an example file?
 I don't think I did anything special globally. I attach a cut-down sample of 
 the file that gives me the errors.

OK, the problem is that you use the memoir class, which has its own
implementation of the setspace functionality in newer editions.
However, this functionality is offered as capitalized commands like
DoubleSpace environment.

Juergen, what shall we do? I remember messages from you about memoir
incompatibility, but I cannot see a reference.

One solution would be to have memoir.layout provide SetSpace and act
of the require to change the spacing commands as needed.

JMarc


Re: onehalfspace mystery

2008-01-09 Thread Jean-Marc Lasgouttes
Jean-Marc Lasgouttes [EMAIL PROTECTED] writes:
 Juergen, what shall we do? I remember messages from you about memoir
 incompatibility, but I cannot see a reference.

I found that:
http://www.mail-archive.com/lyx-users@lists.lyx.org/msg52814.html

Would adding \DisemulatePackage{setspace} fix some of our problems (at
the price of not so good spacing?)

I suspect there is a problem with parskip.sty also.

JMarc


Re: onehalfspace mystery

2008-01-09 Thread Donn
 OK, the problem is that you use the memoir class, which has its own
 implementation of the setspace functionality in newer editions.
 However, this functionality is offered as capitalized commands like
 DoubleSpace environment.

Okay, I'll take a break and await advice. Thanks for looking into it.
\d

-- 
I have a low-traffic blog for basic news:
http://otherwiseingle.blogspot.com/


Re: onehalfspace mystery

2008-01-09 Thread Juergen Spitzmueller
Jean-Marc Lasgouttes wrote:

 Juergen, what shall we do? I remember messages from you about memoir
 incompatibility, but I cannot see a reference.

I think there's no bug report yet, but there is a wiki page:
http://wiki.lyx.org/LyX/UsingMemoirInLyX

 One solution would be to have memoir.layout provide SetSpace and act
 of the require to change the spacing commands as needed.

Yes, I guess we need this. I have recently tried to solve it by
redefinitions of setspace commands in the preamble and Provides setspace
1, but this does not work, since the global commands are put before the
Class preamble.

Do you like to have a go?

(we probably need to check since when these memoir SetSpace stuff exists,
and require a certain version).

Jürgen



Re: onehalfspace mystery

2008-01-09 Thread Donn
Um, does this mean I should hang-on a while and compile a new version? I don't 
mind doing that, just don't grok what you are chatting about :)

\d

-- 
Fonty Python and other dev news at:
http://otherwiseingle.blogspot.com/


Re: onehalfspace mystery

2008-01-09 Thread Jean-Marc Lasgouttes
Donn [EMAIL PROTECTED] writes:

 Um, does this mean I should hang-on a while and compile a new version? I 
 don't 
 mind doing that, just don't grok what you are chatting about :)

Try to add
\DisemulatePackage{setspace}
in the preamble of your document.

JMarc


Re: onehalfspace mystery

2008-01-09 Thread Juergen Spitzmueller
Jean-Marc Lasgouttes wrote:

 Try to add
 \DisemulatePackage{setspace}
 in the preamble of your document.

I seem to remember that LyX adds this too late in the game, but my memory
might be wrong

Jürgen



Re: onehalfspace mystery

2008-01-09 Thread Jean-Marc Lasgouttes
Juergen Spitzmueller [EMAIL PROTECTED] writes:

 Jean-Marc Lasgouttes wrote:

 Try to add
 \DisemulatePackage{setspace}
 in the preamble of your document.

 I seem to remember that LyX adds this too late in the game, but my memory
 might be wrong

Indeed. It is a bit better with
\DisemulatePackage{setspace}
\usepackage{setspace}
but there is still an error.

JMarc


Re: onehalfspace mystery

2008-01-09 Thread Juergen Spitzmueller
Jean-Marc Lasgouttes wrote:

 \DisemulatePackage{setspace}
 \usepackage{setspace}
 but there is still an error.

Too bad.
And if Provides setspace 1 is set additionally?

Jürgen



Re: onehalfspace mystery

2008-01-09 Thread Juergen Spitzmueller
Donn wrote:

 Um, does this mean I should hang-on a while and compile a new version? I
 don't mind doing that, just don't grok what you are chatting about :)

It might be that this fix will have to wait for the next major release
(1.6.0), because it might entail a file format change (we need to discuss
this).

For the time being, you can use the ERT workarounds outlines on the wiki
page I referred to.

Jürgen



Re: onehalfspace mystery

2008-01-09 Thread Jean-Marc Lasgouttes
Juergen Spitzmueller [EMAIL PROTECTED] writes:

 Jean-Marc Lasgouttes wrote:

 \DisemulatePackage{setspace}
 \usepackage{setspace}
 but there is still an error.

 Too bad.
 And if Provides setspace 1 is set additionally?

It would not help, we need to actually load setspace.

JMarc


Re: onehalfspace mystery

2008-01-09 Thread Jean-Marc Lasgouttes
Juergen Spitzmueller [EMAIL PROTECTED] writes:

 Do you like to have a go?

It would look like this. I define the new feature SetSpace that is
provided by memoir.layout, and act on it.

JMarc

svndiff src/ lib/layouts/

Index: src/Spacing.h
===
--- src/Spacing.h	(revision 22451)
+++ src/Spacing.h	(working copy)
@@ -58,10 +58,12 @@ public:
 	void set(Spacing::Space sp, std::string const  val);
 	///
 	void writeFile(std::ostream , bool para = false) const;
-	///
-	std::string const writeEnvirBegin() const;
-	///
-	std::string const writeEnvirEnd() const;
+	/// useSetSpace is true when using the variant supported by
+	/// the memoir class.
+	std::string const writeEnvirBegin(bool useSetSpace) const;
+	/// useSetSpace is true when using the variant supported by
+	/// the memoir class.
+	std::string const writeEnvirEnd(bool useSetSpace) const;
 
 private:
 	///
Index: src/LaTeXFeatures.cpp
===
--- src/LaTeXFeatures.cpp	(revision 22451)
+++ src/LaTeXFeatures.cpp	(working copy)
@@ -637,9 +637,10 @@ string const LaTeXFeatures::getPackages(
 	// setspace.sty
 	if ((params_.spacing().getSpace() != Spacing::Single
 	  !params_.spacing().isDefault())
-	|| isRequired(setspace)) {
-		packages  \\usepackage{setspace}\n;
+	|| (isRequired(setspace)  !tclass.provides(SetSpace))) {
+		packages  \\usepackage{setspace}\n;
 	}
+	bool const upcase = tclass.provides(SetSpace);
 	switch (params_.spacing().getSpace()) {
 	case Spacing::Default:
 	case Spacing::Single:
@@ -647,13 +648,13 @@ string const LaTeXFeatures::getPackages(
 		//packages += \\singlespacing\n;
 		break;
 	case Spacing::Onehalf:
-		packages  \\onehalfspacing\n;
+		packages  (upcase ? \\OnehalfSpacing\n : \\onehalfspacing\n);
 		break;
 	case Spacing::Double:
-		packages  \\doublespacing\n;
+		packages  (upcase ? \\DoubleSpacing\n : \\doublespacing\n);
 		break;
 	case Spacing::Other:
-		packages  \\setstretch{
+		packages  (upcase ? \\setSingleSpace{ : \\setstretch{)
 			  params_.spacing().getValue()  }\n;
 		break;
 	}
Index: src/Spacing.cpp
===
--- src/Spacing.cpp	(revision 22451)
+++ src/Spacing.cpp	(working copy)
@@ -89,20 +89,24 @@ void Spacing::writeFile(ostream  os, bo
 }
 
 
-string const Spacing::writeEnvirBegin() const
+string const Spacing::writeEnvirBegin(bool useSetSpace) const
 {
 	switch (space) {
 	case Default: break; // do nothing
 	case Single:
-		return \\begin{singlespace};
+		return (useSetSpace ? \\begin{SingleSpace}
+			: \\begin{singlespace});
 	case Onehalf:
-		return \\begin{onehalfspace};
+		return (useSetSpace ? \\begin{OnehalfSpace}
+			: \\begin{onehalfspace});
 	case Double:
-		return \\begin{doublespace};
+		return (useSetSpace ? \\begin{DoubleSpace} 
+			: \\begin{doublespace});
 	case Other:
 	{
 		ostringstream ost;
-		ost  \\begin{spacing}{
+		ost  (useSetSpace ? \\begin{Spacing}{
+			: \\begin{spacing}{ )
 		 getValueAsString()  '}';
 		return ost.str();
 	}
@@ -111,18 +115,21 @@ string const Spacing::writeEnvirBegin() 
 }
 
 
-string const Spacing::writeEnvirEnd() const
+string const Spacing::writeEnvirEnd(bool useSetSpace) const
 {
 	switch (space) {
 	case Default: break; // do nothing
 	case Single:
-		return \\end{singlespace};
+		return (useSetSpace ? \\end{SingleSpace}
+			: \\end{singlespace});
 	case Onehalf:
-		return \\end{onehalfspace};
+		return (useSetSpace ? \\end{OnehalfSpace}
+			: \\end{onehalfspace});
 	case Double:
-		return \\end{doublespace};
+		return (useSetSpace ? \\end{DoubleSpace} 
+			: \\end{doublespace});
 	case Other:
-		return \\end{spacing};
+		return (useSetSpace ? \\end{Spacing} : \\end{spacing}) ;
 	}
 	return string();
 }
Index: src/output_latex.cpp
===
--- src/output_latex.cpp	(revision 22451)
+++ src/output_latex.cpp	(working copy)
@@ -491,6 +491,7 @@ TeXOnePar(Buffer const  buf,
 
 	// In an inset with unlimited length (all in one row),
 	// don't allow any special options in the paragraph
+	bool const useSetSpace = bparams.getTextClass().provides(SetSpace);
 	if (!pit-forceDefaultParagraphs()) {
 		if (pit-params().startOfAppendix()) {
 			os  \\appendix\n;
@@ -501,7 +502,7 @@ TeXOnePar(Buffer const  buf,
 			 (pit == paragraphs.begin()
 			|| !boost::prior(pit)-hasSameLayout(*pit)))
 		{
-			os  from_ascii(pit-params().spacing().writeEnvirBegin())
+			os  from_ascii(pit-params().spacing().writeEnvirBegin(useSetSpace))
 			 '\n';
 			texrow.newline();
 		}
@@ -611,7 +612,7 @@ TeXOnePar(Buffer const  buf,
 os  '\n';
 texrow.newline();
 			}
-			os  from_ascii(pit-params().spacing().writeEnvirEnd());
+			os  from_ascii(pit-params().spacing().writeEnvirEnd(useSetSpace));
 			pending_newline = true;
 		}
 	}
Index: lib/layouts/memoir.layout

Re: onehalfspace mystery

2008-01-09 Thread Eran Kaplinsky

Thanks for the work! Harmonizing LyX and memoir is tremendously useful.

Eran


Re: onehalfspace mystery

2008-01-09 Thread Jean-Marc Lasgouttes
Donn [EMAIL PROTECTED] writes:

 Repeating this here as it's the start of the day for me and I'd like to get 
 past this error:
 onehalfspace and doublespace missing environments.

So probably LyX does not output the \usepackage{setspace} command that
it needs in the preamble.

Did you set spacing globally or in a given paragraph? Could you send
an example file?

JMarc


Re: onehalfspace mystery

2008-01-09 Thread Donn
 So probably LyX does not output the \usepackage{setspace} command that
 it needs in the preamble.
Tried that too, still no effect.

 Did you set spacing globally or in a given paragraph? Could you send
 an example file?
I don't think I did anything special globally. I attach a cut-down sample of 
the file that gives me the errors.

Thanks.
\d


error_sample.lyx
Description: application/lyx


Re: onehalfspace mystery

2008-01-09 Thread Jean-Marc Lasgouttes
Donn [EMAIL PROTECTED] writes:

 So probably LyX does not output the \usepackage{setspace} command that
 it needs in the preamble.
 Tried that too, still no effect.

 Did you set spacing globally or in a given paragraph? Could you send
 an example file?
 I don't think I did anything special globally. I attach a cut-down sample of 
 the file that gives me the errors.

OK, the problem is that you use the memoir class, which has its own
implementation of the setspace functionality in newer editions.
However, this functionality is offered as capitalized commands like
DoubleSpace environment.

Juergen, what shall we do? I remember messages from you about memoir
incompatibility, but I cannot see a reference.

One solution would be to have memoir.layout provide SetSpace and act
of the require to change the spacing commands as needed.

JMarc


Re: onehalfspace mystery

2008-01-09 Thread Jean-Marc Lasgouttes
Jean-Marc Lasgouttes [EMAIL PROTECTED] writes:
 Juergen, what shall we do? I remember messages from you about memoir
 incompatibility, but I cannot see a reference.

I found that:
http://www.mail-archive.com/lyx-users@lists.lyx.org/msg52814.html

Would adding \DisemulatePackage{setspace} fix some of our problems (at
the price of not so good spacing?)

I suspect there is a problem with parskip.sty also.

JMarc


Re: onehalfspace mystery

2008-01-09 Thread Donn
 OK, the problem is that you use the memoir class, which has its own
 implementation of the setspace functionality in newer editions.
 However, this functionality is offered as capitalized commands like
 DoubleSpace environment.

Okay, I'll take a break and await advice. Thanks for looking into it.
\d

-- 
I have a low-traffic blog for basic news:
http://otherwiseingle.blogspot.com/


Re: onehalfspace mystery

2008-01-09 Thread Juergen Spitzmueller
Jean-Marc Lasgouttes wrote:

 Juergen, what shall we do? I remember messages from you about memoir
 incompatibility, but I cannot see a reference.

I think there's no bug report yet, but there is a wiki page:
http://wiki.lyx.org/LyX/UsingMemoirInLyX

 One solution would be to have memoir.layout provide SetSpace and act
 of the require to change the spacing commands as needed.

Yes, I guess we need this. I have recently tried to solve it by
redefinitions of setspace commands in the preamble and Provides setspace
1, but this does not work, since the global commands are put before the
Class preamble.

Do you like to have a go?

(we probably need to check since when these memoir SetSpace stuff exists,
and require a certain version).

Jürgen



Re: onehalfspace mystery

2008-01-09 Thread Donn
Um, does this mean I should hang-on a while and compile a new version? I don't 
mind doing that, just don't grok what you are chatting about :)

\d

-- 
Fonty Python and other dev news at:
http://otherwiseingle.blogspot.com/


Re: onehalfspace mystery

2008-01-09 Thread Jean-Marc Lasgouttes
Donn [EMAIL PROTECTED] writes:

 Um, does this mean I should hang-on a while and compile a new version? I 
 don't 
 mind doing that, just don't grok what you are chatting about :)

Try to add
\DisemulatePackage{setspace}
in the preamble of your document.

JMarc


Re: onehalfspace mystery

2008-01-09 Thread Juergen Spitzmueller
Jean-Marc Lasgouttes wrote:

 Try to add
 \DisemulatePackage{setspace}
 in the preamble of your document.

I seem to remember that LyX adds this too late in the game, but my memory
might be wrong

Jürgen



Re: onehalfspace mystery

2008-01-09 Thread Jean-Marc Lasgouttes
Juergen Spitzmueller [EMAIL PROTECTED] writes:

 Jean-Marc Lasgouttes wrote:

 Try to add
 \DisemulatePackage{setspace}
 in the preamble of your document.

 I seem to remember that LyX adds this too late in the game, but my memory
 might be wrong

Indeed. It is a bit better with
\DisemulatePackage{setspace}
\usepackage{setspace}
but there is still an error.

JMarc


Re: onehalfspace mystery

2008-01-09 Thread Juergen Spitzmueller
Jean-Marc Lasgouttes wrote:

 \DisemulatePackage{setspace}
 \usepackage{setspace}
 but there is still an error.

Too bad.
And if Provides setspace 1 is set additionally?

Jürgen



Re: onehalfspace mystery

2008-01-09 Thread Juergen Spitzmueller
Donn wrote:

 Um, does this mean I should hang-on a while and compile a new version? I
 don't mind doing that, just don't grok what you are chatting about :)

It might be that this fix will have to wait for the next major release
(1.6.0), because it might entail a file format change (we need to discuss
this).

For the time being, you can use the ERT workarounds outlines on the wiki
page I referred to.

Jürgen



Re: onehalfspace mystery

2008-01-09 Thread Jean-Marc Lasgouttes
Juergen Spitzmueller [EMAIL PROTECTED] writes:

 Jean-Marc Lasgouttes wrote:

 \DisemulatePackage{setspace}
 \usepackage{setspace}
 but there is still an error.

 Too bad.
 And if Provides setspace 1 is set additionally?

It would not help, we need to actually load setspace.

JMarc


Re: onehalfspace mystery

2008-01-09 Thread Jean-Marc Lasgouttes
Juergen Spitzmueller [EMAIL PROTECTED] writes:

 Do you like to have a go?

It would look like this. I define the new feature SetSpace that is
provided by memoir.layout, and act on it.

JMarc

svndiff src/ lib/layouts/

Index: src/Spacing.h
===
--- src/Spacing.h	(revision 22451)
+++ src/Spacing.h	(working copy)
@@ -58,10 +58,12 @@ public:
 	void set(Spacing::Space sp, std::string const  val);
 	///
 	void writeFile(std::ostream , bool para = false) const;
-	///
-	std::string const writeEnvirBegin() const;
-	///
-	std::string const writeEnvirEnd() const;
+	/// useSetSpace is true when using the variant supported by
+	/// the memoir class.
+	std::string const writeEnvirBegin(bool useSetSpace) const;
+	/// useSetSpace is true when using the variant supported by
+	/// the memoir class.
+	std::string const writeEnvirEnd(bool useSetSpace) const;
 
 private:
 	///
Index: src/LaTeXFeatures.cpp
===
--- src/LaTeXFeatures.cpp	(revision 22451)
+++ src/LaTeXFeatures.cpp	(working copy)
@@ -637,9 +637,10 @@ string const LaTeXFeatures::getPackages(
 	// setspace.sty
 	if ((params_.spacing().getSpace() != Spacing::Single
 	  !params_.spacing().isDefault())
-	|| isRequired(setspace)) {
-		packages  \\usepackage{setspace}\n;
+	|| (isRequired(setspace)  !tclass.provides(SetSpace))) {
+		packages  \\usepackage{setspace}\n;
 	}
+	bool const upcase = tclass.provides(SetSpace);
 	switch (params_.spacing().getSpace()) {
 	case Spacing::Default:
 	case Spacing::Single:
@@ -647,13 +648,13 @@ string const LaTeXFeatures::getPackages(
 		//packages += \\singlespacing\n;
 		break;
 	case Spacing::Onehalf:
-		packages  \\onehalfspacing\n;
+		packages  (upcase ? \\OnehalfSpacing\n : \\onehalfspacing\n);
 		break;
 	case Spacing::Double:
-		packages  \\doublespacing\n;
+		packages  (upcase ? \\DoubleSpacing\n : \\doublespacing\n);
 		break;
 	case Spacing::Other:
-		packages  \\setstretch{
+		packages  (upcase ? \\setSingleSpace{ : \\setstretch{)
 			  params_.spacing().getValue()  }\n;
 		break;
 	}
Index: src/Spacing.cpp
===
--- src/Spacing.cpp	(revision 22451)
+++ src/Spacing.cpp	(working copy)
@@ -89,20 +89,24 @@ void Spacing::writeFile(ostream  os, bo
 }
 
 
-string const Spacing::writeEnvirBegin() const
+string const Spacing::writeEnvirBegin(bool useSetSpace) const
 {
 	switch (space) {
 	case Default: break; // do nothing
 	case Single:
-		return \\begin{singlespace};
+		return (useSetSpace ? \\begin{SingleSpace}
+			: \\begin{singlespace});
 	case Onehalf:
-		return \\begin{onehalfspace};
+		return (useSetSpace ? \\begin{OnehalfSpace}
+			: \\begin{onehalfspace});
 	case Double:
-		return \\begin{doublespace};
+		return (useSetSpace ? \\begin{DoubleSpace} 
+			: \\begin{doublespace});
 	case Other:
 	{
 		ostringstream ost;
-		ost  \\begin{spacing}{
+		ost  (useSetSpace ? \\begin{Spacing}{
+			: \\begin{spacing}{ )
 		 getValueAsString()  '}';
 		return ost.str();
 	}
@@ -111,18 +115,21 @@ string const Spacing::writeEnvirBegin() 
 }
 
 
-string const Spacing::writeEnvirEnd() const
+string const Spacing::writeEnvirEnd(bool useSetSpace) const
 {
 	switch (space) {
 	case Default: break; // do nothing
 	case Single:
-		return \\end{singlespace};
+		return (useSetSpace ? \\end{SingleSpace}
+			: \\end{singlespace});
 	case Onehalf:
-		return \\end{onehalfspace};
+		return (useSetSpace ? \\end{OnehalfSpace}
+			: \\end{onehalfspace});
 	case Double:
-		return \\end{doublespace};
+		return (useSetSpace ? \\end{DoubleSpace} 
+			: \\end{doublespace});
 	case Other:
-		return \\end{spacing};
+		return (useSetSpace ? \\end{Spacing} : \\end{spacing}) ;
 	}
 	return string();
 }
Index: src/output_latex.cpp
===
--- src/output_latex.cpp	(revision 22451)
+++ src/output_latex.cpp	(working copy)
@@ -491,6 +491,7 @@ TeXOnePar(Buffer const  buf,
 
 	// In an inset with unlimited length (all in one row),
 	// don't allow any special options in the paragraph
+	bool const useSetSpace = bparams.getTextClass().provides(SetSpace);
 	if (!pit-forceDefaultParagraphs()) {
 		if (pit-params().startOfAppendix()) {
 			os  \\appendix\n;
@@ -501,7 +502,7 @@ TeXOnePar(Buffer const  buf,
 			 (pit == paragraphs.begin()
 			|| !boost::prior(pit)-hasSameLayout(*pit)))
 		{
-			os  from_ascii(pit-params().spacing().writeEnvirBegin())
+			os  from_ascii(pit-params().spacing().writeEnvirBegin(useSetSpace))
 			 '\n';
 			texrow.newline();
 		}
@@ -611,7 +612,7 @@ TeXOnePar(Buffer const  buf,
 os  '\n';
 texrow.newline();
 			}
-			os  from_ascii(pit-params().spacing().writeEnvirEnd());
+			os  from_ascii(pit-params().spacing().writeEnvirEnd(useSetSpace));
 			pending_newline = true;
 		}
 	}
Index: lib/layouts/memoir.layout

Re: onehalfspace mystery

2008-01-09 Thread Eran Kaplinsky

Thanks for the work! Harmonizing LyX and memoir is tremendously useful.

Eran


Re: onehalfspace mystery

2008-01-09 Thread Jean-Marc Lasgouttes
Donn <[EMAIL PROTECTED]> writes:

> Repeating this here as it's the start of the day for me and I'd like to get 
> past this error:
> onehalfspace and doublespace missing environments.

So probably LyX does not output the \usepackage{setspace} command that
it needs in the preamble.

Did you set spacing globally or in a given paragraph? Could you send
an example file?

JMarc


Re: onehalfspace mystery

2008-01-09 Thread Donn
> So probably LyX does not output the \usepackage{setspace} command that
> it needs in the preamble.
Tried that too, still no effect.

> Did you set spacing globally or in a given paragraph? Could you send
> an example file?
I don't think I did anything special globally. I attach a cut-down sample of 
the file that gives me the errors.

Thanks.
\d


error_sample.lyx
Description: application/lyx


Re: onehalfspace mystery

2008-01-09 Thread Jean-Marc Lasgouttes
Donn <[EMAIL PROTECTED]> writes:

>> So probably LyX does not output the \usepackage{setspace} command that
>> it needs in the preamble.
> Tried that too, still no effect.
>
>> Did you set spacing globally or in a given paragraph? Could you send
>> an example file?
> I don't think I did anything special globally. I attach a cut-down sample of 
> the file that gives me the errors.

OK, the problem is that you use the memoir class, which has its own
implementation of the setspace functionality in newer editions.
However, this functionality is offered as capitalized commands like
DoubleSpace environment.

Juergen, what shall we do? I remember messages from you about memoir
incompatibility, but I cannot see a reference.

One solution would be to have memoir.layout provide "SetSpace" and act
of the require to change the spacing commands as needed.

JMarc


Re: onehalfspace mystery

2008-01-09 Thread Jean-Marc Lasgouttes
Jean-Marc Lasgouttes <[EMAIL PROTECTED]> writes:
> Juergen, what shall we do? I remember messages from you about memoir
> incompatibility, but I cannot see a reference.

I found that:
http://www.mail-archive.com/lyx-users@lists.lyx.org/msg52814.html

Would adding \DisemulatePackage{setspace} fix some of our problems (at
the price of not so good spacing?)

I suspect there is a problem with parskip.sty also.

JMarc


Re: onehalfspace mystery

2008-01-09 Thread Donn
> OK, the problem is that you use the memoir class, which has its own
> implementation of the setspace functionality in newer editions.
> However, this functionality is offered as capitalized commands like
> DoubleSpace environment.

Okay, I'll take a break and await advice. Thanks for looking into it.
\d

-- 
I have a low-traffic blog for basic news:
http://otherwiseingle.blogspot.com/


Re: onehalfspace mystery

2008-01-09 Thread Juergen Spitzmueller
Jean-Marc Lasgouttes wrote:

> Juergen, what shall we do? I remember messages from you about memoir
> incompatibility, but I cannot see a reference.

I think there's no bug report yet, but there is a wiki page:
http://wiki.lyx.org/LyX/UsingMemoirInLyX

> One solution would be to have memoir.layout provide "SetSpace" and act
> of the require to change the spacing commands as needed.

Yes, I guess we need this. I have recently tried to solve it by
redefinitions of setspace commands in the preamble and "Provides setspace
1", but this does not work, since the global commands are put before the
Class preamble.

Do you like to have a go?

(we probably need to check since when these memoir SetSpace stuff exists,
and require a certain version).

Jürgen



Re: onehalfspace mystery

2008-01-09 Thread Donn
Um, does this mean I should hang-on a while and compile a new version? I don't 
mind doing that, just don't grok what you are chatting about :)

\d

-- 
Fonty Python and other dev news at:
http://otherwiseingle.blogspot.com/


Re: onehalfspace mystery

2008-01-09 Thread Jean-Marc Lasgouttes
Donn <[EMAIL PROTECTED]> writes:

> Um, does this mean I should hang-on a while and compile a new version? I 
> don't 
> mind doing that, just don't grok what you are chatting about :)

Try to add
\DisemulatePackage{setspace}
in the preamble of your document.

JMarc


Re: onehalfspace mystery

2008-01-09 Thread Juergen Spitzmueller
Jean-Marc Lasgouttes wrote:

> Try to add
> \DisemulatePackage{setspace}
> in the preamble of your document.

I seem to remember that LyX adds this too late in the game, but my memory
might be wrong

Jürgen



Re: onehalfspace mystery

2008-01-09 Thread Jean-Marc Lasgouttes
Juergen Spitzmueller <[EMAIL PROTECTED]> writes:

> Jean-Marc Lasgouttes wrote:
>
>> Try to add
>> \DisemulatePackage{setspace}
>> in the preamble of your document.
>
> I seem to remember that LyX adds this too late in the game, but my memory
> might be wrong

Indeed. It is a bit better with
\DisemulatePackage{setspace}
\usepackage{setspace}
but there is still an error.

JMarc


Re: onehalfspace mystery

2008-01-09 Thread Juergen Spitzmueller
Jean-Marc Lasgouttes wrote:

> \DisemulatePackage{setspace}
> \usepackage{setspace}
> but there is still an error.

Too bad.
And if "Provides setspace 1" is set additionally?

Jürgen



Re: onehalfspace mystery

2008-01-09 Thread Juergen Spitzmueller
Donn wrote:

> Um, does this mean I should hang-on a while and compile a new version? I
> don't mind doing that, just don't grok what you are chatting about :)

It might be that this fix will have to wait for the next major release
(1.6.0), because it might entail a file format change (we need to discuss
this).

For the time being, you can use the ERT workarounds outlines on the wiki
page I referred to.

Jürgen



Re: onehalfspace mystery

2008-01-09 Thread Jean-Marc Lasgouttes
Juergen Spitzmueller <[EMAIL PROTECTED]> writes:

> Jean-Marc Lasgouttes wrote:
>
>> \DisemulatePackage{setspace}
>> \usepackage{setspace}
>> but there is still an error.
>
> Too bad.
> And if "Provides setspace 1" is set additionally?

It would not help, we need to actually load setspace.

JMarc


Re: onehalfspace mystery

2008-01-09 Thread Jean-Marc Lasgouttes
Juergen Spitzmueller <[EMAIL PROTECTED]> writes:

> Do you like to have a go?

It would look like this. I define the new feature "SetSpace" that is
provided by memoir.layout, and act on it.

JMarc

svndiff src/ lib/layouts/

Index: src/Spacing.h
===
--- src/Spacing.h	(revision 22451)
+++ src/Spacing.h	(working copy)
@@ -58,10 +58,12 @@ public:
 	void set(Spacing::Space sp, std::string const & val);
 	///
 	void writeFile(std::ostream &, bool para = false) const;
-	///
-	std::string const writeEnvirBegin() const;
-	///
-	std::string const writeEnvirEnd() const;
+	/// useSetSpace is true when using the variant supported by
+	/// the memoir class.
+	std::string const writeEnvirBegin(bool useSetSpace) const;
+	/// useSetSpace is true when using the variant supported by
+	/// the memoir class.
+	std::string const writeEnvirEnd(bool useSetSpace) const;
 
 private:
 	///
Index: src/LaTeXFeatures.cpp
===
--- src/LaTeXFeatures.cpp	(revision 22451)
+++ src/LaTeXFeatures.cpp	(working copy)
@@ -637,9 +637,10 @@ string const LaTeXFeatures::getPackages(
 	// setspace.sty
 	if ((params_.spacing().getSpace() != Spacing::Single
 	 && !params_.spacing().isDefault())
-	|| isRequired("setspace")) {
-		packages << "\\usepackage{setspace}\n";
+	|| (isRequired("setspace") && !tclass.provides("SetSpace"))) {
+		packages << "\\usepackage{setspace}\n";
 	}
+	bool const upcase = tclass.provides("SetSpace");
 	switch (params_.spacing().getSpace()) {
 	case Spacing::Default:
 	case Spacing::Single:
@@ -647,13 +648,13 @@ string const LaTeXFeatures::getPackages(
 		//packages += "\\singlespacing\n";
 		break;
 	case Spacing::Onehalf:
-		packages << "\\onehalfspacing\n";
+		packages << (upcase ? "\\OnehalfSpacing\n" : "\\onehalfspacing\n");
 		break;
 	case Spacing::Double:
-		packages << "\\doublespacing\n";
+		packages << (upcase ? "\\DoubleSpacing\n" : "\\doublespacing\n");
 		break;
 	case Spacing::Other:
-		packages << "\\setstretch{"
+		packages << (upcase ? "\\setSingleSpace{" : "\\setstretch{")
 			 << params_.spacing().getValue() << "}\n";
 		break;
 	}
Index: src/Spacing.cpp
===
--- src/Spacing.cpp	(revision 22451)
+++ src/Spacing.cpp	(working copy)
@@ -89,20 +89,24 @@ void Spacing::writeFile(ostream & os, bo
 }
 
 
-string const Spacing::writeEnvirBegin() const
+string const Spacing::writeEnvirBegin(bool useSetSpace) const
 {
 	switch (space) {
 	case Default: break; // do nothing
 	case Single:
-		return "\\begin{singlespace}";
+		return (useSetSpace ? "\\begin{SingleSpace}"
+			: "\\begin{singlespace}");
 	case Onehalf:
-		return "\\begin{onehalfspace}";
+		return (useSetSpace ? "\\begin{OnehalfSpace}"
+			: "\\begin{onehalfspace}");
 	case Double:
-		return "\\begin{doublespace}";
+		return (useSetSpace ? "\\begin{DoubleSpace}" 
+			: "\\begin{doublespace}");
 	case Other:
 	{
 		ostringstream ost;
-		ost << "\\begin{spacing}{"
+		ost << (useSetSpace ? "\\begin{Spacing}{"
+			: "\\begin{spacing}{" )
 		<< getValueAsString() << '}';
 		return ost.str();
 	}
@@ -111,18 +115,21 @@ string const Spacing::writeEnvirBegin() 
 }
 
 
-string const Spacing::writeEnvirEnd() const
+string const Spacing::writeEnvirEnd(bool useSetSpace) const
 {
 	switch (space) {
 	case Default: break; // do nothing
 	case Single:
-		return "\\end{singlespace}";
+		return (useSetSpace ? "\\end{SingleSpace}"
+			: "\\end{singlespace}");
 	case Onehalf:
-		return "\\end{onehalfspace}";
+		return (useSetSpace ? "\\end{OnehalfSpace}"
+			: "\\end{onehalfspace}");
 	case Double:
-		return "\\end{doublespace}";
+		return (useSetSpace ? "\\end{DoubleSpace}" 
+			: "\\end{doublespace}");
 	case Other:
-		return "\\end{spacing}";
+		return (useSetSpace ? "\\end{Spacing}" : "\\end{spacing}") ;
 	}
 	return string();
 }
Index: src/output_latex.cpp
===
--- src/output_latex.cpp	(revision 22451)
+++ src/output_latex.cpp	(working copy)
@@ -491,6 +491,7 @@ TeXOnePar(Buffer const & buf,
 
 	// In an inset with unlimited length (all in one row),
 	// don't allow any special options in the paragraph
+	bool const useSetSpace = bparams.getTextClass().provides("SetSpace");
 	if (!pit->forceDefaultParagraphs()) {
 		if (pit->params().startOfAppendix()) {
 			os << "\\appendix\n";
@@ -501,7 +502,7 @@ TeXOnePar(Buffer const & buf,
 			&& (pit == paragraphs.begin()
 			|| !boost::prior(pit)->hasSameLayout(*pit)))
 		{
-			os << from_ascii(pit->params().spacing().writeEnvirBegin())
+			os << from_ascii(pit->params().spacing().writeEnvirBegin(useSetSpace))
 			<< '\n';
 			texrow.newline();
 		}
@@ -611,7 +612,7 @@ TeXOnePar(Buffer const & buf,
 os << '\n';
 texrow.newline();
 			}
-			os << from_ascii(pit->params().spacing().writeEnvirEnd());
+			os << 

Re: onehalfspace mystery

2008-01-09 Thread Eran Kaplinsky

Thanks for the work! Harmonizing LyX and memoir is tremendously useful.

Eran


Re: onehalfspace mystery

2008-01-08 Thread Jürgen Spitzmüller
Donn wrote:
 Hi,
 Opening a file from a few months ago (in Lyx 1.5.2 same as used to create
 it) and I get error Environment onehalfspace undefined. As well as
 Environment doublespace, on these:
 \begin{onehalfspace}
 \begin{doublespace}

you need the package setspace.sty.

Jürgen


Re: onehalfspace mystery

2008-01-08 Thread Donn
 you need the package setspace.sty.
Thanks, I found it in:
/usr/share/texmf-texlive/tex/latex/setspace/setspace.sty
Copied it to my lyx/share/tex folder (only place I could find other sty files) 
as well as /share/layouts but still getting the same error, what am I 
missing?

\d
-- 
I have a low-traffic blog for basic news:
http://otherwiseingle.blogspot.com/


Re: onehalfspace mystery

2008-01-08 Thread Donn
Repeating this here as it's the start of the day for me and I'd like to get 
past this error:
onehalfspace and doublespace missing environments.

 you need the package setspace.sty.
Thanks, I found it in:
/usr/share/texmf-texlive/tex/latex/setspace/setspace.sty

To clarify, I compiled Lyx 1.5.2 into $HOME/bin/lyx152 and :
Copied setspace.sty to my share/tex folder (only place I could find other sty 
files) as well as share/layouts but still getting the same error, what am I 
missing?

\d


Re: onehalfspace mystery

2008-01-08 Thread Jürgen Spitzmüller
Donn wrote:
 Hi,
 Opening a file from a few months ago (in Lyx 1.5.2 same as used to create
 it) and I get error Environment onehalfspace undefined. As well as
 Environment doublespace, on these:
 \begin{onehalfspace}
 \begin{doublespace}

you need the package setspace.sty.

Jürgen


Re: onehalfspace mystery

2008-01-08 Thread Donn
 you need the package setspace.sty.
Thanks, I found it in:
/usr/share/texmf-texlive/tex/latex/setspace/setspace.sty
Copied it to my lyx/share/tex folder (only place I could find other sty files) 
as well as /share/layouts but still getting the same error, what am I 
missing?

\d
-- 
I have a low-traffic blog for basic news:
http://otherwiseingle.blogspot.com/


Re: onehalfspace mystery

2008-01-08 Thread Donn
Repeating this here as it's the start of the day for me and I'd like to get 
past this error:
onehalfspace and doublespace missing environments.

 you need the package setspace.sty.
Thanks, I found it in:
/usr/share/texmf-texlive/tex/latex/setspace/setspace.sty

To clarify, I compiled Lyx 1.5.2 into $HOME/bin/lyx152 and :
Copied setspace.sty to my share/tex folder (only place I could find other sty 
files) as well as share/layouts but still getting the same error, what am I 
missing?

\d


Re: onehalfspace mystery

2008-01-08 Thread Jürgen Spitzmüller
Donn wrote:
> Hi,
> Opening a file from a few months ago (in Lyx 1.5.2 same as used to create
> it) and I get error Environment onehalfspace undefined. As well as
> Environment doublespace, on these:
> \begin{onehalfspace}
> \begin{doublespace}

you need the package setspace.sty.

Jürgen


Re: onehalfspace mystery

2008-01-08 Thread Donn
> you need the package setspace.sty.
Thanks, I found it in:
/usr/share/texmf-texlive/tex/latex/setspace/setspace.sty
Copied it to my lyx/share/tex folder (only place I could find other sty files) 
as well as /share/layouts but still getting the same error, what am I 
missing?

\d
-- 
I have a low-traffic blog for basic news:
http://otherwiseingle.blogspot.com/


Re: onehalfspace mystery

2008-01-08 Thread Donn
Repeating this here as it's the start of the day for me and I'd like to get 
past this error:
onehalfspace and doublespace missing environments.

> you need the package setspace.sty.
Thanks, I found it in:
/usr/share/texmf-texlive/tex/latex/setspace/setspace.sty

To clarify, I compiled Lyx 1.5.2 into $HOME/bin/lyx152 and :
Copied setspace.sty to my share/tex folder (only place I could find other sty 
files) as well as share/layouts but still getting the same error, what am I 
missing?

\d