Attached is the right approach I think:

We need to insert normal spaces as such so pressing SPACE leads to "\ ", pressing Ctrl+Space leads to "~", inserting a visible space leads to "\textvisiblespace". So we only need to call InsetSpace's latex void to do the job. The attached patch does this but does not compile: "Illegal call of non-static member function." What am I doing wrong here?

thanks and regards
Uwe
Index: insets/InsetSpace.cpp
===================================================================
--- insets/InsetSpace.cpp	(revision 39557)
+++ insets/InsetSpace.cpp	(working copy)
@@ -538,18 +538,18 @@
 {
 	switch (params_.kind) {
 	case InsetSpaceParams::NORMAL:
-		os << (runparams.free_spacing ? " " : "\\ ");
+		os << "\\ ";
 		break;
 	case InsetSpaceParams::PROTECTED:
 		if (runparams.local_font &&
 		    runparams.local_font->language()->lang() == "polutonikogreek")
 			// in babel's polutonikogreek, ~ is active
-			os << (runparams.free_spacing ? " " : "\\nobreakspace{}");
+			os << "\\nobreakspace{}";
 		else
-			os << (runparams.free_spacing ? ' ' : '~');
+			os << '~';
 		break;
 	case InsetSpaceParams::VISIBLE:
-		os << (runparams.free_spacing ? " " : "\\textvisiblespace{}");
+		os << "\\textvisiblespace{}";
 		break;
 	case InsetSpaceParams::THIN:
 		os << (runparams.free_spacing ? " " : "\\,");
Index: Paragraph.cpp
===================================================================
--- Paragraph.cpp	(revision 39556)
+++ Paragraph.cpp	(working copy)
@@ -51,6 +51,7 @@
 
 #include "insets/InsetBibitem.h"
 #include "insets/InsetLabel.h"
+#include "insets/InsetSpace.h"
 #include "insets/InsetSpecialChar.h"
 
 #include "support/debug.h"
@@ -906,11 +907,13 @@
 		os << '\n';
 		os.texrow().start(owner_->id(), i + 1);
 		column = 0;
-	} else if (style.free_spacing) {
-		os << '~';
-	} else {
+	}
+	// we need to distunguish between normal space ('\ '), protected space ('~')
+	// and visible space ("\textvisiblespace") see bug #4742
+	else if (style.free_spacing)
+		InsetSpace::latex(os, runparams);
+	else
 		os << ' ';
-	}
 	return false;
 }
 

Reply via email to