Andre Poenitz wrote:

> On Tue, Jan 21, 2003 at 02:12:42PM +0000, Angus Leeming wrote:
>> Is this your way of saying that the problem lies in mathed itself?
>> Ie, it would go away if we had control over the 'true' passed to
>> the WriteStream c-tor.
> 
> We could certainly use that, but I don't know what the 'nice' flag
> is good for, either. I thought it is _just_ for linebreaking, so the
> question whether \lyxlock should get written should not depend on
> that flag.

Yes, you're right. I just made a wild guess at the problem when I 
first read your description.

>> Here's a minimal "solution" from the preview end rather than the
>> mathed end. We currently generate a latex file for preview-latex
>> by:
>> 
>> 1 Dump LyX preamble.
>> 2 Dump the math-macros
>> 3 Add preview-latex magic
>> \begin{document}
>> 4 Dump all previewable snippets.
>> \end{document}
>> 
>> A hack might be to redefine \lyxlock between 1 and 2 as an empty
>> wrapper. Care to suggest a bit of LaTeX that would do this?
> 
> \def\lyxlock{}
> 
> That can even go to the top of the file.

Attached is the patch. It certainly fixes this problem:

> Simply go into a  'a^b' inset and press C-I to lock it. 
> No fancy previews anymore... 

Happy if I apply it? Guess that Lars should give his Ok too ;-)

-- 
Angus
Index: src/graphics/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/graphics/ChangeLog,v
retrieving revision 1.138
diff -u -p -r1.138 ChangeLog
--- src/graphics/ChangeLog	13 Jan 2003 23:03:48 -0000	1.138
+++ src/graphics/ChangeLog	21 Jan 2003 14:26:26 -0000
@@ -1,3 +1,8 @@
+2003-01-21  Angus Leeming  <[EMAIL PROTECTED]>
+
+	* PreviewLoader.C (dumpPreamble): ensure that \lyxlock does not prevent
+	previews from being generated.
+
 2003-01-13  Angus Leeming  <[EMAIL PROTECTED]>
 
 	* GraphicsCacheItem.C (findTargetFormat): define the default conversion
Index: src/graphics/PreviewLoader.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/graphics/PreviewLoader.C,v
retrieving revision 1.36
diff -u -p -r1.36 PreviewLoader.C
--- src/graphics/PreviewLoader.C	27 Nov 2002 10:30:25 -0000	1.36
+++ src/graphics/PreviewLoader.C	21 Jan 2003 14:26:27 -0000
@@ -562,6 +562,19 @@ void PreviewLoader::Impl::dumpPreamble(o
 	// Dump the preamble only.
 	tmp.makeLaTeXFile(os, buffer_.filePath(), true, false, true);
 
+	// FIXME! This is a HACK! The proper fix is to control the 'true'
+	// passed to WriteStream below:
+	// int InsetFormula::latex(Buffer const *, ostream & os,
+	//                         bool fragile, bool) const
+	// {
+	//	WriteStream wi(os, fragile, true);
+	//	par_->write(wi);
+	//	return wi.line();
+	// }
+	os << "\n"
+	   << "\\def\\lyxlock{}\n"
+	   << "\n";
+
 	// Loop over the insets in the buffer and dump all the math-macros.
 	Buffer::inset_iterator it  = buffer_.inset_const_iterator_begin();
 	Buffer::inset_iterator end = buffer_.inset_const_iterator_end();

Reply via email to