Index: doc/theses/mike_brooks_MMath/programs/sharectx-demo.cfa
===================================================================
--- doc/theses/mike_brooks_MMath/programs/sharectx-demo.cfa	(revision c3e41cda7b7a639338faa16c005b96ed95202da9)
+++ 	(revision )
@@ -1,35 +1,0 @@
-#include <string.hfa>
-#include <string_sharectx.hfa>
-
-void a() {}
-void b() {}
-void c() {}
-void d() {}
-void e() {}
-
-
-
-
-
-
-
-
-
-
-
-void helper2() {
-	c();
-	string_sharectx c = {NEW_SHARING};
-	d();
-}
-void helper1() {
-	a();
-	string_sharectx c = {NO_SHARING};
-	b();
-	helper2();
-	e();
-}
-int main() {
-	helper1();
-}
-
Index: doc/theses/mike_brooks_MMath/programs/sharectx.run.cfa
===================================================================
--- doc/theses/mike_brooks_MMath/programs/sharectx.run.cfa	(revision 489d3ba602f6e02e57ae61a5328cf048be74914a)
+++ doc/theses/mike_brooks_MMath/programs/sharectx.run.cfa	(revision 489d3ba602f6e02e57ae61a5328cf048be74914a)
@@ -0,0 +1,35 @@
+#include <string.hfa>
+#include <string_sharectx.hfa>
+
+void a() {}
+void b() {}
+void c() {}
+void d() {}
+void e() {}
+
+
+
+
+
+
+
+
+
+
+
+void helper2() {
+	c();
+	string_sharectx c = {NEW_SHARING};
+	d();
+}
+void helper1() {
+	a();
+	string_sharectx c = {NO_SHARING};
+	b();
+	helper2();
+	e();
+}
+int main() {
+	helper1();
+}
+
Index: doc/theses/mike_brooks_MMath/programs/sharing-demo.cfa
===================================================================
--- doc/theses/mike_brooks_MMath/programs/sharing-demo.cfa	(revision c3e41cda7b7a639338faa16c005b96ed95202da9)
+++ doc/theses/mike_brooks_MMath/programs/sharing-demo.cfa	(revision 489d3ba602f6e02e57ae61a5328cf048be74914a)
@@ -5,10 +5,9 @@
 #define str(s) #s
 
+ofstream outfile;
+
 void demo1() {
 	sout | sepOff;
-	sout | "Consider two strings @s1@ and @s1a@ that are in an aliasing relationship, and a third, @s2@, made by a simple copy from @s1@.";
-	sout | "\\par\\noindent";
-	sout | "\\begin{tabular}{llll}";
-	sout | "\t\t\t\t& @s1@\t& @s1a@\t& @s2@\t\\\\";
+//	sout | "Consider two strings @s1@ and @s1a@ that are in an aliasing relationship, and a third, @s2@, made by a simple copy from @s1@.";
 
 	#define S1 string s1  = "abc"
@@ -21,63 +20,74 @@
 	assert( s1a == "abc" );
 	assert( s2 == "abc" );
-	sout | xstr(S1) | "\t\\\\";
-	sout | xstr(S1A) | "\t\\\\";
-	sout | xstr(S2) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2;
-	sout | "\\end{tabular}";
-	sout | "\\par\\noindent";
-
-	sout | "Aliasing (@`shareEdits@) means that changes flow in both directions; with a simple copy, they do not.";
-	sout | "\\par\\noindent";
-	sout | "\\begin{tabular}{llll}";
-	sout | "\t\t& @s1@\t& @s1a@\t& @s2@\t\\\\";
-	sout | "\t\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
+
+	open( outfile, "build/sharing1.tex" );
+	outfile | "\\begin{cquote}";
+	outfile | "\\begin{tabular}{@{}llll@{}}";
+	outfile | "\t\t\t& @s1@\t& @s1a@\t& @s2@\t\\\\";
+	outfile | xstr(S1) | "\t\\\\";
+	outfile | xstr(S1A) | "\t\\\\";
+	outfile | xstr(S2) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2;
+	outfile | "\\end{tabular}";
+	outfile | "\\end{cquote}";
+	close( outfile );
+
+//	sout | "Aliasing (@`shareEdits@) means that changes flow in both directions; with a simple copy, they do not.";
+	open( outfile, "build/sharing2.tex" );
+	outfile | "\\begin{cquote}";
+	outfile | "\\begin{tabular}{@{}llll@{}}";
+	outfile | "\t\t& @s1@\t& @s1a@\t& @s2@\t\\\\";
+	outfile | "\\multicolumn{1}{r}{initial} & " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
 
 	#define S1s1 s1 [1] = '+'
 	S1s1;
 	assert( s1 == "a+c" );
-	sout | xstr(S1s1) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
+	outfile | xstr(S1s1) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
 
 	#define S1As1 s1a[1] = '-'
 	S1As1;
 	assert( s1a == "a-c" );
-	sout | xstr(S1As1) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
+	outfile | xstr(S1As1) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
 
 	#define S2s1 s2 [1] = '|'
 	S2s1;
 	assert( s2 == "a|c" );
-	sout | xstr(S2s1) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2;
-	sout | "\\end{tabular}";
-	sout | "\\par\\noindent";
-
-	sout | "Assignment of a value is just a modificiation."
-		   "\nThe aliasing relationship is established at construction and is unaffected by assignment of a value.";
-	sout | "\\par\\noindent";
-	sout | "\\begin{tabular}{llll}";
-	sout | "\t\t& @s1@\t& @s1a@\t& @s2@\t\\\\";
-	sout | "\t\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
+	outfile | xstr(S2s1) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2;
+	outfile | "\\end{tabular}";
+	outfile | "\\end{cquote}";
+	close( outfile );
+
+//	sout | "Assignment of a value is just a modificiation."
+//		   "\nThe aliasing relationship is established at construction and is unaffected by assignment of a value.";
+	open( outfile, "build/sharing3.tex" );
+	outfile | "\\begin{cquote}";
+	outfile | "\\begin{tabular}{llll}";
+	outfile | "\t\t& @s1@\t& @s1a@\t& @s2@\t\\\\";
+	outfile | "\\multicolumn{1}{r}{initial} & " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
 
 	#define S1qrs s1  = "qrs"
 	S1qrs;
 	assert( s1 == "qrs" );
-	sout | xstr(S1qrs) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
+	outfile | xstr(S1qrs) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
 
 	#define S1Atuv s1a = "tuv"
 	S1Atuv;
 	assert( s1a == "tuv" );
-	sout | xstr(S1Atuv) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
+	outfile | xstr(S1Atuv) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
 
 	#define S2wxy s2  = "wxy"
 	S2wxy;
 	assert( s2 == "wxy" );
-	sout | xstr(S2wxy) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2;
-	sout | "\\end{tabular}";
-	sout | "\\par\\noindent";
-
-	sout | "Assignment from a string is just assignment of a value."
-		   "\nWhether of not the RHS participates in aliasing is irrelevant.  Any aliasing of the LHS is unaffected.";
-	sout | "\\par\\noindent";
-	sout | "\\begin{tabular}{llll}";
-	sout | "\t\t& @s1@\t& @s1a@\t& @s2@\t\\\\";
-	sout | "\t\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
+	outfile | xstr(S2wxy) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2;
+	outfile | "\\end{tabular}";
+	outfile | "\\end{cquote}";
+	close( outfile );
+
+//	sout | "Assignment from a string is just assignment of a value."
+//		   "\nWhether of not the RHS participates in aliasing is irrelevant.  Any aliasing of the LHS is unaffected.";
+	open( outfile, "build/sharing4.tex" );
+	outfile | "\\begin{cquote}";
+	outfile | "\\begin{tabular}{llll}";
+	outfile | "\t\t& @s1@\t& @s1a@\t& @s2@\t\\\\";
+	outfile | "\\multicolumn{1}{r}{initial} & " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
 
 	#define S1S2 s1  = s2
@@ -86,5 +96,5 @@
 	assert( s1a == "wxy" );
 	assert( s2 == "wxy" );
-	sout | xstr(S1S2) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
+	outfile | xstr(S1S2) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
 
 	#define S1aaa s1  = "aaa"
@@ -93,5 +103,5 @@
 	assert( s1a == "aaa" );
 	assert( s2 == "wxy" );
-	sout | xstr(S1aaa) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
+	outfile | xstr(S1aaa) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
 
 	#define S2S1 s2  = s1
@@ -100,5 +110,5 @@
 	assert( s1a == "aaa" );
 	assert( s2 == "aaa" );
-	sout | xstr(S2S1) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
+	outfile | xstr(S2S1) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
 
 	#define S2bbb s2  = "bbb"
@@ -107,5 +117,5 @@
 	assert( s1a == "aaa" );
 	assert( s2 == "bbb" );
-	sout | xstr(S2bbb) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
+	outfile | xstr(S2bbb) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
 
 	#define S2S1a s2  = s1a
@@ -114,5 +124,5 @@
 	assert( s1a == "aaa" );
 	assert( s2 == "aaa" );
-	sout | xstr(S2S1a) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
+	outfile | xstr(S2S1a) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
 
 	#define S2ccc s2  = "ccc"
@@ -121,5 +131,5 @@
 	assert( s1a == "aaa" );
 	assert( s2 == "ccc" );
-	sout | xstr(S2ccc) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
+	outfile | xstr(S2ccc) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
 
 	#define S1xxx s1  = "xxx"
@@ -128,23 +138,25 @@
 	assert( s1a == "xxx" );
 	assert( s2 == "ccc" );
-	sout | xstr(S1xxx) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
-	sout | "\\end{tabular}";
-	sout | "\\par";
+	outfile | xstr(S1xxx) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
+	outfile | "\\end{tabular}";
+	outfile | "\\end{cquote}";
+	close( outfile );
 }
 
 
 void demo2() {
-	sout | "Consider new strings @s1_mid@ being an alias for a run in the middle of @s1@, along with @s2@, made by a simple copy from the middle of @s1@.";
-	sout | "\\par\\noindent";
-	sout | "\\begin{tabular}{llll}";
-	sout | "\t\t\t\t& @s1@\t& @s1_mid@\t& @s2@\t\\\\";
+//	sout | "Consider new strings @s1_mid@ being an alias for a run in the middle of @s1@, along with @s2@, made by a simple copy from the middle of @s1@.";
+	open( outfile, "build/sharing5.tex" );
+	outfile | "\\begin{cquote}";
+	outfile | "\\begin{tabular}{llll}";
+	outfile | "\t\t\t\t& @s1@\t& @s1_mid@\t& @s2@\t\\\\";
 
 	#define D2_s1_abcd string s1     = "abcd"
 	D2_s1_abcd;
-	sout | xstr(D2_s1_abcd) | "\t\\\\";
+	outfile | xstr(D2_s1_abcd) | "\t\\\\";
 
 	#define D2_s1mid_s1 string s1_mid = s1(1,2)`shareEdits
 	D2_s1mid_s1;
-	sout | xstr(D2_s1mid_s1) | "\t\\\\";
+	outfile | xstr(D2_s1mid_s1) | "\t\\\\";
 
 	#define D2_s2_s1 string s2     = s1(1,2)
@@ -153,13 +165,15 @@
 	assert( s1_mid == "bc" );
 	assert( s2 == "bc" );
-	sout | xstr(D2_s2_s1) | "\t& " | s1 | "\t& " | s1_mid | "\t& " | s2 | "\t\\\\";
-	sout | "\\end{tabular}";
-	sout | "\\par\\noindent";
-
-	sout | "Again, @`shareEdits@ passes changes in both directions; copy does not.  Note the difference in index values, with the \\emph{b} position being 1 in the longer string and 0 in the shorter strings.  In the case of s1 aliasing with @s1_mid@, the very same character is being accessed by different postitions.";
-	sout | "\\par\\noindent";
-	sout | "\\begin{tabular}{llll}";
-	sout | "\t\t\t\t& @s1@\t& @s1_mid@\t& @s2@\t\\\\";
-	sout | "\t& " | s1 | "\t& " | s1_mid | "\t& " | s2 | "\t\\\\";
+	outfile | xstr(D2_s2_s1) | "\t& " | s1 | "\t& " | s1_mid | "\t& " | s2 | "\t\\\\";
+	outfile | "\\end{tabular}";
+	outfile | "\\end{cquote}";
+	close( outfile );
+
+//	sout | "Again, @`shareEdits@ passes changes in both directions; copy does not.  Note the difference in index values, with the \\emph{b} position being 1 in the longer string and 0 in the shorter strings.  In the case of s1 aliasing with @s1_mid@, the very same character is being accessed by different postitions.";
+	open( outfile, "build/sharing6.tex" );
+	outfile | "\\begin{cquote}";
+	outfile | "\\begin{tabular}{llll}";
+	outfile | "\t\t\t\t& @s1@\t& @s1_mid@\t& @s2@\t\\\\";
+	outfile | "\\multicolumn{1}{r}{initial} & " | s1 | "\t& " | s1_mid | "\t& " | s2 | "\t\\\\";
 
 	#define D2_s1_plus s1    [1] = '+'
@@ -168,5 +182,5 @@
 	assert( s1_mid == "+c" );
 	assert( s2 == "bc" );
-	sout | xstr(D2_s1_plus) | "\t& " | s1 | "\t& " | s1_mid | "\t& " | s2 | "\t\\\\";
+	outfile | xstr(D2_s1_plus) | "\t& " | s1 | "\t& " | s1_mid | "\t& " | s2 | "\t\\\\";
 
 	#define D2_s1mid_minus s1_mid[0] = '-'
@@ -175,5 +189,5 @@
 	assert( s1_mid == "-c" );
 	assert( s2 == "bc" );
-	sout | xstr(D2_s1mid_minus) | "\t& " | s1 | "\t& " | s1_mid | "\t& " | s2 | "\t\\\\";
+	outfile | xstr(D2_s1mid_minus) | "\t& " | s1 | "\t& " | s1_mid | "\t& " | s2 | "\t\\\\";
 
 	#define D2_s2_pipe s2    [0] = '|'
@@ -182,13 +196,15 @@
 	assert( s1_mid == "-c" );
 	assert( s2 == "|c" );
-	sout | xstr(D2_s2_pipe) | "\t& " | s1 | "\t& " | s1_mid | "\t& " | s2 | "\t\\\\";
-	sout | "\\end{tabular}";
-	sout | "\\par\\noindent";
-
-	sout | "Once again, assignment of a value is a modificiation that flows through the aliasing relationship, without affecting its structure.";
-	sout | "\\par\\noindent";
-	sout | "\\begin{tabular}{llll}";
-	sout | "\t\t\t\t& @s1@\t& @s1_mid@\t& @s2@\t\\\\";
-	sout | "\t& " | s1 | "\t& " | s1_mid | "\t& " | s2 | "\t\\\\";
+	outfile | xstr(D2_s2_pipe) | "\t& " | s1 | "\t& " | s1_mid | "\t& " | s2 | "\t\\\\";
+	outfile | "\\end{tabular}";
+	outfile | "\\end{cquote}";
+	close( outfile );
+
+//	sout | "Once again, assignment of a value is a modificiation that flows through the aliasing relationship, without affecting its structure.";
+	open( outfile, "build/sharing7.tex" );
+	outfile | "\\begin{cquote}";
+	outfile | "\\begin{tabular}{llll}";
+	outfile | "\t\t\t\t& @s1@\t& @s1_mid@\t& @s2@\t\\\\";
+	outfile | "\\multicolumn{1}{r}{initial} & " | s1 | "\t& " | s1_mid | "\t& " | s2 | "\t\\\\";
 
 	#define D2_s1mid_ff s1_mid = "ff"
@@ -197,5 +213,5 @@
 	assert( s1_mid == "ff" );
 	assert( s2 == "|c" );
-	sout | xstr(D2_s1mid_ff) | "\t& " | s1 | "\t& " | s1_mid | "\t& " | s2 | "\t\\\\";
+	outfile | xstr(D2_s1mid_ff) | "\t& " | s1 | "\t& " | s1_mid | "\t& " | s2 | "\t\\\\";
 
 	#define D2_s2_gg s2     = "gg"
@@ -204,21 +220,23 @@
 	assert( s1_mid == "ff" );
 	assert( s2 == "gg" );
-	sout | xstr(D2_s2_gg) | "\t& " | s1 | "\t& " | s1_mid | "\t& " | s2 | "\t\\\\";
-	sout | "\\end{tabular}";
-	sout | "\\par\\noindent";
-
-	sout | "In the \\emph{ff} step, which is a positive example of flow across an aliasing relationship, the result is straightforward to accept because the flow direction is from contained (small) to containing (large).  The following rules for edits through aliasing substrings will guide how to flow in the opposite direction.";
-	sout | "\\par";
-
-
-	sout | "Growth and shrinkage are natural extensions.  An empty substring is a real thing, at a well-defined location, whose meaning is extrapolated from the examples so far.  The intended metaphor is to operating a GUI text editor.  Having an aliasing substring is like using the mouse to select a few words.  Assigning onto an aliasign substring is like typing from having a few words selected:  depending how much you type, the file being edited can get shorter or longer.";
-	sout | "\\par\\noindent";
-	sout | "\\begin{tabular}{lll}";
-	sout | "\t\t\t\t& @s1@\t& @s1_mid@\t\\\\";
-	sout | "\t& " | s1 | "\t& " | s1_mid | "\t\\\\";
+	outfile | xstr(D2_s2_gg) | "\t& " | s1 | "\t& " | s1_mid | "\t& " | s2 | "\t\\\\";
+	outfile | "\\end{tabular}";
+	outfile | "\\end{cquote}";
+	close( outfile );
+
+//	sout | "In the \\emph{ff} step, which is a positive example of flow across an aliasing relationship, the result is straightforward to accept because the flow direction is from contained (small) to containing (large).  The following rules for edits through aliasing substrings will guide how to flow in the opposite direction.";
+//	sout | "\\par";
+
+
+//	sout | "Growth and shrinkage are natural extensions.  An empty substring is a real thing, at a well-defined location, whose meaning is extrapolated from the examples so far.  The intended metaphor is to operating a GUI text editor.  Having an aliasing substring is like using the mouse to select a few words.  Assigning onto an aliasign substring is like typing from having a few words selected:  depending how much you type, the file being edited can get shorter or longer.";
+	open( outfile, "build/sharing8.tex" );
+	outfile | "\\begin{cquote}";
+	outfile | "\\begin{tabular}{lll}";
+	outfile | "\t\t\t\t& @s1@\t& @s1_mid@\t\\\\";
+	outfile | "\\multicolumn{1}{r}{initial} & " | s1 | "\t& " | s1_mid | "\t\\\\";
 
 	assert( s1 == "affd" );
 //	assert( s1_mid == "fc" );													 // ????????? bug?
-	sout | xstr(D2_s2_gg) | "\t& " | s1 | "\t& " | s1_mid | "\t\\\\";
+	outfile | xstr(D2_s2_gg) | "\t& " | s1 | "\t& " | s1_mid | "\t\\\\";
 
 	#define D2_s1mid_hhhh s1_mid = "hhhh"
@@ -226,5 +244,5 @@
 	assert( s1 == "ahhhhd" );
 	assert( s1_mid == "hhhh" );
-	sout  | xstr(D2_s1mid_hhhh)  | "\t& " | s1 | "\t& " | s1_mid | "\t\\\\";
+	outfile  | xstr(D2_s1mid_hhhh)  | "\t& " | s1 | "\t& " | s1_mid | "\t\\\\";
 
 	#define D2_s1mid_i s1_mid = "i"
@@ -232,5 +250,5 @@
 	assert( s1 == "aid" );
 	assert( s1_mid == "i" );
-	sout  | xstr(D2_s1mid_i)  | "\t& " | s1 | "\t& " | s1_mid | "\t\\\\";
+	outfile  | xstr(D2_s1mid_i)  | "\t& " | s1 | "\t& " | s1_mid | "\t\\\\";
 
 	#define D2_s1mid_empty s1_mid = ""
@@ -238,5 +256,5 @@
 	assert( s1 == "ad" );
 	// assert( s1_mid == "" );    ------ Should be so, but fails
-	sout  | xstr(D2_s1mid_empty)  | "\t& " | s1 | "\t& " | s1_mid | "\t\\\\";
+	outfile  | xstr(D2_s1mid_empty)  | "\t& " | s1 | "\t& " | s1_mid | "\t\\\\";
 
 	#define D2_s1mid_jj s1_mid = "jj"
@@ -244,16 +262,18 @@
 	assert( s1 == "ajjd" );
 	assert( s1_mid == "jj" );
-	sout  | xstr(D2_s1mid_jj)  | "\t& " | s1 | "\t& " | s1_mid | "\t\\\\";
-	sout | "\\end{tabular}";
-	sout | "\\par\\noindent";
-
-	sout | "Multiple portions can be aliased.  When there are several aliasing substrings at once, the text editor analogy becomes an online multi-user editor.  I should be able to edit a paragraph in one place (changing the document's length), without my edits affecting which letters are within a mouse-selection that you had made previously, somewhere else.";
-	sout | "\\par\\noindent";
-	sout | "\\begin{tabular}{lllll}";
-	sout | "\t\t\t\t& @s1@\t& @s1_bgn@\t& @s1_mid@\t& @s1_end@\t\\\\";
+	outfile  | xstr(D2_s1mid_jj)  | "\t& " | s1 | "\t& " | s1_mid | "\t\\\\";
+	outfile | "\\end{tabular}";
+	outfile | "\\end{cquote}";
+	close( outfile );
+
+//	sout | "Multiple portions can be aliased.  When there are several aliasing substrings at once, the text editor analogy becomes an online multi-user editor.  I should be able to edit a paragraph in one place (changing the document's length), without my edits affecting which letters are within a mouse-selection that you had made previously, somewhere else.";
+	open( outfile, "build/sharing9.tex" );
+	outfile | "\\begin{cquote}";
+	outfile | "\\begin{tabular}{lllll}";
+	outfile | "\t\t\t\t& @s1@\t& @s1_bgn@\t& @s1_mid@\t& @s1_end@\t\\\\";
 
 	#define D2_s1bgn_s1	string s1_bgn = s1(0, 1)`shareEdits
 	D2_s1bgn_s1;
-	sout  | xstr(D2_s1bgn_s1)  | "\t\\\\";
+	outfile  | xstr(D2_s1bgn_s1)  | "\t\\\\";
 
 	#define D2_s1end_s1 string s1_end = s1(3, 1)`shareEdits
@@ -263,5 +283,5 @@
 	assert( s1_mid == "jj" );
 	assert( s1_end == "d" );
-	sout  | xstr(D2_s1end_s1)  | "\t& " | s1 | "\t& " | s1_bgn | "\t& " | s1_mid | "\t& " | s1_end | "\t\\\\";
+	outfile  | xstr(D2_s1end_s1)  | "\t& " | s1 | "\t& " | s1_bgn | "\t& " | s1_mid | "\t& " | s1_end | "\t\\\\";
 
 	#define D1_s1bgn_zzz s1_bgn = "zzzz"
@@ -271,12 +291,14 @@
 	assert( s1_mid == "jj" );
 	assert( s1_end == "d" );
-	sout  | xstr(D1_s1bgn_zzz)  | "\t& " | s1 | "\t& " | s1_bgn | "\t& " | s1_mid | "\t& " | s1_end | "\t\\\\";
-	sout | "\\end{tabular}";
-	sout | "\\par\\noindent";
-
-	sout | "When an edit happens on an aliasing substring that overlaps another, an effect is unavoidable.  Here, the passive party sees its selection shortened, to exclude the characters that were not part of the original selection.";
-	sout | "\\par\\noindent";
-	sout | "\\begin{tabular}{llllll}";
-	sout | "\t\t\t\t& @s1@\t& @s1_bgn@\t& @s1_crs@\t& @s1_mid@\t& @s1_end@\t\\\\";
+	outfile  | xstr(D1_s1bgn_zzz)  | "\t& " | s1 | "\t& " | s1_bgn | "\t& " | s1_mid | "\t& " | s1_end | "\t\\\\";
+	outfile | "\\end{tabular}";
+	outfile | "\\end{cquote}";
+	close( outfile );
+
+//	sout | "When an edit happens on an aliasing substring that overlaps another, an effect is unavoidable.  Here, the passive party sees its selection shortened, to exclude the characters that were not part of the original selection.";
+	open( outfile, "build/sharing10.tex" );
+	outfile | "\\begin{cquote}";
+	outfile | "\\begin{tabular}{llllll}";
+	outfile | "\t\t\t\t& @s1@\t& @s1_bgn@\t& @s1_crs@\t& @s1_mid@\t& @s1_end@\t\\\\";
 
 	#define D2_s1crs_s1 string s1_crs = s1(3, 2)`shareEdits
@@ -287,5 +309,5 @@
 	assert( s1_mid == "jj" );
 	assert( s1_end == "d" );
-	sout  | xstr(D2_s1crs_s1)  | "\t& " | s1 | "\t& " | s1_bgn | "\t& " | s1_crs | "\t& " | s1_mid | "\t& " | s1_end | "\t\\\\";
+	outfile  | xstr(D2_s1crs_s1)  | "\t& " | s1 | "\t& " | s1_bgn | "\t& " | s1_crs | "\t& " | s1_mid | "\t& " | s1_end | "\t\\\\";
 
 	#define D2_s1crs_ppp s1_crs = "+++"
@@ -296,8 +318,8 @@
 	assert( s1_mid == "j" );
 	assert( s1_end == "d" );
-	sout  | xstr(D2_s1crs_ppp)  | "\t& " | s1 | "\t& " | s1_bgn | "\t& " | s1_crs | "\t& " | s1_mid | "\t& " | s1_end | "\t\\\\";
-	sout | "\\end{tabular}";
-	sout | "\\par\\noindent";
-	sout | "TODO: finish typesetting the demo";
+	outfile  | xstr(D2_s1crs_ppp)  | "\t& " | s1 | "\t& " | s1_bgn | "\t& " | s1_crs | "\t& " | s1_mid | "\t& " | s1_end | "\t\\\\";
+	outfile | "\\end{tabular}";
+	outfile | "\\end{cquote}";
+	close( outfile );
 
 	// "This shortening behaviour means that a modification has to occur entirely inside a substring, to show up in that substring.  Sharing changes through the intersection of partially overlapping aliases is still possible, so long as the receiver's boundary is not inside the edit."
@@ -379,4 +401,4 @@
 	demo1();
 	demo2();
-	printf("%% %s done running\n", argv[0]);
+//	printf("%% %s done running\n", argv[0]);
 }
