<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.luatex.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Rkrug</id>
	<title>LuaTeXWiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.luatex.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Rkrug"/>
	<link rel="alternate" type="text/html" href="https://wiki.luatex.org/index.php/Special:Contributions/Rkrug"/>
	<updated>2026-05-31T14:21:33Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.1</generator>
	<entry>
		<id>https://wiki.luatex.org/index.php?title=Main_Page&amp;diff=3577</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://wiki.luatex.org/index.php?title=Main_Page&amp;diff=3577"/>
		<updated>2021-02-22T23:46:36Z</updated>

		<summary type="html">&lt;p&gt;Rkrug: Added a link to TeX_without_TeX_revised_and_expanded&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Welcome to the LuaTeX wiki ==&lt;br /&gt;
&lt;br /&gt;
This is a wiki for [http://www.luatex.org LuaTeX], a typesetting engine derived from &lt;br /&gt;
[http://en.wikipedia.org/wiki/TeX TeX] that includes [http://www.lua.org Lua] as an embedded scripting language.&lt;br /&gt;
&lt;br /&gt;
See [[Special:Allpages|all the articles]] or the [[Special:Recentchanges|recent changes]].&lt;br /&gt;
&lt;br /&gt;
* [http://www.mediawiki.org/wiki/Help:Formatting How to edit wiki pages]&lt;br /&gt;
* [[Bug tracking|Bug tracking]]: Mantis [http://tracker.luatex.org bug tracker]&lt;br /&gt;
&lt;br /&gt;
== Some articles ==&lt;br /&gt;
&lt;br /&gt;
* [[Documentation and help]] points to other online resources (manuals, mailing list, etc.) related to LuaTeX.&lt;br /&gt;
* [[Writing Lua in TeX]] explains how to write Lua code in a TeX document (and back).&lt;br /&gt;
* [[Attributes]] introduces LuaTeX&amp;#039;s thrilling new concept.&lt;br /&gt;
* Pages on callbacks:&lt;br /&gt;
** [[Callbacks]] introduces callbacks and how to use them.&lt;br /&gt;
** There is a page on the [[Post linebreak filter|&amp;lt;tt&amp;gt;post_linebreak_filter&amp;lt;/tt&amp;gt;]] callback, explaining and illustrating it with a couple of examples. The [[Show the hyphenation points]] article is another example of use.&lt;br /&gt;
** The page on [[process input buffer|the &amp;lt;tt&amp;gt;process_input_buffer&amp;lt;/tt&amp;gt; callback]] illustrates how to read documents with non-UTF-8 encoding, and how to write TeX with lightweight markup instead of the usual commands.&lt;br /&gt;
** Another callback is [[show error hook|&amp;lt;tt&amp;gt;show_error_hook&amp;lt;/tt&amp;gt;]], which lets you enliven your error messages!&lt;br /&gt;
** You can fake XeTeX&amp;#039;s interchar tokens with the [[token filter|&amp;lt;tt&amp;gt;token_filter&amp;lt;/tt&amp;gt;]].&lt;br /&gt;
* [[TeX without TeX]] is about using TeX&amp;#039;s functionality (typesetting, pdf writing) only using Lua code (no &amp;lt;tt&amp;gt;\TeX&amp;lt;/tt&amp;gt; macros).&lt;br /&gt;
* [[TeX_without_TeX_revised_and_expanded]] is a revision and expansion of the above.&lt;br /&gt;
* [[fontsampler|Create a fontsampler]] using plain LuaTeX and &amp;lt;tt&amp;gt;luaotfload&amp;lt;/tt&amp;gt;.&lt;br /&gt;
* [[Annotate math expressions]] in PDF with a bounding box using LuaLaTeX.&lt;br /&gt;
&lt;br /&gt;
== Packages on LuaTeX ==&lt;br /&gt;
&lt;br /&gt;
* [http://ctan.org/pkg/lua-visual-debug lua-visual-debug] Visual debugging with LuaLaTeX.&lt;br /&gt;
* [https://github.com/koppor/luabibentry luabibentry] Repeat BibTeX entries in a LuaLaTeX document body.&lt;br /&gt;
* [http://ctan.org/pkg/luacode luacode] Helper for executing lua code from within TeX.&lt;br /&gt;
* [http://en.sourceforge.jp/projects/luatex-ja/ LuaTeX-ja] LuaTeX-ja is a macro package to typeset Japanese(also Chinese) texts using Lua(La)TeX.&lt;br /&gt;
* [http://ctan.org/pkg/luaindex luaindex] Create index using lualatex.&lt;br /&gt;
* [http://ctan.org/pkg/luainputenc luainputenc] Replacing inputenc for use in LuaTeX.&lt;br /&gt;
* [http://ctan.org/pkg/lualatex-math lualatex-math] Fixes for mathematics-related LuaLaTeX issues.&lt;br /&gt;
* [http://ctan.org/pkg/lualibs lualibs] Additional Lua functions for LuaTeX macro programmers.&lt;br /&gt;
* [http://ctan.org/pkg/luamplib luamplib] Use LuaTeX&amp;#039;s built-in MetaPost interpreter.&lt;br /&gt;
* [http://ctan.org/pkg/luaotfload luaotfload] OpenType layout system for Plain TeX and LaTeX.&lt;br /&gt;
* [http://ctan.org/pkg/luasseq luasseq] Drawing spectral sequences in LuaLaTeX.&lt;br /&gt;
* [http://ctan.org/pkg/luatexbase luatexbase] Basic resource management for LuaTeX code.&lt;br /&gt;
&lt;br /&gt;
== Useful modules ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [http://ctan.org/pkg/nodetree nodetree] visualize node lists in a tree view&lt;br /&gt;
&lt;br /&gt;
* [https://gist.github.com/556247 viznodelist] LuaTeX nodelist visualization&lt;br /&gt;
&lt;br /&gt;
== From the old bluwiki.com ==&lt;br /&gt;
&lt;br /&gt;
(Mostly by and thanks to [http://omega.enstb.org/yannis/ Yannis Haralambous])&lt;br /&gt;
&lt;br /&gt;
* An example of code [[traversing TeX nodes]] before an horizontal list goes through the line breaking engine;&lt;br /&gt;
* An example of code [[traversing tokens]] just before execution or expansion;&lt;br /&gt;
* you want to [[explore the table obtained from a TrueType font]], loaded by &amp;lt;tt&amp;gt;font.read_ttf&amp;lt;/tt&amp;gt;;&lt;br /&gt;
* you want to [[explore the internal font table]] of a pre-loaded font or of a font you have loaded by &amp;lt;tt&amp;gt;\font&amp;lt;/tt&amp;gt; and then used for at least one glyph;&lt;br /&gt;
* how to [[use a TrueType font]] without going through a TFM or a OFM file;&lt;br /&gt;
* how to do &amp;lt;i&amp;gt;kinsoku&amp;lt;/i&amp;gt; ([[Japanese and more generally CJK typesetting]]);&lt;br /&gt;
* you want a newline in your log file or on the terminal? add &amp;lt;tt&amp;gt;\string\n&amp;lt;/tt&amp;gt; to your string;&lt;br /&gt;
* you want to [[sort a token list]];&lt;br /&gt;
* you want to [[split a comma-separated list]];&lt;br /&gt;
* you want to [[encrypt your document using ROT13]];&lt;br /&gt;
* you want to [[typeset non-TeX files by converting them using Lua code]];&lt;br /&gt;
* example code to [[mirror characters with Bidi_Mirrored property]];&lt;br /&gt;
* using mplib to write [[metapost with LuaTeX]]&lt;/div&gt;</summary>
		<author><name>Rkrug</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.luatex.org/index.php?title=TeX_without_TeX_revised_and_expanded&amp;diff=3576</id>
		<title>TeX without TeX revised and expanded</title>
		<link rel="alternate" type="text/html" href="https://wiki.luatex.org/index.php?title=TeX_without_TeX_revised_and_expanded&amp;diff=3576"/>
		<updated>2021-02-22T23:38:18Z</updated>

		<summary type="html">&lt;p&gt;Rkrug: Created page with &amp;quot; == About ==  This is an update and expansion of TeX without TeX --- using TeX&amp;#039;s functionality (typesetting, pdf writing) using only Lua code (no \TeX macros).  It is (I b...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== About ==&lt;br /&gt;
&lt;br /&gt;
This is an update and expansion of [[TeX without TeX]] --- using TeX&amp;#039;s&lt;br /&gt;
functionality (typesetting, pdf writing) using only Lua code (no \TeX&lt;br /&gt;
macros).&lt;br /&gt;
&lt;br /&gt;
It is (I believe) an adequate framework for developing a complete&lt;br /&gt;
type-setting system; although one dedicated to a specific task, rather&lt;br /&gt;
than a general purpose system such as LaTeX or ConTeXt. It includes a&lt;br /&gt;
couple of example formatting commands (\Emph and \Bold), titles&lt;br /&gt;
(\Title), the ability to include other subsidiary text files (\Input)&lt;br /&gt;
and footnotes (\Footnote). It can be easily adapted and expanded to&lt;br /&gt;
suit your needs.&lt;br /&gt;
&lt;br /&gt;
I am not much of a programmer, and knew little about TeX and even less&lt;br /&gt;
about Lua when I started this, so there is undoubtedly much that can&lt;br /&gt;
be improved.  All questions, comments, suggestions, and corrections&lt;br /&gt;
will be appreciated. You can reach me at &amp;quot;destiny6 &amp;lt;AT&amp;gt; mac &amp;lt;DOT&amp;gt;&lt;br /&gt;
com&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Pre-requisites ==&lt;br /&gt;
&lt;br /&gt;
This system requires the luatex-plain format (from ConTeXt), so that&lt;br /&gt;
we have access to Open Type Fonts and other goodies. This is what I&lt;br /&gt;
did on my system:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Find the luatex-plain.tex file. On my system (with TeX-Live 2020)&lt;br /&gt;
it was at:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/usr/local/share/texmf-dist/tex/generic/context/luatex/luatex-plain.tex&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; If you just build a format file,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
luatex --ini /usr/local/share/texmf-dist/tex/generic/context/luatex/luatex-plain.tex&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
you will probably get warnings about using the &amp;quot;merged&amp;quot; file, and not&lt;br /&gt;
the more current and supported files. Delete, move, or rename this&lt;br /&gt;
file. On my system I did:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
doas mv /usr/local/share/texmf-dist/tex/generic/context/luatex/luatex-fonts-merged.lua /usr/local/share/texmf-dist/tex/generic/context/luatex/luatex-fonts-merged.lua.bak&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Now, build the format file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
luatex --ini /usr/local/share/texmf-dist/tex/generic/context/luatex/luatex-plain.tex&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; We are almost done. If the resulting format file (luatex-plain.fmt)&lt;br /&gt;
is in the current working directory, you can use it with something&lt;br /&gt;
like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
luatex --fmt luatex-plain test&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; But, this is too restrictive.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Create a new executable with the name luatex-plain. Something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ln -s `which luatex` /usr/local/bin/luatex-plain&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; When you try to invoke it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
luatex-plain test&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
it will fail with a message about failing to find the proper&lt;br /&gt;
format file. There should be a line something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mktexfmt [INFO]: writing formats under ~/.texlive2020/texmf-var/web2c&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
so, copy the format file to that location:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp luatex-plain.fmt ~/.texlive2020/texmf-var/web2c/&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
now, this should work:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
luatex-plain test&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Finally, run mtxrun to generate a fonts database: &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mtxrun --script fonts --reload --simple&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Contents ==&lt;br /&gt;
&lt;br /&gt;
The most recent files for this project are also available at:&lt;br /&gt;
[https://github.com/s-dismas/TeX-without-TeX-revised GitHub]&lt;br /&gt;
&lt;br /&gt;
There is a Read Eval Print Loop available for interactive exploring:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:repl.lua|repl.lua]]&lt;br /&gt;
&lt;br /&gt;
It can be invoked with &amp;lt;code&amp;gt;repl.repl()&amp;lt;code/&amp;gt;, and either&lt;br /&gt;
&amp;lt;code&amp;gt;quit()&amp;lt;code/&amp;gt; or &amp;lt;code&amp;gt;exit&amp;lt;code/&amp;gt; will exit it. I use Shell Mode in&lt;br /&gt;
Emacs, but a simple terminal or similar should also work.&lt;br /&gt;
&lt;br /&gt;
Some utilites are in the file:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:utils.lua|utils.lua]]&lt;br /&gt;
&lt;br /&gt;
The following five files comprise the system:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:reader.lua|reader.lua]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:format.lua|format.lua]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:main.lua|main.lua]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:pages.lua|pages.lua]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:commands.lua|commands.lua]]&lt;br /&gt;
&lt;br /&gt;
The license for this software can be seen at:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:LICENSE.txt| License.]]&lt;br /&gt;
&lt;br /&gt;
The TeX file to be compiled by luatex-plain is:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:test.tex|test.tex]]&lt;br /&gt;
&lt;br /&gt;
The Lua file executed by &amp;lt;code&amp;gt;\directlua{dofile &amp;quot;test.lua&amp;quot;}&amp;lt;/code&amp;gt;&lt;br /&gt;
within [[T_wo_T_r:test.tex|test.tex]] is:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:test.lua|test.lua]]&lt;br /&gt;
&lt;br /&gt;
The main text file to be typeset is:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:text.tex|text.tex]]&lt;br /&gt;
&lt;br /&gt;
It includes the following five files:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:chapter-1.tex|chapter 1]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:chapter-2.tex|chapter 2]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:chapter-3.tex|chapter 3]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:chapter-4.tex|chapter 4]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:chapter-5.tex|chapter 5]]&lt;/div&gt;</summary>
		<author><name>Rkrug</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.luatex.org/index.php?title=T_wo_T_r:twotr&amp;diff=3575</id>
		<title>T wo T r:twotr</title>
		<link rel="alternate" type="text/html" href="https://wiki.luatex.org/index.php?title=T_wo_T_r:twotr&amp;diff=3575"/>
		<updated>2021-02-22T23:35:36Z</updated>

		<summary type="html">&lt;p&gt;Rkrug: Really fix formatting?&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== About ==&lt;br /&gt;
&lt;br /&gt;
This is an update and expansion of [[TeX without TeX]] --- using TeX&amp;#039;s&lt;br /&gt;
functionality (typesetting, pdf writing) using only Lua code (no \TeX&lt;br /&gt;
macros).&lt;br /&gt;
&lt;br /&gt;
It is (I believe) an adequate framework for developing a complete&lt;br /&gt;
type-setting system; although one dedicated to a specific task, rather&lt;br /&gt;
than a general purpose system such as LaTeX or ConTeXt. It includes a&lt;br /&gt;
couple of example formatting commands (\Emph and \Bold), titles&lt;br /&gt;
(\Title), the ability to include other subsidiary text files (\Input)&lt;br /&gt;
and footnotes (\Footnote). It can be easily adapted and expanded to&lt;br /&gt;
suit your needs.&lt;br /&gt;
&lt;br /&gt;
I am not much of a programmer, and knew little about TeX and even less&lt;br /&gt;
about Lua when I started this, so there is undoubtedly much that can&lt;br /&gt;
be improved.  All questions, comments, suggestions, and corrections&lt;br /&gt;
will be appreciated. You can reach me at &amp;quot;destiny6 &amp;lt;AT&amp;gt; mac &amp;lt;DOT&amp;gt;&lt;br /&gt;
com&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Pre-requisites ==&lt;br /&gt;
&lt;br /&gt;
This system requires the luatex-plain format (from ConTeXt), so that&lt;br /&gt;
we have access to Open Type Fonts and other goodies. This is what I&lt;br /&gt;
did on my system:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Find the luatex-plain.tex file. On my system (with TeX-Live 2020)&lt;br /&gt;
it was at:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/usr/local/share/texmf-dist/tex/generic/context/luatex/luatex-plain.tex&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; If you just build a format file,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
luatex --ini /usr/local/share/texmf-dist/tex/generic/context/luatex/luatex-plain.tex&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
you will probably get warnings about using the &amp;quot;merged&amp;quot; file, and not&lt;br /&gt;
the more current and supported files. Delete, move, or rename this&lt;br /&gt;
file. On my system I did:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
doas mv /usr/local/share/texmf-dist/tex/generic/context/luatex/luatex-fonts-merged.lua /usr/local/share/texmf-dist/tex/generic/context/luatex/luatex-fonts-merged.lua.bak&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Now, build the format file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
luatex --ini /usr/local/share/texmf-dist/tex/generic/context/luatex/luatex-plain.tex&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; We are almost done. If the resulting format file (luatex-plain.fmt)&lt;br /&gt;
is in the current working directory, you can use it with something&lt;br /&gt;
like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
luatex --fmt luatex-plain test&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; But, this is too restrictive.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Create a new executable with the name luatex-plain. Something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ln -s `which luatex` /usr/local/bin/luatex-plain&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; When you try to invoke it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
luatex-plain test&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
it will fail with a message about failing to find the proper&lt;br /&gt;
format file. There should be a line something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mktexfmt [INFO]: writing formats under ~/.texlive2020/texmf-var/web2c&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
so, copy the format file to that location:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp luatex-plain.fmt ~/.texlive2020/texmf-var/web2c/&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
now, this should work:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
luatex-plain test&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Finally, run mtxrun to generate a fonts database: &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mtxrun --script fonts --reload --simple&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Contents ==&lt;br /&gt;
&lt;br /&gt;
The most recent files for this project are also available at:&lt;br /&gt;
[https://github.com/s-dismas/TeX-without-TeX-revised GitHub]&lt;br /&gt;
&lt;br /&gt;
There is a Read Eval Print Loop available for interactive exploring:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:repl.lua|repl.lua]]&lt;br /&gt;
&lt;br /&gt;
It can be invoked with &amp;lt;code&amp;gt;repl.repl()&amp;lt;code/&amp;gt;, and either&lt;br /&gt;
&amp;lt;code&amp;gt;quit()&amp;lt;code/&amp;gt; or &amp;lt;code&amp;gt;exit&amp;lt;code/&amp;gt; will exit it. I use Shell Mode in&lt;br /&gt;
Emacs, but a simple terminal or similar should also work.&lt;br /&gt;
&lt;br /&gt;
Some utilites are in the file:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:utils.lua|utils.lua]]&lt;br /&gt;
&lt;br /&gt;
The following five files comprise the system:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:reader.lua|reader.lua]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:format.lua|format.lua]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:main.lua|main.lua]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:pages.lua|pages.lua]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:commands.lua|commands.lua]]&lt;br /&gt;
&lt;br /&gt;
The license for this software can be seen at:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:LICENSE.txt| License.]]&lt;br /&gt;
&lt;br /&gt;
The TeX file to be compiled by luatex-plain is:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:test.tex|test.tex]]&lt;br /&gt;
&lt;br /&gt;
The Lua file executed by &amp;lt;code&amp;gt;\directlua{dofile &amp;quot;test.lua&amp;quot;}&amp;lt;/code&amp;gt;&lt;br /&gt;
within [[T_wo_T_r:test.tex|test.tex]] is:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:test.lua|test.lua]]&lt;br /&gt;
&lt;br /&gt;
The main text file to be typeset is:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:text.tex|text.tex]]&lt;br /&gt;
&lt;br /&gt;
It includes the following five files:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:chapter-1.tex|chapter 1]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:chapter-2.tex|chapter 2]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:chapter-3.tex|chapter 3]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:chapter-4.tex|chapter 4]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:chapter-5.tex|chapter 5]]&lt;/div&gt;</summary>
		<author><name>Rkrug</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.luatex.org/index.php?title=T_wo_T_r:twotr&amp;diff=3574</id>
		<title>T wo T r:twotr</title>
		<link rel="alternate" type="text/html" href="https://wiki.luatex.org/index.php?title=T_wo_T_r:twotr&amp;diff=3574"/>
		<updated>2021-02-22T23:13:14Z</updated>

		<summary type="html">&lt;p&gt;Rkrug: Fix formatting&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== About ==&lt;br /&gt;
&lt;br /&gt;
This is an update and expansion of [[TeX without TeX]] --- using TeX&amp;#039;s&lt;br /&gt;
functionality (typesetting, pdf writing) using only Lua code (no \TeX&lt;br /&gt;
macros).&lt;br /&gt;
&lt;br /&gt;
It is (I believe) an adequate framework for developing a complete&lt;br /&gt;
type-setting system; although one dedicated to a specific task, rather&lt;br /&gt;
than a general purpose system such as LaTeX or ConTeXt. It includes a&lt;br /&gt;
couple of example formatting commands (\Emph and \Bold), titles&lt;br /&gt;
(\Title), the ability to include other subsidiary text files (\Input)&lt;br /&gt;
and footnotes (\Footnote). It can be easily adapted and expanded to&lt;br /&gt;
suit your needs.&lt;br /&gt;
&lt;br /&gt;
I am not much of a programmer, and knew little about TeX and even less&lt;br /&gt;
about Lua when I started this, so there is undoubtedly much that can&lt;br /&gt;
be improved.  All questions, comments, suggestions, and corrections&lt;br /&gt;
will be appreciated. You can reach me at &amp;quot;destiny6 &amp;lt;AT&amp;gt; mac &amp;lt;DOT&amp;gt;&lt;br /&gt;
com&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Pre-requisites ==&lt;br /&gt;
&lt;br /&gt;
This system requires the luatex-plain format (from ConTeXt), so that&lt;br /&gt;
we have access to Open Type Fonts and other goodies. This is what I&lt;br /&gt;
did on my system:&lt;br /&gt;
&lt;br /&gt;
# Find the luatex-plain.tex file. On my system (with TeX-Live 2020)&lt;br /&gt;
it was at:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;pre&amp;gt;&lt;br /&gt;
  /usr/local/share/texmf-dist/tex/generic/context/luatex/luatex-plain.tex&lt;br /&gt;
  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# If you just build a format file,&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;pre&amp;gt;&lt;br /&gt;
  luatex --ini /usr/local/share/texmf-dist/tex/generic/context/luatex/luatex-plain.tex&lt;br /&gt;
  &amp;lt;/pre&amp;gt; &lt;br /&gt;
  &lt;br /&gt;
  you will probably get warnings about using the &amp;quot;merged&amp;quot; file, and not&lt;br /&gt;
  the more current and supported files. Delete, move, or rename this&lt;br /&gt;
  file. On my system I did:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;pre&amp;gt;&lt;br /&gt;
  doas mv /usr/local/share/texmf-dist/tex/generic/context/luatex/luatex-fonts-merged.lua /usr/local/share/texmf-dist/tex/generic/context/luatex/luatex-fonts-merged.lua.bak&lt;br /&gt;
  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Now, build the format file.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;pre&amp;gt;&lt;br /&gt;
  luatex --ini /usr/local/share/texmf-dist/tex/generic/context/luatex/luatex-plain.tex&lt;br /&gt;
  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# We are almost done. If the resulting format file (luatex-plain.fmt)&lt;br /&gt;
is in the current working directory, you can use it with something&lt;br /&gt;
like:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;pre&amp;gt;&lt;br /&gt;
  luatex --fmt luatex-plain test&lt;br /&gt;
  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# But, this is too restrictive.&lt;br /&gt;
&lt;br /&gt;
  ## Create a new executable with the name luatex-plain. Something&lt;br /&gt;
  like:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;pre&amp;gt;&lt;br /&gt;
    ln -s `which luatex` /usr/local/bin/luatex-plain&lt;br /&gt;
    &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  ## When you try to invoke it:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;pre&amp;gt;&lt;br /&gt;
    luatex-plain test&lt;br /&gt;
    &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
  it will fail with a message about failing to find the proper&lt;br /&gt;
  format file. There should be a line something like:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;pre&amp;gt;&lt;br /&gt;
    mktexfmt [INFO]: writing formats under ~/.texlive2020/texmf-var/web2c&lt;br /&gt;
    &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
  so, copy the format file to that location:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;pre&amp;gt;&lt;br /&gt;
    cp luatex-plain.fmt ~/.texlive2020/texmf-var/web2c/&lt;br /&gt;
    &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
  now, this should work:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;pre&amp;gt;&lt;br /&gt;
    luatex-plain test&lt;br /&gt;
    &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
    Finally, run mtxrun to generate a fonts database: &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;pre&amp;gt;&lt;br /&gt;
    mtxrun --script fonts --reload --simple&lt;br /&gt;
    &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Contents ==&lt;br /&gt;
&lt;br /&gt;
This files for this project are also available at:&lt;br /&gt;
[https://github.com/s-dismas/TeX-without-TeX-revised GitHub]&lt;br /&gt;
&lt;br /&gt;
There is a Read Eval Print Loop available for interactively exploring:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:repl.lua|repl.lua]]&lt;br /&gt;
&lt;br /&gt;
It can be invoked with &amp;lt;code&amp;gt;repl.repl()&amp;lt;code/&amp;gt;, and either&lt;br /&gt;
&amp;lt;code&amp;gt;quit()&amp;lt;code/&amp;gt; or &amp;lt;code&amp;gt;exit&amp;lt;code/&amp;gt; will exit it. I use Shell Mode in&lt;br /&gt;
Emacs, but a simple terminal or similar should also work.&lt;br /&gt;
&lt;br /&gt;
Some utilites are in the file:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:utils.lua|utils.lua]]&lt;br /&gt;
&lt;br /&gt;
The following five files comprise the system:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:reader.lua|reader.lua]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:format.lua|format.lua]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:main.lua|main.lua]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:pages.lua|pages.lua]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:commands.lua|commands.lua]]&lt;br /&gt;
&lt;br /&gt;
The license for this software can be seen at:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:LICENSE.txt| License.]]&lt;br /&gt;
&lt;br /&gt;
The TeX file to be compiled by luatex-plain is:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:test.tex|test.tex]]&lt;br /&gt;
&lt;br /&gt;
The Lua file executed by &amp;lt;code&amp;gt;\directlua{dofile &amp;quot;test.lua&amp;quot;}&amp;lt;/code&amp;gt;&lt;br /&gt;
within [[T_wo_T_r:test.tex|test.tex]] is:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:test.lua|test.lua]]&lt;br /&gt;
&lt;br /&gt;
The main text file to be typeset is:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:text.tex|text.tex]]&lt;br /&gt;
&lt;br /&gt;
It includes the following five files:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:chapter-1.tex|chapter 1]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:chapter-2.tex|chapter 2]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:chapter-3.tex|chapter 3]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:chapter-4.tex|chapter 4]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:chapter-5.tex|chapter 5]]&lt;/div&gt;</summary>
		<author><name>Rkrug</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.luatex.org/index.php?title=T_wo_T_r:chapter-5.tex&amp;diff=3573</id>
		<title>T wo T r:chapter-5.tex</title>
		<link rel="alternate" type="text/html" href="https://wiki.luatex.org/index.php?title=T_wo_T_r:chapter-5.tex&amp;diff=3573"/>
		<updated>2021-02-22T18:41:44Z</updated>

		<summary type="html">&lt;p&gt;Rkrug: Created page with &amp;quot; &amp;lt;nowiki&amp;gt; \Title[Chapter 5]{Chapter V. Elders}  Some of my readers may imagine that my young man was a sickly, ecstatic, poorly developed creature, a pale, consumptive dreamer...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &amp;lt;nowiki&amp;gt;&lt;br /&gt;
\Title[Chapter 5]{Chapter V. Elders}&lt;br /&gt;
&lt;br /&gt;
Some of my readers may imagine that my young man was a sickly, ecstatic,&lt;br /&gt;
poorly developed creature, a pale, consumptive dreamer. On the contrary,&lt;br /&gt;
Alyosha was at this time a well‐grown, red‐cheeked, clear‐eyed lad of&lt;br /&gt;
nineteen, radiant with health. He was very handsome, too, graceful,&lt;br /&gt;
moderately tall, with hair of a dark brown, with a regular, rather long,&lt;br /&gt;
oval‐shaped face, and wide‐set dark gray, shining eyes; he was very&lt;br /&gt;
thoughtful, and apparently very serene. I shall be told, perhaps, that red&lt;br /&gt;
cheeks are not incompatible with fanaticism and mysticism; but I fancy&lt;br /&gt;
that Alyosha was more of a realist than any one. Oh! no doubt, in the&lt;br /&gt;
monastery he fully believed in miracles, but, to my thinking, miracles are&lt;br /&gt;
never a stumbling‐block to the realist. It is not miracles that dispose&lt;br /&gt;
realists to belief. The genuine realist, if he is an unbeliever, will&lt;br /&gt;
always find strength and ability to disbelieve in the miraculous, and if&lt;br /&gt;
he is confronted with a miracle as an irrefutable fact he would rather&lt;br /&gt;
disbelieve his own senses than admit the fact. Even if he admits it, he&lt;br /&gt;
admits it as a fact of nature till then unrecognized by him. Faith does&lt;br /&gt;
not, in the realist, spring from the miracle but the miracle from faith.&lt;br /&gt;
If the realist once believes, then he is bound by his very realism to&lt;br /&gt;
admit the miraculous also. The Apostle Thomas said that he would not&lt;br /&gt;
believe till he saw, but when he did see he said, “My Lord and my God!”&lt;br /&gt;
Was it the miracle forced him to believe? Most likely not, but he believed&lt;br /&gt;
solely because he desired to believe and possibly he fully believed in his&lt;br /&gt;
secret heart even when he said, “I do not believe till I see.”&lt;br /&gt;
&lt;br /&gt;
I shall be told, perhaps, that Alyosha was stupid, undeveloped, had not&lt;br /&gt;
finished his studies, and so on. That he did not finish his studies is&lt;br /&gt;
true, but to say that he was stupid or dull would be a great injustice.&lt;br /&gt;
I’ll simply repeat what I have said above. He entered upon this path only&lt;br /&gt;
because, at that time, it alone struck his imagination and presented&lt;br /&gt;
itself to him as offering an ideal means of escape for his soul from&lt;br /&gt;
darkness to light. Add to that that he was to some extent a youth of our&lt;br /&gt;
last epoch—that is, honest in nature, desiring the truth, seeking for it&lt;br /&gt;
and believing in it, and seeking to serve it at once with all the strength&lt;br /&gt;
of his soul, seeking for immediate action, and ready to sacrifice&lt;br /&gt;
everything, life itself, for it. Though these young men unhappily fail to&lt;br /&gt;
understand that the sacrifice of life is, in many cases, the easiest of&lt;br /&gt;
all sacrifices, and that to sacrifice, for instance, five or six years of&lt;br /&gt;
their seething youth to hard and tedious study, if only to multiply&lt;br /&gt;
tenfold their powers of serving the truth and the cause they have set&lt;br /&gt;
before them as their goal—such a sacrifice is utterly beyond the strength&lt;br /&gt;
of many of them. The path Alyosha chose was a path going in the opposite&lt;br /&gt;
direction, but he chose it with the same thirst for swift achievement. As&lt;br /&gt;
soon as he reflected seriously he was convinced of the existence of God&lt;br /&gt;
and immortality, and at once he instinctively said to himself: “I want to&lt;br /&gt;
live for immortality, and I will accept no compromise.” In the same way,&lt;br /&gt;
if he had decided that God and immortality did not exist, he would at once&lt;br /&gt;
have become an atheist and a socialist. For socialism is not merely the&lt;br /&gt;
labor question, it is before all things the atheistic question, the&lt;br /&gt;
question of the form taken by atheism to‐day, the question of the tower of&lt;br /&gt;
Babel built without God, not to mount to heaven from earth but to set up&lt;br /&gt;
heaven on earth. Alyosha would have found it strange and impossible to go&lt;br /&gt;
on living as before. It is written: “Give all that thou hast to the poor&lt;br /&gt;
and follow Me, if thou wouldst be perfect.”&lt;br /&gt;
&lt;br /&gt;
Alyosha said to himself: “I can’t give two roubles instead of ‘all,’ and&lt;br /&gt;
only go to mass instead of ‘following Him.’ ” Perhaps his memories of&lt;br /&gt;
childhood brought back our monastery, to which his mother may have taken&lt;br /&gt;
him to mass. Perhaps the slanting sunlight and the holy image to which his&lt;br /&gt;
poor “crazy” mother had held him up still acted upon his imagination.&lt;br /&gt;
Brooding on these things he may have come to us perhaps only to see&lt;br /&gt;
whether here he could sacrifice all or only “two roubles,” and in the&lt;br /&gt;
monastery he met this elder. I must digress to explain what an “elder” is&lt;br /&gt;
in Russian monasteries, and I am sorry that I do not feel very competent&lt;br /&gt;
to do so. I will try, however, to give a superficial account of it in a&lt;br /&gt;
few words. Authorities on the subject assert that the institution of&lt;br /&gt;
“elders” is of recent date, not more than a hundred years old in our&lt;br /&gt;
monasteries, though in the orthodox East, especially in Sinai and Athos,&lt;br /&gt;
it has existed over a thousand years. It is maintained that it existed in&lt;br /&gt;
ancient times in Russia also, but through the calamities which overtook&lt;br /&gt;
Russia—the Tartars, civil war, the interruption of relations with the East&lt;br /&gt;
after the destruction of Constantinople—this institution fell into&lt;br /&gt;
oblivion. It was revived among us towards the end of last century by one&lt;br /&gt;
of the great “ascetics,” as they called him, Païssy Velitchkovsky, and his&lt;br /&gt;
disciples. But to this day it exists in few monasteries only, and has&lt;br /&gt;
sometimes been almost persecuted as an innovation in Russia. It flourished&lt;br /&gt;
especially in the celebrated Kozelski Optin Monastery. When and how it was&lt;br /&gt;
introduced into our monastery I cannot say. There had already been three&lt;br /&gt;
such elders and Zossima was the last of them. But he was almost dying of&lt;br /&gt;
weakness and disease, and they had no one to take his place. The question&lt;br /&gt;
for our monastery was an important one, for it had not been distinguished&lt;br /&gt;
by anything in particular till then: they had neither relics of saints,&lt;br /&gt;
nor wonder‐working ikons, nor glorious traditions, nor historical&lt;br /&gt;
exploits. It had flourished and been glorious all over Russia through its&lt;br /&gt;
elders, to see and hear whom pilgrims had flocked for thousands of miles&lt;br /&gt;
from all parts.&lt;br /&gt;
&lt;br /&gt;
What was such an elder? An elder was one who took your soul, your will,&lt;br /&gt;
into his soul and his will. When you choose an elder, you renounce your&lt;br /&gt;
own will and yield it to him in complete submission, complete self‐&lt;br /&gt;
abnegation. This novitiate, this terrible school of abnegation, is&lt;br /&gt;
undertaken voluntarily, in the hope of self‐conquest, of self‐mastery, in&lt;br /&gt;
order, after a life of obedience, to attain perfect freedom, that is, from&lt;br /&gt;
self; to escape the lot of those who have lived their whole life without&lt;br /&gt;
finding their true selves in themselves. This institution of elders is not&lt;br /&gt;
founded on theory, but was established in the East from the practice of a&lt;br /&gt;
thousand years. The obligations due to an elder are not the ordinary&lt;br /&gt;
“obedience” which has always existed in our Russian monasteries. The&lt;br /&gt;
obligation involves confession to the elder by all who have submitted&lt;br /&gt;
themselves to him, and to the indissoluble bond between him and them.&lt;br /&gt;
&lt;br /&gt;
The story is told, for instance, that in the early days of Christianity&lt;br /&gt;
one such novice, failing to fulfill some command laid upon him by his&lt;br /&gt;
elder, left his monastery in Syria and went to Egypt. There, after great&lt;br /&gt;
exploits, he was found worthy at last to suffer torture and a martyr’s&lt;br /&gt;
death for the faith. When the Church, regarding him as a saint, was&lt;br /&gt;
burying him, suddenly, at the deacon’s exhortation, “Depart all ye&lt;br /&gt;
unbaptized,” the coffin containing the martyr’s body left its place and&lt;br /&gt;
was cast forth from the church, and this took place three times. And only&lt;br /&gt;
at last they learnt that this holy man had broken his vow of obedience and&lt;br /&gt;
left his elder, and, therefore, could not be forgiven without the elder’s&lt;br /&gt;
absolution in spite of his great deeds. Only after this could the funeral&lt;br /&gt;
take place. This, of course, is only an old legend. But here is a recent&lt;br /&gt;
instance.&lt;br /&gt;
&lt;br /&gt;
A monk was suddenly commanded by his elder to quit Athos, which he loved&lt;br /&gt;
as a sacred place and a haven of refuge, and to go first to Jerusalem to&lt;br /&gt;
do homage to the Holy Places and then to go to the north to Siberia:&lt;br /&gt;
“There is the place for thee and not here.” The monk, overwhelmed with&lt;br /&gt;
sorrow, went to the Œcumenical Patriarch at Constantinople and besought&lt;br /&gt;
him to release him from his obedience. But the Patriarch replied that not&lt;br /&gt;
only was he unable to release him, but there was not and could not be on&lt;br /&gt;
earth a power which could release him except the elder who had himself&lt;br /&gt;
laid that duty upon him. In this way the elders are endowed in certain&lt;br /&gt;
cases with unbounded and inexplicable authority. That is why in many of&lt;br /&gt;
our monasteries the institution was at first resisted almost to&lt;br /&gt;
persecution. Meantime the elders immediately began to be highly esteemed&lt;br /&gt;
among the people. Masses of the ignorant people as well as men of&lt;br /&gt;
distinction flocked, for instance, to the elders of our monastery to&lt;br /&gt;
confess their doubts, their sins, and their sufferings, and ask for&lt;br /&gt;
counsel and admonition. Seeing this, the opponents of the elders declared&lt;br /&gt;
that the sacrament of confession was being arbitrarily and frivolously&lt;br /&gt;
degraded, though the continual opening of the heart to the elder by the&lt;br /&gt;
monk or the layman had nothing of the character of the sacrament. In the&lt;br /&gt;
end, however, the institution of elders has been retained and is becoming&lt;br /&gt;
established in Russian monasteries. It is true, perhaps, that this&lt;br /&gt;
instrument which had stood the test of a thousand years for the moral&lt;br /&gt;
regeneration of a man from slavery to freedom and to moral perfectibility&lt;br /&gt;
may be a two‐edged weapon and it may lead some not to humility and&lt;br /&gt;
complete self‐control but to the most Satanic pride, that is, to bondage&lt;br /&gt;
and not to freedom.&lt;br /&gt;
&lt;br /&gt;
The elder Zossima was sixty‐five. He came of a family of landowners, had&lt;br /&gt;
been in the army in early youth, and served in the Caucasus as an officer.&lt;br /&gt;
He had, no doubt, impressed Alyosha by some peculiar quality of his soul.&lt;br /&gt;
Alyosha lived in the cell of the elder, who was very fond of him and let&lt;br /&gt;
him wait upon him. It must be noted that Alyosha was bound by no&lt;br /&gt;
obligation and could go where he pleased and be absent for whole days.&lt;br /&gt;
Though he wore the monastic dress it was voluntarily, not to be different&lt;br /&gt;
from others. No doubt he liked to do so. Possibly his youthful imagination&lt;br /&gt;
was deeply stirred by the power and fame of his elder. It was said that so&lt;br /&gt;
many people had for years past come to confess their sins to Father&lt;br /&gt;
Zossima and to entreat him for words of advice and healing, that he had&lt;br /&gt;
acquired the keenest intuition and could tell from an unknown face what a&lt;br /&gt;
new‐comer wanted, and what was the suffering on his conscience. He&lt;br /&gt;
sometimes astounded and almost alarmed his visitors by his knowledge of&lt;br /&gt;
their secrets before they had spoken a word.&lt;br /&gt;
&lt;br /&gt;
Alyosha noticed that many, almost all, went in to the elder for the first&lt;br /&gt;
time with apprehension and uneasiness, but came out with bright and happy&lt;br /&gt;
faces. Alyosha was particularly struck by the fact that Father Zossima was&lt;br /&gt;
not at all stern. On the contrary, he was always almost gay. The monks&lt;br /&gt;
used to say that he was more drawn to those who were more sinful, and the&lt;br /&gt;
greater the sinner the more he loved him. There were, no doubt, up to the&lt;br /&gt;
end of his life, among the monks some who hated and envied him, but they&lt;br /&gt;
were few in number and they were silent, though among them were some of&lt;br /&gt;
great dignity in the monastery, one, for instance, of the older monks&lt;br /&gt;
distinguished for his strict keeping of fasts and vows of silence. But the&lt;br /&gt;
majority were on Father Zossima’s side and very many of them loved him&lt;br /&gt;
with all their hearts, warmly and sincerely. Some were almost fanatically&lt;br /&gt;
devoted to him, and declared, though not quite aloud, that he was a saint,&lt;br /&gt;
that there could be no doubt of it, and, seeing that his end was near,&lt;br /&gt;
they anticipated miracles and great glory to the monastery in the&lt;br /&gt;
immediate future from his relics. Alyosha had unquestioning faith in the&lt;br /&gt;
miraculous power of the elder, just as he had unquestioning faith in the&lt;br /&gt;
story of the coffin that flew out of the church. He saw many who came with&lt;br /&gt;
sick children or relatives and besought the elder to lay hands on them and&lt;br /&gt;
to pray over them, return shortly after—some the next day—and, falling in&lt;br /&gt;
tears at the elder’s feet, thank him for healing their sick.&lt;br /&gt;
&lt;br /&gt;
Whether they had really been healed or were simply better in the natural&lt;br /&gt;
course of the disease was a question which did not exist for Alyosha, for&lt;br /&gt;
he fully believed in the spiritual power of his teacher and rejoiced in&lt;br /&gt;
his fame, in his glory, as though it were his own triumph. His heart&lt;br /&gt;
throbbed, and he beamed, as it were, all over when the elder came out to&lt;br /&gt;
the gates of the hermitage into the waiting crowd of pilgrims of the&lt;br /&gt;
humbler class who had flocked from all parts of Russia on purpose to see&lt;br /&gt;
the elder and obtain his blessing. They fell down before him, wept, kissed&lt;br /&gt;
his feet, kissed the earth on which he stood, and wailed, while the women&lt;br /&gt;
held up their children to him and brought him the sick “possessed with&lt;br /&gt;
devils.” The elder spoke to them, read a brief prayer over them, blessed&lt;br /&gt;
them, and dismissed them. Of late he had become so weak through attacks of&lt;br /&gt;
illness that he was sometimes unable to leave his cell, and the pilgrims&lt;br /&gt;
waited for him to come out for several days. Alyosha did not wonder why&lt;br /&gt;
they loved him so, why they fell down before him and wept with emotion&lt;br /&gt;
merely at seeing his face. Oh! he understood that for the humble soul of&lt;br /&gt;
the Russian peasant, worn out by grief and toil, and still more by the&lt;br /&gt;
everlasting injustice and everlasting sin, his own and the world’s, it was&lt;br /&gt;
the greatest need and comfort to find some one or something holy to fall&lt;br /&gt;
down before and worship.&lt;br /&gt;
&lt;br /&gt;
“Among us there is sin, injustice, and temptation, but yet, somewhere on&lt;br /&gt;
earth there is some one holy and exalted. He has the truth; he knows the&lt;br /&gt;
truth; so it is not dead upon the earth; so it will come one day to us,&lt;br /&gt;
too, and rule over all the earth according to the promise.”&lt;br /&gt;
&lt;br /&gt;
Alyosha knew that this was just how the people felt and even reasoned. He&lt;br /&gt;
understood it, but that the elder Zossima was this saint and custodian of&lt;br /&gt;
God’s truth—of that he had no more doubt than the weeping peasants and the&lt;br /&gt;
sick women who held out their children to the elder. The conviction that&lt;br /&gt;
after his death the elder would bring extraordinary glory to the monastery&lt;br /&gt;
was even stronger in Alyosha than in any one there, and, of late, a kind&lt;br /&gt;
of deep flame of inner ecstasy burnt more and more strongly in his heart.&lt;br /&gt;
He was not at all troubled at this elder’s standing as a solitary example&lt;br /&gt;
before him.&lt;br /&gt;
&lt;br /&gt;
“No matter. He is holy. He carries in his heart the secret of renewal for&lt;br /&gt;
all: that power which will, at last, establish truth on the earth, and all&lt;br /&gt;
men will be holy and love one another, and there will be no more rich nor&lt;br /&gt;
poor, no exalted nor humbled, but all will be as the children of God, and&lt;br /&gt;
the true Kingdom of Christ will come.” That was the dream in Alyosha’s&lt;br /&gt;
heart.&lt;br /&gt;
&lt;br /&gt;
The arrival of his two brothers, whom he had not known till then, seemed&lt;br /&gt;
to make a great impression on Alyosha. He more quickly made friends with&lt;br /&gt;
his half‐brother Dmitri (though he arrived later) than with his own&lt;br /&gt;
brother Ivan. He was extremely interested in his brother Ivan, but when&lt;br /&gt;
the latter had been two months in the town, though they had met fairly&lt;br /&gt;
often, they were still not intimate. Alyosha was naturally silent, and he&lt;br /&gt;
seemed to be expecting something, ashamed about something, while his&lt;br /&gt;
brother Ivan, though Alyosha noticed at first that he looked long and&lt;br /&gt;
curiously at him, seemed soon to have left off thinking of him. Alyosha&lt;br /&gt;
noticed it with some embarrassment. He ascribed his brother’s indifference&lt;br /&gt;
at first to the disparity of their age and education. But he also wondered&lt;br /&gt;
whether the absence of curiosity and sympathy in Ivan might be due to some&lt;br /&gt;
other cause entirely unknown to him. He kept fancying that Ivan was&lt;br /&gt;
absorbed in something—something inward and important—that he was striving&lt;br /&gt;
towards some goal, perhaps very hard to attain, and that that was why he&lt;br /&gt;
had no thought for him. Alyosha wondered, too, whether there was not some&lt;br /&gt;
contempt on the part of the learned atheist for him—a foolish novice. He&lt;br /&gt;
knew for certain that his brother was an atheist. He could not take&lt;br /&gt;
offense at this contempt, if it existed; yet, with an uneasy embarrassment&lt;br /&gt;
which he did not himself understand, he waited for his brother to come&lt;br /&gt;
nearer to him. Dmitri used to speak of Ivan with the deepest respect and&lt;br /&gt;
with a peculiar earnestness. From him Alyosha learnt all the details of&lt;br /&gt;
the important affair which had of late formed such a close and remarkable&lt;br /&gt;
bond between the two elder brothers. Dmitri’s enthusiastic references to&lt;br /&gt;
Ivan were the more striking in Alyosha’s eyes since Dmitri was, compared&lt;br /&gt;
with Ivan, almost uneducated, and the two brothers were such a contrast in&lt;br /&gt;
personality and character that it would be difficult to find two men more&lt;br /&gt;
unlike.&lt;br /&gt;
&lt;br /&gt;
It was at this time that the meeting, or, rather gathering of the members&lt;br /&gt;
of this inharmonious family took place in the cell of the elder who had&lt;br /&gt;
such an extraordinary influence on Alyosha. The pretext for this gathering&lt;br /&gt;
was a false one. It was at this time that the discord between Dmitri and&lt;br /&gt;
his father seemed at its acutest stage and their relations had become&lt;br /&gt;
insufferably strained. Fyodor Pavlovitch seems to have been the first to&lt;br /&gt;
suggest, apparently in joke, that they should all meet in Father Zossima’s&lt;br /&gt;
cell, and that, without appealing to his direct intervention, they might&lt;br /&gt;
more decently come to an understanding under the conciliating influence of&lt;br /&gt;
the elder’s presence. Dmitri, who had never seen the elder, naturally&lt;br /&gt;
supposed that his father was trying to intimidate him, but, as he secretly&lt;br /&gt;
blamed himself for his outbursts of temper with his father on several&lt;br /&gt;
recent occasions, he accepted the challenge. It must be noted that he was&lt;br /&gt;
not, like Ivan, staying with his father, but living apart at the other end&lt;br /&gt;
of the town. It happened that Pyotr Alexandrovitch Miüsov, who was staying&lt;br /&gt;
in the district at the time, caught eagerly at the idea. A Liberal of the&lt;br /&gt;
forties and fifties, a freethinker and atheist, he may have been led on by&lt;br /&gt;
boredom or the hope of frivolous diversion. He was suddenly seized with&lt;br /&gt;
the desire to see the monastery and the holy man. As his lawsuit with the&lt;br /&gt;
monastery still dragged on, he made it the pretext for seeing the&lt;br /&gt;
Superior, in order to attempt to settle it amicably. A visitor coming with&lt;br /&gt;
such laudable intentions might be received with more attention and&lt;br /&gt;
consideration than if he came from simple curiosity. Influences from&lt;br /&gt;
within the monastery were brought to bear on the elder, who of late had&lt;br /&gt;
scarcely left his cell, and had been forced by illness to deny even his&lt;br /&gt;
ordinary visitors. In the end he consented to see them, and the day was&lt;br /&gt;
fixed.&lt;br /&gt;
&lt;br /&gt;
“Who has made me a judge over them?” was all he said, smilingly, to&lt;br /&gt;
Alyosha.&lt;br /&gt;
&lt;br /&gt;
Alyosha was much perturbed when he heard of the proposed visit. Of all the&lt;br /&gt;
wrangling, quarrelsome party, Dmitri was the only one who could regard the&lt;br /&gt;
interview seriously. All the others would come from frivolous motives,&lt;br /&gt;
perhaps insulting to the elder. Alyosha was well aware of that. Ivan and&lt;br /&gt;
Miüsov would come from curiosity, perhaps of the coarsest kind, while his&lt;br /&gt;
father might be contemplating some piece of buffoonery. Though he said&lt;br /&gt;
nothing, Alyosha thoroughly understood his father. The boy, I repeat, was&lt;br /&gt;
far from being so simple as every one thought him. He awaited the day with&lt;br /&gt;
a heavy heart. No doubt he was always pondering in his mind how the family&lt;br /&gt;
discord could be ended. But his chief anxiety concerned the elder. He&lt;br /&gt;
trembled for him, for his glory, and dreaded any affront to him,&lt;br /&gt;
especially the refined, courteous irony of Miüsov and the supercilious&lt;br /&gt;
half‐utterances of the highly educated Ivan. He even wanted to venture on&lt;br /&gt;
warning the elder, telling him something about them, but, on second&lt;br /&gt;
thoughts, said nothing. He only sent word the day before, through a&lt;br /&gt;
friend, to his brother Dmitri, that he loved him and expected him to keep&lt;br /&gt;
his promise. Dmitri wondered, for he could not remember what he had&lt;br /&gt;
promised, but he answered by letter that he would do his utmost not to let&lt;br /&gt;
himself be provoked “by vileness,” but that, although he had a deep&lt;br /&gt;
respect for the elder and for his brother Ivan, he was convinced that the&lt;br /&gt;
meeting was either a trap for him or an unworthy farce.&lt;br /&gt;
&lt;br /&gt;
“Nevertheless I would rather bite out my tongue than be lacking in respect&lt;br /&gt;
to the sainted man whom you reverence so highly,” he wrote in conclusion.&lt;br /&gt;
Alyosha was not greatly cheered by the letter.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rkrug</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.luatex.org/index.php?title=T_wo_T_r:chapter-4.tex&amp;diff=3572</id>
		<title>T wo T r:chapter-4.tex</title>
		<link rel="alternate" type="text/html" href="https://wiki.luatex.org/index.php?title=T_wo_T_r:chapter-4.tex&amp;diff=3572"/>
		<updated>2021-02-22T18:41:12Z</updated>

		<summary type="html">&lt;p&gt;Rkrug: Created page with &amp;quot; &amp;lt;nowiki&amp;gt; \Title[Chapter 4]{Chapter IV. The Third Son, Alyosha}  He was only twenty, his brother Ivan was in his twenty‐fourth year at the time, while their elder brother Dm...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &amp;lt;nowiki&amp;gt;&lt;br /&gt;
\Title[Chapter 4]{Chapter IV. The Third Son, Alyosha}&lt;br /&gt;
&lt;br /&gt;
He was only twenty, his brother Ivan was in his twenty‐fourth year at the&lt;br /&gt;
time, while their elder brother Dmitri was twenty‐seven. First of all, I&lt;br /&gt;
must explain that this young man, Alyosha, was not a fanatic, and, in my&lt;br /&gt;
opinion at least, was not even a mystic. I may as well give my full&lt;br /&gt;
opinion from the beginning. He was simply an early lover of humanity, and&lt;br /&gt;
that he adopted the monastic life was simply because at that time it&lt;br /&gt;
struck him, so to say, as the ideal escape for his soul struggling from&lt;br /&gt;
the darkness of worldly wickedness to the light of love. And the reason&lt;br /&gt;
this life struck him in this way was that he found in it at that time, as&lt;br /&gt;
he thought, an extraordinary being, our celebrated elder, Zossima, to whom&lt;br /&gt;
he became attached with all the warm first love of his ardent heart. But I&lt;br /&gt;
do not dispute that he was very strange even at that time, and had been so&lt;br /&gt;
indeed from his cradle. I have mentioned already, by the way, that though&lt;br /&gt;
he lost his mother in his fourth year he remembered her all his life—her&lt;br /&gt;
face, her caresses, “as though she stood living before me.” Such memories&lt;br /&gt;
may persist, as every one knows, from an even earlier age, even from two&lt;br /&gt;
years old, but scarcely standing out through a whole lifetime like spots&lt;br /&gt;
of light out of darkness, like a corner torn out of a huge picture, which&lt;br /&gt;
has all faded and disappeared except that fragment. That is how it was&lt;br /&gt;
with him. He remembered one still summer evening, an open window, the&lt;br /&gt;
slanting rays of the setting sun (that he recalled most vividly of all);&lt;br /&gt;
in a corner of the room the holy image, before it a lighted lamp, and on&lt;br /&gt;
her knees before the image his mother, sobbing hysterically with cries and&lt;br /&gt;
moans, snatching him up in both arms, squeezing him close till it hurt,&lt;br /&gt;
and praying for him to the Mother of God, holding him out in both arms to&lt;br /&gt;
the image as though to put him under the Mother’s protection ... and&lt;br /&gt;
suddenly a nurse runs in and snatches him from her in terror. That was the&lt;br /&gt;
picture! And Alyosha remembered his mother’s face at that minute. He used&lt;br /&gt;
to say that it was frenzied but beautiful as he remembered. But he rarely&lt;br /&gt;
cared to speak of this memory to any one. In his childhood and youth he&lt;br /&gt;
was by no means expansive, and talked little indeed, but not from shyness&lt;br /&gt;
or a sullen unsociability; quite the contrary, from something different,&lt;br /&gt;
from a sort of inner preoccupation entirely personal and unconcerned with&lt;br /&gt;
other people, but so important to him that he seemed, as it were, to&lt;br /&gt;
forget others on account of it. But he was fond of people: he seemed&lt;br /&gt;
throughout his life to put implicit trust in people: yet no one ever&lt;br /&gt;
looked on him as a simpleton or naïve person. There was something about&lt;br /&gt;
him which made one feel at once (and it was so all his life afterwards)&lt;br /&gt;
that he did not care to be a judge of others—that he would never take it&lt;br /&gt;
upon himself to criticize and would never condemn any one for anything. He&lt;br /&gt;
seemed, indeed, to accept everything without the least condemnation though&lt;br /&gt;
often grieving bitterly: and this was so much so that no one could&lt;br /&gt;
surprise or frighten him even in his earliest youth. Coming at twenty to&lt;br /&gt;
his father’s house, which was a very sink of filthy debauchery, he, chaste&lt;br /&gt;
and pure as he was, simply withdrew in silence when to look on was&lt;br /&gt;
unbearable, but without the slightest sign of contempt or condemnation.&lt;br /&gt;
His father, who had once been in a dependent position, and so was&lt;br /&gt;
sensitive and ready to take offense, met him at first with distrust and&lt;br /&gt;
sullenness. “He does not say much,” he used to say, “and thinks the more.”&lt;br /&gt;
But soon, within a fortnight indeed, he took to embracing him and kissing&lt;br /&gt;
him terribly often, with drunken tears, with sottish sentimentality, yet&lt;br /&gt;
he evidently felt a real and deep affection for him, such as he had never&lt;br /&gt;
been capable of feeling for any one before.&lt;br /&gt;
&lt;br /&gt;
Every one, indeed, loved this young man wherever he went, and it was so&lt;br /&gt;
from his earliest childhood. When he entered the household of his patron&lt;br /&gt;
and benefactor, Yefim Petrovitch Polenov, he gained the hearts of all the&lt;br /&gt;
family, so that they looked on him quite as their own child. Yet he&lt;br /&gt;
entered the house at such a tender age that he could not have acted from&lt;br /&gt;
design nor artfulness in winning affection. So that the gift of making&lt;br /&gt;
himself loved directly and unconsciously was inherent in him, in his very&lt;br /&gt;
nature, so to speak. It was the same at school, though he seemed to be&lt;br /&gt;
just one of those children who are distrusted, sometimes ridiculed, and&lt;br /&gt;
even disliked by their schoolfellows. He was dreamy, for instance, and&lt;br /&gt;
rather solitary. From his earliest childhood he was fond of creeping into&lt;br /&gt;
a corner to read, and yet he was a general favorite all the while he was&lt;br /&gt;
at school. He was rarely playful or merry, but any one could see at the&lt;br /&gt;
first glance that this was not from any sullenness. On the contrary he was&lt;br /&gt;
bright and good‐tempered. He never tried to show off among his&lt;br /&gt;
schoolfellows. Perhaps because of this, he was never afraid of any one,&lt;br /&gt;
yet the boys immediately understood that he was not proud of his&lt;br /&gt;
fearlessness and seemed to be unaware that he was bold and courageous. He&lt;br /&gt;
never resented an insult. It would happen that an hour after the offense&lt;br /&gt;
he would address the offender or answer some question with as trustful and&lt;br /&gt;
candid an expression as though nothing had happened between them. And it&lt;br /&gt;
was not that he seemed to have forgotten or intentionally forgiven the&lt;br /&gt;
affront, but simply that he did not regard it as an affront, and this&lt;br /&gt;
completely conquered and captivated the boys. He had one characteristic&lt;br /&gt;
which made all his schoolfellows from the bottom class to the top want to&lt;br /&gt;
mock at him, not from malice but because it amused them. This&lt;br /&gt;
characteristic was a wild fanatical modesty and chastity. He could not&lt;br /&gt;
bear to hear certain words and certain conversations about women. There&lt;br /&gt;
are “certain” words and conversations unhappily impossible to eradicate in&lt;br /&gt;
schools. Boys pure in mind and heart, almost children, are fond of talking&lt;br /&gt;
in school among themselves, and even aloud, of things, pictures, and&lt;br /&gt;
images of which even soldiers would sometimes hesitate to speak. More than&lt;br /&gt;
that, much that soldiers have no knowledge or conception of is familiar to&lt;br /&gt;
quite young children of our intellectual and higher classes. There is no&lt;br /&gt;
moral depravity, no real corrupt inner cynicism in it, but there is the&lt;br /&gt;
appearance of it, and it is often looked upon among them as something&lt;br /&gt;
refined, subtle, daring, and worthy of imitation. Seeing that Alyosha&lt;br /&gt;
Karamazov put his fingers in his ears when they talked of “that,” they&lt;br /&gt;
used sometimes to crowd round him, pull his hands away, and shout&lt;br /&gt;
nastiness into both ears, while he struggled, slipped to the floor, tried&lt;br /&gt;
to hide himself without uttering one word of abuse, enduring their insults&lt;br /&gt;
in silence. But at last they left him alone and gave up taunting him with&lt;br /&gt;
being a “regular girl,” and what’s more they looked upon it with&lt;br /&gt;
compassion as a weakness. He was always one of the best in the class but&lt;br /&gt;
was never first.&lt;br /&gt;
&lt;br /&gt;
At the time of Yefim Petrovitch’s death Alyosha had two more years to&lt;br /&gt;
complete at the provincial gymnasium. The inconsolable widow went almost&lt;br /&gt;
immediately after his death for a long visit to Italy with her whole&lt;br /&gt;
family, which consisted only of women and girls. Alyosha went to live in&lt;br /&gt;
the house of two distant relations of Yefim Petrovitch, ladies whom he had&lt;br /&gt;
never seen before. On what terms he lived with them he did not know&lt;br /&gt;
himself. It was very characteristic of him, indeed, that he never cared at&lt;br /&gt;
whose expense he was living. In that respect he was a striking contrast to&lt;br /&gt;
his elder brother Ivan, who struggled with poverty for his first two years&lt;br /&gt;
in the university, maintained himself by his own efforts, and had from&lt;br /&gt;
childhood been bitterly conscious of living at the expense of his&lt;br /&gt;
benefactor. But this strange trait in Alyosha’s character must not, I&lt;br /&gt;
think, be criticized too severely, for at the slightest acquaintance with&lt;br /&gt;
him any one would have perceived that Alyosha was one of those youths,&lt;br /&gt;
almost of the type of religious enthusiast, who, if they were suddenly to&lt;br /&gt;
come into possession of a large fortune, would not hesitate to give it&lt;br /&gt;
away for the asking, either for good works or perhaps to a clever rogue.&lt;br /&gt;
In general he seemed scarcely to know the value of money, not, of course,&lt;br /&gt;
in a literal sense. When he was given pocket‐money, which he never asked&lt;br /&gt;
for, he was either terribly careless of it so that it was gone in a&lt;br /&gt;
moment, or he kept it for weeks together, not knowing what to do with it.&lt;br /&gt;
&lt;br /&gt;
In later years Pyotr Alexandrovitch Miüsov, a man very sensitive on the&lt;br /&gt;
score of money and bourgeois honesty, pronounced the following judgment,&lt;br /&gt;
after getting to know Alyosha:&lt;br /&gt;
&lt;br /&gt;
“Here is perhaps the one man in the world whom you might leave alone&lt;br /&gt;
without a penny, in the center of an unknown town of a million&lt;br /&gt;
inhabitants, and he would not come to harm, he would not die of cold and&lt;br /&gt;
hunger, for he would be fed and sheltered at once; and if he were not, he&lt;br /&gt;
would find a shelter for himself, and it would cost him no effort or&lt;br /&gt;
humiliation. And to shelter him would be no burden, but, on the contrary,&lt;br /&gt;
would probably be looked on as a pleasure.”&lt;br /&gt;
&lt;br /&gt;
He did not finish his studies at the gymnasium. A year before the end of&lt;br /&gt;
the course he suddenly announced to the ladies that he was going to see&lt;br /&gt;
his father about a plan which had occurred to him. They were sorry and&lt;br /&gt;
unwilling to let him go. The journey was not an expensive one, and the&lt;br /&gt;
ladies would not let him pawn his watch, a parting present from his&lt;br /&gt;
benefactor’s family. They provided him liberally with money and even&lt;br /&gt;
fitted him out with new clothes and linen. But he returned half the money&lt;br /&gt;
they gave him, saying that he intended to go third class. On his arrival&lt;br /&gt;
in the town he made no answer to his father’s first inquiry why he had&lt;br /&gt;
come before completing his studies, and seemed, so they say, unusually&lt;br /&gt;
thoughtful. It soon became apparent that he was looking for his mother’s&lt;br /&gt;
tomb. He practically acknowledged at the time that that was the only&lt;br /&gt;
object of his visit. But it can hardly have been the whole reason of it.&lt;br /&gt;
It is more probable that he himself did not understand and could not&lt;br /&gt;
explain what had suddenly arisen in his soul, and drawn him irresistibly&lt;br /&gt;
into a new, unknown, but inevitable path. Fyodor Pavlovitch could not show&lt;br /&gt;
him where his second wife was buried, for he had never visited her grave&lt;br /&gt;
since he had thrown earth upon her coffin, and in the course of years had&lt;br /&gt;
entirely forgotten where she was buried.&lt;br /&gt;
&lt;br /&gt;
Fyodor Pavlovitch, by the way, had for some time previously not been&lt;br /&gt;
living in our town. Three or four years after his wife’s death he had gone&lt;br /&gt;
to the south of Russia and finally turned up in Odessa, where he spent&lt;br /&gt;
several years. He made the acquaintance at first, in his own words, “of a&lt;br /&gt;
lot of low Jews, Jewesses, and Jewkins,” and ended by being received by&lt;br /&gt;
“Jews high and low alike.” It may be presumed that at this period he&lt;br /&gt;
developed a peculiar faculty for making and hoarding money. He finally&lt;br /&gt;
returned to our town only three years before Alyosha’s arrival. His former&lt;br /&gt;
acquaintances found him looking terribly aged, although he was by no means&lt;br /&gt;
an old man. He behaved not exactly with more dignity but with more&lt;br /&gt;
effrontery. The former buffoon showed an insolent propensity for making&lt;br /&gt;
buffoons of others. His depravity with women was not simply what it used&lt;br /&gt;
to be, but even more revolting. In a short time he opened a great number&lt;br /&gt;
of new taverns in the district. It was evident that he had perhaps a&lt;br /&gt;
hundred thousand roubles or not much less. Many of the inhabitants of the&lt;br /&gt;
town and district were soon in his debt, and, of course, had given good&lt;br /&gt;
security. Of late, too, he looked somehow bloated and seemed more&lt;br /&gt;
irresponsible, more uneven, had sunk into a sort of incoherence, used to&lt;br /&gt;
begin one thing and go on with another, as though he were letting himself&lt;br /&gt;
go altogether. He was more and more frequently drunk. And, if it had not&lt;br /&gt;
been for the same servant Grigory, who by that time had aged considerably&lt;br /&gt;
too, and used to look after him sometimes almost like a tutor, Fyodor&lt;br /&gt;
Pavlovitch might have got into terrible scrapes. Alyosha’s arrival seemed&lt;br /&gt;
to affect even his moral side, as though something had awakened in this&lt;br /&gt;
prematurely old man which had long been dead in his soul.&lt;br /&gt;
&lt;br /&gt;
“Do you know,” he used often to say, looking at Alyosha, “that you are&lt;br /&gt;
like her, ‘the crazy woman’ ”—that was what he used to call his dead wife,&lt;br /&gt;
Alyosha’s mother. Grigory it was who pointed out the “crazy woman’s” grave&lt;br /&gt;
to Alyosha. He took him to our town cemetery and showed him in a remote&lt;br /&gt;
corner a cast‐iron tombstone, cheap but decently kept, on which were&lt;br /&gt;
inscribed the name and age of the deceased and the date of her death, and&lt;br /&gt;
below a four‐lined verse, such as are commonly used on old‐fashioned&lt;br /&gt;
middle‐class tombs. To Alyosha’s amazement this tomb turned out to be&lt;br /&gt;
Grigory’s doing. He had put it up on the poor “crazy woman’s” grave at his&lt;br /&gt;
own expense, after Fyodor Pavlovitch, whom he had often pestered about the&lt;br /&gt;
grave, had gone to Odessa, abandoning the grave and all his memories.&lt;br /&gt;
Alyosha showed no particular emotion at the sight of his mother’s grave.&lt;br /&gt;
He only listened to Grigory’s minute and solemn account of the erection of&lt;br /&gt;
the tomb; he stood with bowed head and walked away without uttering a&lt;br /&gt;
word. It was perhaps a year before he visited the cemetery again. But this&lt;br /&gt;
little episode was not without an influence upon Fyodor Pavlovitch—and a&lt;br /&gt;
very original one. He suddenly took a thousand roubles to our monastery to&lt;br /&gt;
pay for requiems for the soul of his wife; but not for the second,&lt;br /&gt;
Alyosha’s mother, the “crazy woman,” but for the first, Adelaïda Ivanovna,&lt;br /&gt;
who used to thrash him. In the evening of the same day he got drunk and&lt;br /&gt;
abused the monks to Alyosha. He himself was far from being religious; he&lt;br /&gt;
had probably never put a penny candle before the image of a saint. Strange&lt;br /&gt;
impulses of sudden feeling and sudden thought are common in such types.&lt;br /&gt;
&lt;br /&gt;
I have mentioned already that he looked bloated. His countenance at this&lt;br /&gt;
time bore traces of something that testified unmistakably to the life he&lt;br /&gt;
had led. Besides the long fleshy bags under his little, always insolent,&lt;br /&gt;
suspicious, and ironical eyes; besides the multitude of deep wrinkles in&lt;br /&gt;
his little fat face, the Adam’s apple hung below his sharp chin like a&lt;br /&gt;
great, fleshy goiter, which gave him a peculiar, repulsive, sensual&lt;br /&gt;
appearance; add to that a long rapacious mouth with full lips, between&lt;br /&gt;
which could be seen little stumps of black decayed teeth. He slobbered&lt;br /&gt;
every time he began to speak. He was fond indeed of making fun of his own&lt;br /&gt;
face, though, I believe, he was well satisfied with it. He used&lt;br /&gt;
particularly to point to his nose, which was not very large, but very&lt;br /&gt;
delicate and conspicuously aquiline. “A regular Roman nose,” he used to&lt;br /&gt;
say, “with my goiter I’ve quite the countenance of an ancient Roman&lt;br /&gt;
patrician of the decadent period.” He seemed proud of it.&lt;br /&gt;
&lt;br /&gt;
Not long after visiting his mother’s grave Alyosha suddenly announced that&lt;br /&gt;
he wanted to enter the monastery, and that the monks were willing to&lt;br /&gt;
receive him as a novice. He explained that this was his strong desire, and&lt;br /&gt;
that he was solemnly asking his consent as his father. The old man knew&lt;br /&gt;
that the elder Zossima, who was living in the monastery hermitage, had&lt;br /&gt;
made a special impression upon his “gentle boy.”&lt;br /&gt;
&lt;br /&gt;
“That is the most honest monk among them, of course,” he observed, after&lt;br /&gt;
listening in thoughtful silence to Alyosha, and seeming scarcely surprised&lt;br /&gt;
at his request. “H’m!... So that’s where you want to be, my gentle boy?”&lt;br /&gt;
&lt;br /&gt;
He was half drunk, and suddenly he grinned his slow half‐drunken grin,&lt;br /&gt;
which was not without a certain cunning and tipsy slyness. “H’m!... I had&lt;br /&gt;
a presentiment that you would end in something like this. Would you&lt;br /&gt;
believe it? You were making straight for it. Well, to be sure you have&lt;br /&gt;
your own two thousand. That’s a dowry for you. And I’ll never desert you,&lt;br /&gt;
my angel. And I’ll pay what’s wanted for you there, if they ask for it.&lt;br /&gt;
But, of course, if they don’t ask, why should we worry them? What do you&lt;br /&gt;
say? You know, you spend money like a canary, two grains a week. H’m!...&lt;br /&gt;
Do you know that near one monastery there’s a place outside the town where&lt;br /&gt;
every baby knows there are none but ‘the monks’ wives’ living, as they are&lt;br /&gt;
called. Thirty women, I believe. I have been there myself. You know, it’s&lt;br /&gt;
interesting in its own way, of course, as a variety. The worst of it is&lt;br /&gt;
it’s awfully Russian. There are no French women there. Of course they&lt;br /&gt;
could get them fast enough, they have plenty of money. If they get to hear&lt;br /&gt;
of it they’ll come along. Well, there’s nothing of that sort here, no&lt;br /&gt;
‘monks’ wives,’ and two hundred monks. They’re honest. They keep the&lt;br /&gt;
fasts. I admit it.... H’m.... So you want to be a monk? And do you know&lt;br /&gt;
I’m sorry to lose you, Alyosha; would you believe it, I’ve really grown&lt;br /&gt;
fond of you? Well, it’s a good opportunity. You’ll pray for us sinners; we&lt;br /&gt;
have sinned too much here. I’ve always been thinking who would pray for&lt;br /&gt;
me, and whether there’s any one in the world to do it. My dear boy, I’m&lt;br /&gt;
awfully stupid about that. You wouldn’t believe it. Awfully. You see,&lt;br /&gt;
however stupid I am about it, I keep thinking, I keep thinking—from time&lt;br /&gt;
to time, of course, not all the while. It’s impossible, I think, for the&lt;br /&gt;
devils to forget to drag me down to hell with their hooks when I die. Then&lt;br /&gt;
I wonder—hooks? Where would they get them? What of? Iron hooks? Where do&lt;br /&gt;
they forge them? Have they a foundry there of some sort? The monks in the&lt;br /&gt;
monastery probably believe that there’s a ceiling in hell, for instance.&lt;br /&gt;
Now I’m ready to believe in hell, but without a ceiling. It makes it more&lt;br /&gt;
refined, more enlightened, more Lutheran that is. And, after all, what&lt;br /&gt;
does it matter whether it has a ceiling or hasn’t? But, do you know,&lt;br /&gt;
there’s a damnable question involved in it? If there’s no ceiling there&lt;br /&gt;
can be no hooks, and if there are no hooks it all breaks down, which is&lt;br /&gt;
unlikely again, for then there would be none to drag me down to hell, and&lt;br /&gt;
if they don’t drag me down what justice is there in the world? _Il&lt;br /&gt;
faudrait les inventer_, those hooks, on purpose for me alone, for, if you&lt;br /&gt;
only knew, Alyosha, what a blackguard I am.”&lt;br /&gt;
&lt;br /&gt;
“But there are no hooks there,” said Alyosha, looking gently and seriously&lt;br /&gt;
at his father.&lt;br /&gt;
&lt;br /&gt;
“Yes, yes, only the shadows of hooks, I know, I know. That’s how a&lt;br /&gt;
Frenchman described hell: ‘_J’ai vu l’ombre d’un cocher qui avec l’ombre&lt;br /&gt;
d’une brosse frottait l’ombre d’une carrosse._’ How do you know there are&lt;br /&gt;
no hooks, darling? When you’ve lived with the monks you’ll sing a&lt;br /&gt;
different tune. But go and get at the truth there, and then come and tell&lt;br /&gt;
me. Anyway it’s easier going to the other world if one knows what there is&lt;br /&gt;
there. Besides, it will be more seemly for you with the monks than here&lt;br /&gt;
with me, with a drunken old man and young harlots ... though you’re like&lt;br /&gt;
an angel, nothing touches you. And I dare say nothing will touch you&lt;br /&gt;
there. That’s why I let you go, because I hope for that. You’ve got all&lt;br /&gt;
your wits about you. You will burn and you will burn out; you will be&lt;br /&gt;
healed and come back again. And I will wait for you. I feel that you’re&lt;br /&gt;
the only creature in the world who has not condemned me. My dear boy, I&lt;br /&gt;
feel it, you know. I can’t help feeling it.”&lt;br /&gt;
&lt;br /&gt;
And he even began blubbering. He was sentimental. He was wicked and&lt;br /&gt;
sentimental.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rkrug</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.luatex.org/index.php?title=T_wo_T_r:chapter-3.tex&amp;diff=3571</id>
		<title>T wo T r:chapter-3.tex</title>
		<link rel="alternate" type="text/html" href="https://wiki.luatex.org/index.php?title=T_wo_T_r:chapter-3.tex&amp;diff=3571"/>
		<updated>2021-02-22T18:40:32Z</updated>

		<summary type="html">&lt;p&gt;Rkrug: Created page with &amp;quot; &amp;lt;nowiki&amp;gt; \Title[Chapter 3.]{Chapter III. The Second Marriage And The Second Family}  Very shortly after getting his four‐year‐old Mitya off his hands Fyodor Pavlovitch ma...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &amp;lt;nowiki&amp;gt;&lt;br /&gt;
\Title[Chapter 3.]{Chapter III. The Second Marriage And The Second Family}&lt;br /&gt;
&lt;br /&gt;
Very shortly after getting his four‐year‐old Mitya off his hands Fyodor&lt;br /&gt;
Pavlovitch married a second time. His second marriage lasted eight years.&lt;br /&gt;
He took this second wife, Sofya Ivanovna, also a very young girl, from&lt;br /&gt;
another province, where he had gone upon some small piece of business in&lt;br /&gt;
company with a Jew. Though Fyodor Pavlovitch was a drunkard and a vicious&lt;br /&gt;
debauchee he never neglected investing his capital, and managed his&lt;br /&gt;
business affairs very successfully, though, no doubt, not over‐&lt;br /&gt;
scrupulously. Sofya Ivanovna was the daughter of an obscure deacon, and&lt;br /&gt;
was left from childhood an orphan without relations. She grew up in the&lt;br /&gt;
house of a general’s widow, a wealthy old lady of good position, who was&lt;br /&gt;
at once her benefactress and tormentor. I do not know the details, but I&lt;br /&gt;
have only heard that the orphan girl, a meek and gentle creature, was once&lt;br /&gt;
cut down from a halter in which she was hanging from a nail in the loft,&lt;br /&gt;
so terrible were her sufferings from the caprice and everlasting nagging&lt;br /&gt;
of this old woman, who was apparently not bad‐hearted but had become an&lt;br /&gt;
insufferable tyrant through idleness.&lt;br /&gt;
&lt;br /&gt;
Fyodor Pavlovitch made her an offer; inquiries were made about him and he&lt;br /&gt;
was refused. But again, as in his first marriage, he proposed an elopement&lt;br /&gt;
to the orphan girl. There is very little doubt that she would not on any&lt;br /&gt;
account have married him if she had known a little more about him in time.&lt;br /&gt;
But she lived in another province; besides, what could a little girl of&lt;br /&gt;
sixteen know about it, except that she would be better at the bottom of&lt;br /&gt;
the river than remaining with her benefactress. So the poor child&lt;br /&gt;
exchanged a benefactress for a benefactor. Fyodor Pavlovitch did not get a&lt;br /&gt;
penny this time, for the general’s widow was furious. She gave them&lt;br /&gt;
nothing and cursed them both. But he had not reckoned on a dowry; what&lt;br /&gt;
allured him was the remarkable beauty of the innocent girl, above all her&lt;br /&gt;
innocent appearance, which had a peculiar attraction for a vicious&lt;br /&gt;
profligate, who had hitherto admired only the coarser types of feminine&lt;br /&gt;
beauty.&lt;br /&gt;
&lt;br /&gt;
“Those innocent eyes slit my soul up like a razor,” he used to say&lt;br /&gt;
afterwards, with his loathsome snigger. In a man so depraved this might,&lt;br /&gt;
of course, mean no more than sensual attraction. As he had received no&lt;br /&gt;
dowry with his wife, and had, so to speak, taken her “from the halter,” he&lt;br /&gt;
did not stand on ceremony with her. Making her feel that she had “wronged”&lt;br /&gt;
him, he took advantage of her phenomenal meekness and submissiveness to&lt;br /&gt;
trample on the elementary decencies of marriage. He gathered loose women&lt;br /&gt;
into his house, and carried on orgies of debauchery in his wife’s&lt;br /&gt;
presence. To show what a pass things had come to, I may mention that&lt;br /&gt;
Grigory, the gloomy, stupid, obstinate, argumentative servant, who had&lt;br /&gt;
always hated his first mistress, Adelaïda Ivanovna, took the side of his&lt;br /&gt;
new mistress. He championed her cause, abusing Fyodor Pavlovitch in a&lt;br /&gt;
manner little befitting a servant, and on one occasion broke up the revels&lt;br /&gt;
and drove all the disorderly women out of the house. In the end this&lt;br /&gt;
unhappy young woman, kept in terror from her childhood, fell into that&lt;br /&gt;
kind of nervous disease which is most frequently found in peasant women&lt;br /&gt;
who are said to be “possessed by devils.” At times after terrible fits of&lt;br /&gt;
hysterics she even lost her reason. Yet she bore Fyodor Pavlovitch two&lt;br /&gt;
sons, Ivan and Alexey, the eldest in the first year of marriage and the&lt;br /&gt;
second three years later. When she died, little Alexey was in his fourth&lt;br /&gt;
year, and, strange as it seems, I know that he remembered his mother all&lt;br /&gt;
his life, like a dream, of course. At her death almost exactly the same&lt;br /&gt;
thing happened to the two little boys as to their elder brother, Mitya.&lt;br /&gt;
They were completely forgotten and abandoned by their father. They were&lt;br /&gt;
looked after by the same Grigory and lived in his cottage, where they were&lt;br /&gt;
found by the tyrannical old lady who had brought up their mother. She was&lt;br /&gt;
still alive, and had not, all those eight years, forgotten the insult done&lt;br /&gt;
her. All that time she was obtaining exact information as to her Sofya’s&lt;br /&gt;
manner of life, and hearing of her illness and hideous surroundings she&lt;br /&gt;
declared aloud two or three times to her retainers:&lt;br /&gt;
&lt;br /&gt;
“It serves her right. God has punished her for her ingratitude.”&lt;br /&gt;
&lt;br /&gt;
Exactly three months after Sofya Ivanovna’s death the general’s widow&lt;br /&gt;
suddenly appeared in our town, and went straight to Fyodor Pavlovitch’s&lt;br /&gt;
house. She spent only half an hour in the town but she did a great deal.&lt;br /&gt;
It was evening. Fyodor Pavlovitch, whom she had not seen for those eight&lt;br /&gt;
years, came in to her drunk. The story is that instantly upon seeing him,&lt;br /&gt;
without any sort of explanation, she gave him two good, resounding slaps&lt;br /&gt;
on the face, seized him by a tuft of hair, and shook him three times up&lt;br /&gt;
and down. Then, without a word, she went straight to the cottage to the&lt;br /&gt;
two boys. Seeing, at the first glance, that they were unwashed and in&lt;br /&gt;
dirty linen, she promptly gave Grigory, too, a box on the ear, and&lt;br /&gt;
announcing that she would carry off both the children she wrapped them&lt;br /&gt;
just as they were in a rug, put them in the carriage, and drove off to her&lt;br /&gt;
own town. Grigory accepted the blow like a devoted slave, without a word,&lt;br /&gt;
and when he escorted the old lady to her carriage he made her a low bow&lt;br /&gt;
and pronounced impressively that, “God would repay her for the orphans.”&lt;br /&gt;
“You are a blockhead all the same,” the old lady shouted to him as she&lt;br /&gt;
drove away.&lt;br /&gt;
&lt;br /&gt;
Fyodor Pavlovitch, thinking it over, decided that it was a good thing, and&lt;br /&gt;
did not refuse the general’s widow his formal consent to any proposition&lt;br /&gt;
in regard to his children’s education. As for the slaps she had given him,&lt;br /&gt;
he drove all over the town telling the story.&lt;br /&gt;
&lt;br /&gt;
It happened that the old lady died soon after this, but she left the boys&lt;br /&gt;
in her will a thousand roubles each “for their instruction, and so that&lt;br /&gt;
all be spent on them exclusively, with the condition that it be so&lt;br /&gt;
portioned out as to last till they are twenty‐one, for it is more than&lt;br /&gt;
adequate provision for such children. If other people think fit to throw&lt;br /&gt;
away their money, let them.” I have not read the will myself, but I heard&lt;br /&gt;
there was something queer of the sort, very whimsically expressed. The&lt;br /&gt;
principal heir, Yefim Petrovitch Polenov, the Marshal of Nobility of the&lt;br /&gt;
province, turned out, however, to be an honest man. Writing to Fyodor&lt;br /&gt;
Pavlovitch, and discerning at once that he could extract nothing from him&lt;br /&gt;
for his children’s education (though the latter never directly refused but&lt;br /&gt;
only procrastinated as he always did in such cases, and was, indeed, at&lt;br /&gt;
times effusively sentimental), Yefim Petrovitch took a personal interest&lt;br /&gt;
in the orphans. He became especially fond of the younger, Alexey, who&lt;br /&gt;
lived for a long while as one of his family. I beg the reader to note this&lt;br /&gt;
from the beginning. And to Yefim Petrovitch, a man of a generosity and&lt;br /&gt;
humanity rarely to be met with, the young people were more indebted for&lt;br /&gt;
their education and bringing up than to any one. He kept the two thousand&lt;br /&gt;
roubles left to them by the general’s widow intact, so that by the time&lt;br /&gt;
they came of age their portions had been doubled by the accumulation of&lt;br /&gt;
interest. He educated them both at his own expense, and certainly spent&lt;br /&gt;
far more than a thousand roubles upon each of them. I won’t enter into a&lt;br /&gt;
detailed account of their boyhood and youth, but will only mention a few&lt;br /&gt;
of the most important events. Of the elder, Ivan, I will only say that he&lt;br /&gt;
grew into a somewhat morose and reserved, though far from timid boy. At&lt;br /&gt;
ten years old he had realized that they were living not in their own home&lt;br /&gt;
but on other people’s charity, and that their father was a man of whom it&lt;br /&gt;
was disgraceful to speak. This boy began very early, almost in his infancy&lt;br /&gt;
(so they say at least), to show a brilliant and unusual aptitude for&lt;br /&gt;
learning. I don’t know precisely why, but he left the family of Yefim&lt;br /&gt;
Petrovitch when he was hardly thirteen, entering a Moscow gymnasium, and&lt;br /&gt;
boarding with an experienced and celebrated teacher, an old friend of&lt;br /&gt;
Yefim Petrovitch. Ivan used to declare afterwards that this was all due to&lt;br /&gt;
the “ardor for good works” of Yefim Petrovitch, who was captivated by the&lt;br /&gt;
idea that the boy’s genius should be trained by a teacher of genius. But&lt;br /&gt;
neither Yefim Petrovitch nor this teacher was living when the young man&lt;br /&gt;
finished at the gymnasium and entered the university. As Yefim Petrovitch&lt;br /&gt;
had made no provision for the payment of the tyrannical old lady’s legacy,&lt;br /&gt;
which had grown from one thousand to two, it was delayed, owing to&lt;br /&gt;
formalities inevitable in Russia, and the young man was in great straits&lt;br /&gt;
for the first two years at the university, as he was forced to keep&lt;br /&gt;
himself all the time he was studying. It must be noted that he did not&lt;br /&gt;
even attempt to communicate with his father, perhaps from pride, from&lt;br /&gt;
contempt for him, or perhaps from his cool common sense, which told him&lt;br /&gt;
that from such a father he would get no real assistance. However that may&lt;br /&gt;
have been, the young man was by no means despondent and succeeded in&lt;br /&gt;
getting work, at first giving sixpenny lessons and afterwards getting&lt;br /&gt;
paragraphs on street incidents into the newspapers under the signature of&lt;br /&gt;
“Eye‐Witness.” These paragraphs, it was said, were so interesting and&lt;br /&gt;
piquant that they were soon taken. This alone showed the young man’s&lt;br /&gt;
practical and intellectual superiority over the masses of needy and&lt;br /&gt;
unfortunate students of both sexes who hang about the offices of the&lt;br /&gt;
newspapers and journals, unable to think of anything better than&lt;br /&gt;
everlasting entreaties for copying and translations from the French.&lt;br /&gt;
Having once got into touch with the editors Ivan Fyodorovitch always kept&lt;br /&gt;
up his connection with them, and in his latter years at the university he&lt;br /&gt;
published brilliant reviews of books upon various special subjects, so&lt;br /&gt;
that he became well known in literary circles. But only in his last year&lt;br /&gt;
he suddenly succeeded in attracting the attention of a far wider circle of&lt;br /&gt;
readers, so that a great many people noticed and remembered him. It was&lt;br /&gt;
rather a curious incident. When he had just left the university and was&lt;br /&gt;
preparing to go abroad upon his two thousand roubles, Ivan Fyodorovitch&lt;br /&gt;
published in one of the more important journals a strange article, which&lt;br /&gt;
attracted general notice, on a subject of which he might have been&lt;br /&gt;
supposed to know nothing, as he was a student of natural science. The&lt;br /&gt;
article dealt with a subject which was being debated everywhere at the&lt;br /&gt;
time—the position of the ecclesiastical courts. After discussing several&lt;br /&gt;
opinions on the subject he went on to explain his own view. What was most&lt;br /&gt;
striking about the article was its tone, and its unexpected conclusion.&lt;br /&gt;
Many of the Church party regarded him unquestioningly as on their side.&lt;br /&gt;
And yet not only the secularists but even atheists joined them in their&lt;br /&gt;
applause. Finally some sagacious persons opined that the article was&lt;br /&gt;
nothing but an impudent satirical burlesque. I mention this incident&lt;br /&gt;
particularly because this article penetrated into the famous monastery in&lt;br /&gt;
our neighborhood, where the inmates, being particularly interested in the&lt;br /&gt;
question of the ecclesiastical courts, were completely bewildered by it.&lt;br /&gt;
Learning the author’s name, they were interested in his being a native of&lt;br /&gt;
the town and the son of “that Fyodor Pavlovitch.” And just then it was&lt;br /&gt;
that the author himself made his appearance among us.&lt;br /&gt;
&lt;br /&gt;
Why Ivan Fyodorovitch had come amongst us I remember asking myself at the&lt;br /&gt;
time with a certain uneasiness. This fateful visit, which was the first&lt;br /&gt;
step leading to so many consequences, I never fully explained to myself.&lt;br /&gt;
It seemed strange on the face of it that a young man so learned, so proud,&lt;br /&gt;
and apparently so cautious, should suddenly visit such an infamous house&lt;br /&gt;
and a father who had ignored him all his life, hardly knew him, never&lt;br /&gt;
thought of him, and would not under any circumstances have given him&lt;br /&gt;
money, though he was always afraid that his sons Ivan and Alexey would&lt;br /&gt;
also come to ask him for it. And here the young man was staying in the&lt;br /&gt;
house of such a father, had been living with him for two months, and they&lt;br /&gt;
were on the best possible terms. This last fact was a special cause of&lt;br /&gt;
wonder to many others as well as to me. Pyotr Alexandrovitch Miüsov, of&lt;br /&gt;
whom we have spoken already, the cousin of Fyodor Pavlovitch’s first wife,&lt;br /&gt;
happened to be in the neighborhood again on a visit to his estate. He had&lt;br /&gt;
come from Paris, which was his permanent home. I remember that he was more&lt;br /&gt;
surprised than any one when he made the acquaintance of the young man, who&lt;br /&gt;
interested him extremely, and with whom he sometimes argued and not&lt;br /&gt;
without an inner pang compared himself in acquirements.&lt;br /&gt;
&lt;br /&gt;
“He is proud,” he used to say, “he will never be in want of pence; he has&lt;br /&gt;
got money enough to go abroad now. What does he want here? Every one can&lt;br /&gt;
see that he hasn’t come for money, for his father would never give him&lt;br /&gt;
any. He has no taste for drink and dissipation, and yet his father can’t&lt;br /&gt;
do without him. They get on so well together!”&lt;br /&gt;
&lt;br /&gt;
That was the truth; the young man had an unmistakable influence over his&lt;br /&gt;
father, who positively appeared to be behaving more decently and even&lt;br /&gt;
seemed at times ready to obey his son, though often extremely and even&lt;br /&gt;
spitefully perverse.&lt;br /&gt;
&lt;br /&gt;
It was only later that we learned that Ivan had come partly at the request&lt;br /&gt;
of, and in the interests of, his elder brother, Dmitri, whom he saw for&lt;br /&gt;
the first time on this very visit, though he had before leaving Moscow&lt;br /&gt;
been in correspondence with him about an important matter of more concern&lt;br /&gt;
to Dmitri than himself. What that business was the reader will learn fully&lt;br /&gt;
in due time. Yet even when I did know of this special circumstance I still&lt;br /&gt;
felt Ivan Fyodorovitch to be an enigmatic figure, and thought his visit&lt;br /&gt;
rather mysterious.&lt;br /&gt;
&lt;br /&gt;
I may add that Ivan appeared at the time in the light of a mediator&lt;br /&gt;
between his father and his elder brother Dmitri, who was in open quarrel&lt;br /&gt;
with his father and even planning to bring an action against him.&lt;br /&gt;
&lt;br /&gt;
The family, I repeat, was now united for the first time, and some of its&lt;br /&gt;
members met for the first time in their lives. The younger brother,&lt;br /&gt;
Alexey, had been a year already among us, having been the first of the&lt;br /&gt;
three to arrive. It is of that brother Alexey I find it most difficult to&lt;br /&gt;
speak in this introduction. Yet I must give some preliminary account of&lt;br /&gt;
him, if only to explain one queer fact, which is that I have to introduce&lt;br /&gt;
my hero to the reader wearing the cassock of a novice. Yes, he had been&lt;br /&gt;
for the last year in our monastery, and seemed willing to be cloistered&lt;br /&gt;
there for the rest of his life.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rkrug</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.luatex.org/index.php?title=T_wo_T_r:chapter-2.tex&amp;diff=3570</id>
		<title>T wo T r:chapter-2.tex</title>
		<link rel="alternate" type="text/html" href="https://wiki.luatex.org/index.php?title=T_wo_T_r:chapter-2.tex&amp;diff=3570"/>
		<updated>2021-02-22T18:39:52Z</updated>

		<summary type="html">&lt;p&gt;Rkrug: Created page with &amp;quot; &amp;lt;nowiki&amp;gt; \Title[Chapter 2]{Chapter II. He Gets Rid Of His Eldest Son}  You can easily imagine what a father such a man could be and how he would bring up his children. His be...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &amp;lt;nowiki&amp;gt;&lt;br /&gt;
\Title[Chapter 2]{Chapter II. He Gets Rid Of His Eldest Son}&lt;br /&gt;
&lt;br /&gt;
You can easily imagine what a father such a man could be and how he would&lt;br /&gt;
bring up his children. His behavior as a father was exactly what might be&lt;br /&gt;
expected. He completely abandoned the child of his marriage with Adelaïda&lt;br /&gt;
Ivanovna, not from malice, nor because of his matrimonial grievances, but&lt;br /&gt;
simply because he forgot him. While he was wearying every one with his&lt;br /&gt;
tears and complaints, and turning his house into a sink of debauchery, a&lt;br /&gt;
faithful servant of the family, Grigory, took the three‐year‐old Mitya&lt;br /&gt;
into his care. If he hadn’t looked after him there would have been no one&lt;br /&gt;
even to change the baby’s little shirt.&lt;br /&gt;
&lt;br /&gt;
It happened moreover that the child’s relations on his mother’s side&lt;br /&gt;
forgot him too at first. His grandfather was no longer living, his widow,&lt;br /&gt;
Mitya’s grandmother, had moved to Moscow, and was seriously ill, while his&lt;br /&gt;
daughters were married, so that Mitya remained for almost a whole year in&lt;br /&gt;
old Grigory’s charge and lived with him in the servant’s cottage. But if&lt;br /&gt;
his father had remembered him (he could not, indeed, have been altogether&lt;br /&gt;
unaware of his existence) he would have sent him back to the cottage, as&lt;br /&gt;
the child would only have been in the way of his debaucheries. But a&lt;br /&gt;
cousin of Mitya’s mother, Pyotr Alexandrovitch Miüsov, happened to return&lt;br /&gt;
from Paris. He lived for many years afterwards abroad, but was at that&lt;br /&gt;
time quite a young man, and distinguished among the Miüsovs as a man of&lt;br /&gt;
enlightened ideas and of European culture, who had been in the capitals&lt;br /&gt;
and abroad. Towards the end of his life he became a Liberal of the type&lt;br /&gt;
common in the forties and fifties. In the course of his career he had come&lt;br /&gt;
into contact with many of the most Liberal men of his epoch, both in&lt;br /&gt;
Russia and abroad. He had known Proudhon and Bakunin personally, and in&lt;br /&gt;
his declining years was very fond of describing the three days of the&lt;br /&gt;
Paris Revolution of February 1848, hinting that he himself had almost&lt;br /&gt;
taken part in the fighting on the barricades. This was one of the most&lt;br /&gt;
grateful recollections of his youth. He had an independent property of&lt;br /&gt;
about a thousand souls, to reckon in the old style. His splendid estate&lt;br /&gt;
lay on the outskirts of our little town and bordered on the lands of our&lt;br /&gt;
famous monastery, with which Pyotr Alexandrovitch began an endless&lt;br /&gt;
lawsuit, almost as soon as he came into the estate, concerning the rights&lt;br /&gt;
of fishing in the river or wood‐cutting in the forest, I don’t know&lt;br /&gt;
exactly which. He regarded it as his duty as a citizen and a man of&lt;br /&gt;
culture to open an attack upon the “clericals.” Hearing all about Adelaïda&lt;br /&gt;
Ivanovna, whom he, of course, remembered, and in whom he had at one time&lt;br /&gt;
been interested, and learning of the existence of Mitya, he intervened, in&lt;br /&gt;
spite of all his youthful indignation and contempt for Fyodor Pavlovitch.&lt;br /&gt;
He made the latter’s acquaintance for the first time, and told him&lt;br /&gt;
directly that he wished to undertake the child’s education. He used long&lt;br /&gt;
afterwards to tell as a characteristic touch, that when he began to speak&lt;br /&gt;
of Mitya, Fyodor Pavlovitch looked for some time as though he did not&lt;br /&gt;
understand what child he was talking about, and even as though he was&lt;br /&gt;
surprised to hear that he had a little son in the house. The story may&lt;br /&gt;
have been exaggerated, yet it must have been something like the truth.&lt;br /&gt;
&lt;br /&gt;
Fyodor Pavlovitch was all his life fond of acting, of suddenly playing an&lt;br /&gt;
unexpected part, sometimes without any motive for doing so, and even to&lt;br /&gt;
his own direct disadvantage, as, for instance, in the present case. This&lt;br /&gt;
habit, however, is characteristic of a very great number of people, some&lt;br /&gt;
of them very clever ones, not like Fyodor Pavlovitch. Pyotr Alexandrovitch&lt;br /&gt;
carried the business through vigorously, and was appointed, with Fyodor&lt;br /&gt;
Pavlovitch, joint guardian of the child, who had a small property, a house&lt;br /&gt;
and land, left him by his mother. Mitya did, in fact, pass into this&lt;br /&gt;
cousin’s keeping, but as the latter had no family of his own, and after&lt;br /&gt;
securing the revenues of his estates was in haste to return at once to&lt;br /&gt;
Paris, he left the boy in charge of one of his cousins, a lady living in&lt;br /&gt;
Moscow. It came to pass that, settling permanently in Paris he, too,&lt;br /&gt;
forgot the child, especially when the Revolution of February broke out,&lt;br /&gt;
making an impression on his mind that he remembered all the rest of his&lt;br /&gt;
life. The Moscow lady died, and Mitya passed into the care of one of her&lt;br /&gt;
married daughters. I believe he changed his home a fourth time later on. I&lt;br /&gt;
won’t enlarge upon that now, as I shall have much to tell later of Fyodor&lt;br /&gt;
Pavlovitch’s firstborn, and must confine myself now to the most essential&lt;br /&gt;
facts about him, without which I could not begin my story.&lt;br /&gt;
&lt;br /&gt;
In the first place, this Mitya, or rather Dmitri Fyodorovitch, was the&lt;br /&gt;
only one of Fyodor Pavlovitch’s three sons who grew up in the belief that&lt;br /&gt;
he had property, and that he would be independent on coming of age. He&lt;br /&gt;
spent an irregular boyhood and youth. He did not finish his studies at the&lt;br /&gt;
gymnasium, he got into a military school, then went to the Caucasus, was&lt;br /&gt;
promoted, fought a duel, and was degraded to the ranks, earned promotion&lt;br /&gt;
again, led a wild life, and spent a good deal of money. He did not begin&lt;br /&gt;
to receive any income from Fyodor Pavlovitch until he came of age, and&lt;br /&gt;
until then got into debt. He saw and knew his father, Fyodor Pavlovitch,&lt;br /&gt;
for the first time on coming of age, when he visited our neighborhood on&lt;br /&gt;
purpose to settle with him about his property. He seems not to have liked&lt;br /&gt;
his father. He did not stay long with him, and made haste to get away,&lt;br /&gt;
having only succeeded in obtaining a sum of money, and entering into an&lt;br /&gt;
agreement for future payments from the estate, of the revenues and value&lt;br /&gt;
of which he was unable (a fact worthy of note), upon this occasion, to get&lt;br /&gt;
a statement from his father. Fyodor Pavlovitch remarked for the first time&lt;br /&gt;
then (this, too, should be noted) that Mitya had a vague and exaggerated&lt;br /&gt;
idea of his property. Fyodor Pavlovitch was very well satisfied with this,&lt;br /&gt;
as it fell in with his own designs. He gathered only that the young man&lt;br /&gt;
was frivolous, unruly, of violent passions, impatient, and dissipated, and&lt;br /&gt;
that if he could only obtain ready money he would be satisfied, although&lt;br /&gt;
only, of course, for a short time. So Fyodor Pavlovitch began to take&lt;br /&gt;
advantage of this fact, sending him from time to time small doles,&lt;br /&gt;
installments. In the end, when four years later, Mitya, losing patience,&lt;br /&gt;
came a second time to our little town to settle up once for all with his&lt;br /&gt;
father, it turned out to his amazement that he had nothing, that it was&lt;br /&gt;
difficult to get an account even, that he had received the whole value of&lt;br /&gt;
his property in sums of money from Fyodor Pavlovitch, and was perhaps even&lt;br /&gt;
in debt to him, that by various agreements into which he had, of his own&lt;br /&gt;
desire, entered at various previous dates, he had no right to expect&lt;br /&gt;
anything more, and so on, and so on. The young man was overwhelmed,&lt;br /&gt;
suspected deceit and cheating, and was almost beside himself. And, indeed,&lt;br /&gt;
this circumstance led to the catastrophe, the account of which forms the&lt;br /&gt;
subject of my first introductory story, or rather the external side of it.&lt;br /&gt;
But before I pass to that story I must say a little of Fyodor Pavlovitch’s&lt;br /&gt;
other two sons, and of their origin.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rkrug</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.luatex.org/index.php?title=T_wo_T_r:chapter-1.tex&amp;diff=3569</id>
		<title>T wo T r:chapter-1.tex</title>
		<link rel="alternate" type="text/html" href="https://wiki.luatex.org/index.php?title=T_wo_T_r:chapter-1.tex&amp;diff=3569"/>
		<updated>2021-02-22T18:39:08Z</updated>

		<summary type="html">&lt;p&gt;Rkrug: Created page with &amp;quot; &amp;lt;nowiki&amp;gt;  \Title[Chapter 1]{Chapter I. Fyodor Pavlovitch Karamazov and a bit more text to force a multiline title.}  VAT \Footnote{A first footnote.} Office.  ſ õ Æ Alexey...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &amp;lt;nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
\Title[Chapter 1]{Chapter I. Fyodor Pavlovitch Karamazov and a bit&lt;br /&gt;
more text to force a multiline title.}&lt;br /&gt;
&lt;br /&gt;
VAT&lt;br /&gt;
\Footnote{A first footnote.}&lt;br /&gt;
Office.  ſ õ Æ Alexey {Fyodorovitch \Emph{Karamazov} was} the third son of&lt;br /&gt;
%%% This is a comment&lt;br /&gt;
Fyodor {Pavlovitch \Bold{Karamazov}, a} land owner well known in our district&lt;br /&gt;
in his own day, and still remembered among us owing to his gloomy and&lt;br /&gt;
tragic death, which happened thirteen years ago, and which I shall&lt;br /&gt;
describe in its proper place.{ \Emph{For the {\Bold present} I}&lt;br /&gt;
will\Footnote{A second footnote with no leading space.} only say} that&lt;br /&gt;
this &amp;quot;landowner&amp;quot;—for so we used to call him, although he hardly spent&lt;br /&gt;
a day of his life on his own estate—was a strange type, yet one pretty&lt;br /&gt;
frequently to be met with, a type abject and vicious and at the same&lt;br /&gt;
time senseless. But he was one of those senseless persons who are very&lt;br /&gt;
well capable of looking after their worldly affairs, and, apparently,&lt;br /&gt;
after nothing else. Fyodor Pavlovitch, for instance, began with next&lt;br /&gt;
to nothing; his estate was of the smallest; he ran to dine at other&lt;br /&gt;
men&amp;#039;s tables, and fastened on them as a toady, yet at his death it&lt;br /&gt;
appeared that he had a hundred thousand roubles in hard cash. At the&lt;br /&gt;
same time, he was all his life one of the most senseless, fantastical&lt;br /&gt;
fellows in the whole district. I repeat, it was not stupidity—the&lt;br /&gt;
majority of these fantastical fellows are shrewd and intelligent\ &lt;br /&gt;
enough—but just senselessness, and a peculiar national form of it.&lt;br /&gt;
\Footnote{A longer footnote that will be broken into more than one paragraph.&lt;br /&gt;
Some more text. And a repeat of some of the text being noted upon:&lt;br /&gt;
I repeat, it was not stupidity—the&lt;br /&gt;
majority of these \Bold{fantastical} fellows are shrewd and intelligent\ &lt;br /&gt;
enough—but just senselessness, and a peculiar national form of it.&lt;br /&gt;
&lt;br /&gt;
Here is the second paragraph. I repeat, it was not stupidity—the&lt;br /&gt;
majority of these \Bold{fantastical} fellows are shrewd and intelligent\ &lt;br /&gt;
enough—but just senselessness, and a peculiar national form of it.}&lt;br /&gt;
    &lt;br /&gt;
He was married {\Bold twice}, and had three sons, the eldest, Dmitri, by his&lt;br /&gt;
\Fix{fist}{first}{typo}% This comment will eliminate any white space.&lt;br /&gt;
wife, and two, Ivan and Alexey, by his second. Fyodor&lt;br /&gt;
Pavlovitch&amp;#039;s first wife, Adelaïda Ivanovna, belonged to a fairly rich&lt;br /&gt;
and distinguished noble family, also landowners in our district, the&lt;br /&gt;
Miüsovs. How it came to pass that an heiress, who was also a beauty,&lt;br /&gt;
and moreover one of those vigorous, intelligent girls, so common in&lt;br /&gt;
this generation, but sometimes also to be found in the last, could&lt;br /&gt;
have married such a worthless, puny weakling, as we all called him, I&lt;br /&gt;
won&amp;#039;t attempt to explain. {I knew a young lady} of the last “romantic”&lt;br /&gt;
generation who after some years of an enigmatic passion for a&lt;br /&gt;
gentleman, whom she might quite easily have married at any moment,&lt;br /&gt;
invented insuperable obstacles to their union, and ended by throwing&lt;br /&gt;
herself one stormy night into a rather deep and rapid river from a&lt;br /&gt;
high bank, almost a precipice, and so perished, entirely to satisfy&lt;br /&gt;
her own caprice, and to be like Shakespeare&amp;#039;s Ophelia. Indeed, if this&lt;br /&gt;
precipice, a chosen and favorite spot of hers, had been less&lt;br /&gt;
picturesque, if there had been a prosaic flat bank in its place, most&lt;br /&gt;
likely the suicide would never have taken place. This is a fact, and&lt;br /&gt;
probably there have been not a few similar instances in the last two&lt;br /&gt;
or three generations. Adelaïda Ivanovna Miüsov&amp;#039;s action was similarly,&lt;br /&gt;
no doubt, an echo of other people&amp;#039;s ideas, and was due to the&lt;br /&gt;
irritation caused by lack of mental freedom. She wanted, perhaps, to&lt;br /&gt;
show her feminine independence, to override class distinctions and the&lt;br /&gt;
despotism of her family. And a pliable imagination persuaded her, we&lt;br /&gt;
must suppose, for a brief moment, that Fyodor Pavlovitch, in spite of&lt;br /&gt;
his parasitic position, was one of the bold and ironical spirits of&lt;br /&gt;
that progressive epoch, though he was, in fact, an ill-natured buffoon&lt;br /&gt;
and nothing more. What gave the marriage piquancy was that it was&lt;br /&gt;
preceded by an elopement, and this greatly captivated Adelaïda&lt;br /&gt;
Ivanovna&amp;#039;s fancy. Fyodor Pavlovitch&amp;#039;s position at the time made him&lt;br /&gt;
specially eager for any such enterprise, for he was passionately&lt;br /&gt;
anxious to make a career in one way or another. To attach himself to a&lt;br /&gt;
good family and obtain a dowry was an alluring prospect. As for mutual&lt;br /&gt;
love it did not exist apparently, either in the bride or in him, in&lt;br /&gt;
spite of Adelaïda Ivanovna&amp;#039;s beauty. This was, perhaps, a unique case&lt;br /&gt;
of the kind in the life of Fyodor Pavlovitch, who was always of a&lt;br /&gt;
voluptuous temper, and ready to run after any petticoat on the&lt;br /&gt;
slightest encouragement. She seems to have been the only woman who&lt;br /&gt;
made no particular appeal {to his senses.}&lt;br /&gt;
&lt;br /&gt;
Immediately after the elopement Adelaïda Ivanovna discerned in a flash&lt;br /&gt;
that she had no feeling for her husband but contempt. The marriage&lt;br /&gt;
accordingly showed itself in its true colors with extraordinary&lt;br /&gt;
rapidity. Although the family accepted the event pretty quickly and&lt;br /&gt;
apportioned the runaway bride her dowry, the husband and wife began to&lt;br /&gt;
lead a most disorderly life, and there were everlasting scenes between&lt;br /&gt;
them. It was said that the young wife showed incomparably more&lt;br /&gt;
generosity and dignity than Fyodor Pavlovitch, who, as is now known,&lt;br /&gt;
got hold of all her money up to twenty-five thousand roubles as soon&lt;br /&gt;
as she received it, so that those thousands were lost to her for&lt;br /&gt;
ever. The little village and the rather fine town house which formed&lt;br /&gt;
part of her dowry he did his utmost for a long time to transfer to his&lt;br /&gt;
name, by means of some deed of conveyance. He would probably have&lt;br /&gt;
succeeded, merely from her moral fatigue and desire to get rid of him,&lt;br /&gt;
and from the contempt and loathing he aroused by his persistent and&lt;br /&gt;
shameless importunity. But, fortunately, Adelaïda Ivanovna&amp;#039;s family&lt;br /&gt;
intervened and circumvented his greediness. It is known for a fact&lt;br /&gt;
that frequent fights took place between the husband and wife, but&lt;br /&gt;
rumor had it that Fyodor Pavlovitch did not beat his wife but was&lt;br /&gt;
beaten by her, for she was a hot-tempered, bold, dark-browed,&lt;br /&gt;
impatient woman, possessed of remarkable physical strength. Finally,&lt;br /&gt;
she left the house and ran away from Fyodor Pavlovitch with a&lt;br /&gt;
destitute divinity student, leaving Mitya, a child of three years old,&lt;br /&gt;
in her husband&amp;#039;s hands. Immediately Fyodor Pavlovitch introduced a&lt;br /&gt;
regular harem into the house, and abandoned himself to orgies of&lt;br /&gt;
drunkenness. In the intervals he used to drive all over the province,&lt;br /&gt;
complaining tearfully to each and all of Adelaïda Ivanovna&amp;#039;s having&lt;br /&gt;
left him, going into details too disgraceful for a husband to mention&lt;br /&gt;
in regard to his own married life. What seemed to gratify him and&lt;br /&gt;
flatter his self-love most was to play the ridiculous part of the&lt;br /&gt;
injured husband, and to parade his woes with embellishments.&lt;br /&gt;
&lt;br /&gt;
“One would think that you&amp;#039;d got a promotion, Fyodor Pavlovitch, you&lt;br /&gt;
seem so pleased in spite of your sorrow,” scoffers said to him. Many&lt;br /&gt;
even added that he was glad of a new comic part in which to play the&lt;br /&gt;
buffoon, and that it was simply to make it funnier that he pretended&lt;br /&gt;
to be unaware of his ludicrous position. But, who knows, it may have&lt;br /&gt;
been simplicity. At last he succeeded in getting on the track of his&lt;br /&gt;
runaway wife. The poor woman turned out to be in Petersburg, where she&lt;br /&gt;
had gone with her divinity student, and where she had thrown herself&lt;br /&gt;
into a life of complete emancipation. Fyodor Pavlovitch at once began&lt;br /&gt;
bustling about, making preparations to go to Petersburg, with what&lt;br /&gt;
object he could not himself have said. He would perhaps have really&lt;br /&gt;
gone; but having determined to do so he felt at once entitled to&lt;br /&gt;
fortify himself for the journey by another bout of reckless&lt;br /&gt;
drinking. And just at that time his wife&amp;#039;s family received the news of&lt;br /&gt;
her death in Petersburg. She had died quite suddenly in a garret,&lt;br /&gt;
according to one story, of typhus, or as another version had it, of&lt;br /&gt;
starvation. Fyodor Pavlovitch was drunk when he heard of his wife&amp;#039;s&lt;br /&gt;
death, and the story is that he ran out into the street and began&lt;br /&gt;
shouting with joy, raising his hands to Heaven: “Lord, now lettest&lt;br /&gt;
Thou Thy servant depart in peace,” but others say he wept without&lt;br /&gt;
restraint like a little child, so much so that people were sorry for&lt;br /&gt;
him, in spite of the repulsion he inspired. It is quite possible that&lt;br /&gt;
both versions were true, that he rejoiced at his release, and at the&lt;br /&gt;
same time wept for her who released him. As a general rule, people,&lt;br /&gt;
even the wicked, are much more naïve and simple-hearted than we&lt;br /&gt;
suppose. And we ourselves are, too.&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rkrug</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.luatex.org/index.php?title=T_wo_T_r:text.tex&amp;diff=3568</id>
		<title>T wo T r:text.tex</title>
		<link rel="alternate" type="text/html" href="https://wiki.luatex.org/index.php?title=T_wo_T_r:text.tex&amp;diff=3568"/>
		<updated>2021-02-22T18:37:58Z</updated>

		<summary type="html">&lt;p&gt;Rkrug: Created page with &amp;quot; &amp;lt;nowiki&amp;gt;  \Input{chapter-1.tex}  \Input{  chapter-2.tex  }  \Input{chapter-3.tex}  \Input{chapter-4.tex}  \Input{chapter-5.tex}  &amp;lt;/nowiki&amp;gt;&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &amp;lt;nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
\Input{chapter-1.tex}&lt;br /&gt;
&lt;br /&gt;
\Input{  chapter-2.tex  }&lt;br /&gt;
&lt;br /&gt;
\Input{chapter-3.tex}&lt;br /&gt;
&lt;br /&gt;
\Input{chapter-4.tex}&lt;br /&gt;
&lt;br /&gt;
\Input{chapter-5.tex}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rkrug</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.luatex.org/index.php?title=T_wo_T_r:test.lua&amp;diff=3567</id>
		<title>T wo T r:test.lua</title>
		<link rel="alternate" type="text/html" href="https://wiki.luatex.org/index.php?title=T_wo_T_r:test.lua&amp;diff=3567"/>
		<updated>2021-02-22T18:37:12Z</updated>

		<summary type="html">&lt;p&gt;Rkrug: Created page with &amp;quot; &amp;lt;nowiki&amp;gt;   --- Everything is global, so that it will be available in the REPL   --- For use in REPL, not used here  util = require(&amp;quot;utils&amp;quot;)  sp_to_p  = util.sp_to_p sp_to_in...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &amp;lt;nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--- Everything is global, so that it will be available in the REPL&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--- For use in REPL, not used here&lt;br /&gt;
&lt;br /&gt;
util = require(&amp;quot;utils&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
sp_to_p  = util.sp_to_p&lt;br /&gt;
sp_to_in = util.sp_to_in&lt;br /&gt;
&lt;br /&gt;
node_type    = util.node_type&lt;br /&gt;
node_subtype = util.node_subtype&lt;br /&gt;
&lt;br /&gt;
link_nodes = util.link_nodes&lt;br /&gt;
&lt;br /&gt;
make_glyph     = util.make_glyph&lt;br /&gt;
make_glue      = util.make_glue&lt;br /&gt;
make_glue_spec = util.make_glue_spec&lt;br /&gt;
make_rule      = util.make_rule&lt;br /&gt;
make_penalty   = util.make_penalty&lt;br /&gt;
&lt;br /&gt;
fil   = util.fil&lt;br /&gt;
fill  = util.fill&lt;br /&gt;
filll = util.filll&lt;br /&gt;
&lt;br /&gt;
is_whitespace         = util.is_whitespace&lt;br /&gt;
is_linefeed           = util.is_linefeed&lt;br /&gt;
is_nobreak            = util.is_nobreak&lt;br /&gt;
is_command_terminator = util.is_command_terminator&lt;br /&gt;
&lt;br /&gt;
copy_table = util.copy_table&lt;br /&gt;
&lt;br /&gt;
read_string = util.read_string&lt;br /&gt;
read_group  = util.read_group&lt;br /&gt;
&lt;br /&gt;
walk_table = util.walk_table&lt;br /&gt;
show_node  = util.show_node&lt;br /&gt;
walk_list  = util.walk_list&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--- For use here&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
repl = require(&amp;quot;repl&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
repl = repl.repl&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
reader = require(&amp;quot;reader&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
push_reader = reader.push_reader&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
commands = require(&amp;quot;commands&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
pages = require(&amp;quot;pages&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
build_pages = pages.build_pages&lt;br /&gt;
build_page = pages.build_page&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
main = require(&amp;quot;main&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
main_loop = main.main_loop&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
format = require(&amp;quot;format&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
main_text_tbl = format.main_text_tbl&lt;br /&gt;
push_tbl      = format.push_tbl&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--- Do the job&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
function do_job()&lt;br /&gt;
  push_reader(&amp;quot;file:text.tex&amp;quot;)&lt;br /&gt;
  push_tbl(main_text_tbl)&lt;br /&gt;
  main_loop()&lt;br /&gt;
  build_pages()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
do_job()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--- Enter REPL for exploration&lt;br /&gt;
&lt;br /&gt;
--- repl()&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rkrug</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.luatex.org/index.php?title=T_wo_T_r:twotr&amp;diff=3566</id>
		<title>T wo T r:twotr</title>
		<link rel="alternate" type="text/html" href="https://wiki.luatex.org/index.php?title=T_wo_T_r:twotr&amp;diff=3566"/>
		<updated>2021-02-22T18:36:33Z</updated>

		<summary type="html">&lt;p&gt;Rkrug: /* Contents */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== About ==&lt;br /&gt;
&lt;br /&gt;
This is an update and expansion of [[TeX without TeX]] --- using TeX&amp;#039;s&lt;br /&gt;
functionality (typesetting, pdf writing) using only Lua code (no \TeX&lt;br /&gt;
macros).&lt;br /&gt;
&lt;br /&gt;
It is (I believe) an adequate framework for developing a complete&lt;br /&gt;
type-setting system; although one dedicated to a specific task, rather&lt;br /&gt;
than a general purpose system such as LaTeX or ConTeXt. It includes a&lt;br /&gt;
couple of example formatting commands (\Emph and \Bold), titles&lt;br /&gt;
(\Title), the ability to include other subsidiary text files (\Input)&lt;br /&gt;
and footnotes (\Footnote). It can be easily adapted and expanded to&lt;br /&gt;
suit your needs.&lt;br /&gt;
&lt;br /&gt;
I am not much of a programmer, and knew little about TeX and even less&lt;br /&gt;
about Lua when I started this, so there is undoubtedly much that can&lt;br /&gt;
be improved.  All questions, comments, suggestions, and corrections&lt;br /&gt;
will be appreciated. You can reach me at &amp;quot;destiny6 &amp;lt;AT&amp;gt; mac &amp;lt;DOT&amp;gt;&lt;br /&gt;
com&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Pre-requisites ==&lt;br /&gt;
&lt;br /&gt;
This system requires the luatex-plain format (from ConTeXt), so that&lt;br /&gt;
we have access to Open Type Fonts and other goodies. This is what I&lt;br /&gt;
did on my system:&lt;br /&gt;
&lt;br /&gt;
# Find the luatex-plain.tex file. On my system (with TeX-Live 2020)&lt;br /&gt;
it was at:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;code&amp;gt;&lt;br /&gt;
  /usr/local/share/texmf-dist/tex/generic/context/luatex/luatex-plain.tex&lt;br /&gt;
  &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# If you just build a format file,&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;code&amp;gt;&lt;br /&gt;
  luatex --ini /usr/local/share/texmf-dist/tex/generic/context/luatex/luatex-plain.tex&lt;br /&gt;
  &amp;lt;/code&amp;gt; &lt;br /&gt;
  &lt;br /&gt;
  you will probably get warnings about using the &amp;quot;merged&amp;quot; file, and not&lt;br /&gt;
  the more current and supported files. Delete, move, or rename this&lt;br /&gt;
  file. On my system I did:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;code&amp;gt;&lt;br /&gt;
  doas mv /usr/local/share/texmf-dist/tex/generic/context/luatex/luatex-fonts-merged.lua /usr/local/share/texmf-dist/tex/generic/context/luatex/luatex-fonts-merged.lua.bak&lt;br /&gt;
  &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Now, build the format file.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;code&amp;gt;&lt;br /&gt;
  luatex --ini /usr/local/share/texmf-dist/tex/generic/context/luatex/luatex-plain.tex&lt;br /&gt;
  &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# We are almost done. If the resulting format file (luatex-plain.fmt)&lt;br /&gt;
is in the current working directory, you can use it with something&lt;br /&gt;
like:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;code&amp;gt;&lt;br /&gt;
  luatex --fmt luatex-plain test&lt;br /&gt;
  &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# But, this is too restrictive.&lt;br /&gt;
&lt;br /&gt;
  ## Create a new executable with the name luatex-plain. Something&lt;br /&gt;
  like:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;code&amp;gt;&lt;br /&gt;
    ln -s `which luatex` /usr/local/bin/luatex-plain&lt;br /&gt;
    &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  ## When you try to invoke it:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;code&amp;gt;&lt;br /&gt;
    luatex-plain test&lt;br /&gt;
    &amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
  it will fail with a message about failing to find the proper&lt;br /&gt;
  format file. There should be a line something like:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;code&amp;gt;&lt;br /&gt;
    mktexfmt [INFO]: writing formats under ~/.texlive2020/texmf-var/web2c&lt;br /&gt;
    &amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
  so, copy the format file to that location:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;code&amp;gt;&lt;br /&gt;
    cp luatex-plain.fmt ~/.texlive2020/texmf-var/web2c/&lt;br /&gt;
    &amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
  now, this should work:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;code&amp;gt;&lt;br /&gt;
    luatex-plain test&lt;br /&gt;
    &amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
    Finally, run mtxrun to generate a fonts database: &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;code&amp;gt;&lt;br /&gt;
    mtxrun --script fonts --reload --simple&lt;br /&gt;
    &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Contents ==&lt;br /&gt;
&lt;br /&gt;
This files for this project are also available at:&lt;br /&gt;
[https://github.com/s-dismas/TeX-without-TeX-revised GitHub]&lt;br /&gt;
&lt;br /&gt;
There is a Read Eval Print Loop available for interactively exploring:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:repl.lua|repl.lua]]&lt;br /&gt;
&lt;br /&gt;
It can be invoked with &amp;lt;code&amp;gt;repl.repl()&amp;lt;code/&amp;gt;, and either&lt;br /&gt;
&amp;lt;code&amp;gt;quit()&amp;lt;code/&amp;gt; or &amp;lt;code&amp;gt;exit&amp;lt;code/&amp;gt; will exit it. I use Shell Mode in&lt;br /&gt;
Emacs, but a simple terminal or similar should also work.&lt;br /&gt;
&lt;br /&gt;
Some utilites are in the file:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:utils.lua|utils.lua]]&lt;br /&gt;
&lt;br /&gt;
The following five files comprise the system:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:reader.lua|reader.lua]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:format.lua|format.lua]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:main.lua|main.lua]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:pages.lua|pages.lua]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:commands.lua|commands.lua]]&lt;br /&gt;
&lt;br /&gt;
The license for this software can be seen at:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:LICENSE.txt| License.]]&lt;br /&gt;
&lt;br /&gt;
The TeX file to be compiled by luatex-plain is:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:test.tex|test.tex]]&lt;br /&gt;
&lt;br /&gt;
The Lua file executed by &amp;lt;code&amp;gt;\directlua{dofile &amp;quot;test.lua&amp;quot;}&amp;lt;/code&amp;gt;&lt;br /&gt;
within [[T_wo_T_r:test.tex|test.tex]] is:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:test.lua|test.lua]]&lt;br /&gt;
&lt;br /&gt;
The main text file to be typeset is:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:text.tex|text.tex]]&lt;br /&gt;
&lt;br /&gt;
It includes the following five files:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:chapter-1.tex|chapter 1]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:chapter-2.tex|chapter 2]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:chapter-3.tex|chapter 3]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:chapter-4.tex|chapter 4]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:chapter-5.tex|chapter 5]]&lt;/div&gt;</summary>
		<author><name>Rkrug</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.luatex.org/index.php?title=T_wo_T_r:test.tex&amp;diff=3565</id>
		<title>T wo T r:test.tex</title>
		<link rel="alternate" type="text/html" href="https://wiki.luatex.org/index.php?title=T_wo_T_r:test.tex&amp;diff=3565"/>
		<updated>2021-02-22T18:35:43Z</updated>

		<summary type="html">&lt;p&gt;Rkrug: Created page with &amp;quot; &amp;lt;nowiki&amp;gt;  \directlua{dofile &amp;quot;test.lua&amp;quot;} \bye  &amp;lt;/nowiki&amp;gt;&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &amp;lt;nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
\directlua{dofile &amp;quot;test.lua&amp;quot;}&lt;br /&gt;
\bye&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rkrug</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.luatex.org/index.php?title=T_wo_T_r:LICENSE.txt&amp;diff=3564</id>
		<title>T wo T r:LICENSE.txt</title>
		<link rel="alternate" type="text/html" href="https://wiki.luatex.org/index.php?title=T_wo_T_r:LICENSE.txt&amp;diff=3564"/>
		<updated>2021-02-22T18:35:00Z</updated>

		<summary type="html">&lt;p&gt;Rkrug: Created page with &amp;quot; &amp;lt;nowiki&amp;gt;  Copyright (c) 2021 Toadstone Enterprises.  -----------------------------------------------------------------  The stone must be taken out of the head alive, before...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &amp;lt;nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copyright (c) 2021 Toadstone Enterprises.&lt;br /&gt;
&lt;br /&gt;
-----------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
The stone must be taken out of the head alive, before the Toad be&lt;br /&gt;
dead, with a peece of cloth of the colour of red Skarlet,&lt;br /&gt;
where-withall the toads are much delighted, so that they stretch out&lt;br /&gt;
themselves as it were in sport upon that cloth. They cast out the&lt;br /&gt;
stone of their head, but instantly they sup it up againe, unlesse it&lt;br /&gt;
be taken from them through some secrete hole in the said cloth,&lt;br /&gt;
whereby it falleth into a cestern or vessell of water, into which the&lt;br /&gt;
Toade dareth not enter, by reason of the coldnes of the water.&lt;br /&gt;
&lt;br /&gt;
-----------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Permission to use, copy, modify, and/or distribute this software for&lt;br /&gt;
any purpose with or without fee is hereby granted, provided that the&lt;br /&gt;
above copyright notice and this permission notice appear in all&lt;br /&gt;
copies.&lt;br /&gt;
&lt;br /&gt;
THE SOFTWARE IS PROVIDED &amp;quot;AS IS&amp;quot; AND THE AUTHOR DISCLAIMS ALL&lt;br /&gt;
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED&lt;br /&gt;
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE&lt;br /&gt;
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL&lt;br /&gt;
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR&lt;br /&gt;
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER&lt;br /&gt;
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR&lt;br /&gt;
PERFORMANCE OF THIS SOFTWARE.&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rkrug</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.luatex.org/index.php?title=T_wo_T_r:commands.lua&amp;diff=3563</id>
		<title>T wo T r:commands.lua</title>
		<link rel="alternate" type="text/html" href="https://wiki.luatex.org/index.php?title=T_wo_T_r:commands.lua&amp;diff=3563"/>
		<updated>2021-02-22T18:34:15Z</updated>

		<summary type="html">&lt;p&gt;Rkrug: Created page with &amp;quot; &amp;lt;nowiki&amp;gt;   --- Copyright (c) 2021 by Toadstone Enterprises. --- ISC-type license, see License.txt for details.   -------------------------------------------------------------...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &amp;lt;nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--- Copyright (c) 2021 by Toadstone Enterprises.&lt;br /&gt;
--- ISC-type license, see License.txt for details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-----------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local util = require(&amp;quot;utils&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
local read_group            = util.read_group&lt;br /&gt;
local is_command_terminator = util.is_command_terminator&lt;br /&gt;
local is_whitespace         = util.is_whitespace&lt;br /&gt;
local node_type             = util.node_type&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local reader = require(&amp;quot;reader&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
local push_reader   = reader.push_reader&lt;br /&gt;
local pop_reader    = reader.pop_reader&lt;br /&gt;
local read_value    = reader.read_value&lt;br /&gt;
local unread_value  = reader.unread_value&lt;br /&gt;
local replace_text  = reader.replace_text&lt;br /&gt;
local pos           = reader.pos&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local format = require(&amp;quot;format&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
local update_state         = format.update_state&lt;br /&gt;
local update_locals        = format.update_locals&lt;br /&gt;
local push_tbl             = format.push_tbl&lt;br /&gt;
local pop_tbl              = format.pop_tbl&lt;br /&gt;
local top_tbl              = format.top_tbl&lt;br /&gt;
local push_do_command_stop = format.push_do_command_stop&lt;br /&gt;
local footnote_tbl         = format.footnote_tbl&lt;br /&gt;
local emph_text_font        = format.emph_text_font&lt;br /&gt;
local bold_text_font        = format.bold_text_font&lt;br /&gt;
local title_font            = format.title_font&lt;br /&gt;
local superscript_font      = format.superscript_font&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local pages = require(&amp;quot;pages&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
local process_par = pages.process_par&lt;br /&gt;
local build_par   = pages.build_par&lt;br /&gt;
local build_pages = pages.build_pages&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local main = main or require(&amp;quot;main&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
local main_loop = main.main_loop&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-----------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--- We will keep our various commands in a table, so that we&lt;br /&gt;
--- can retrieve them by name. We use a metatable to throw&lt;br /&gt;
--- a consistent error if a non-existant command is looked&lt;br /&gt;
--- for. The idea was that this would throw the error at that&lt;br /&gt;
--- time, instead of later on when we tried to use it.&lt;br /&gt;
&lt;br /&gt;
local command_table = {}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local mt = {__index = function (_, command)&lt;br /&gt;
              error(&amp;quot;Bad Command:&amp;quot; .. command)&lt;br /&gt;
            end&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
setmetatable(command_table, mt)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local register_command = function(name, func)&lt;br /&gt;
  command_table[name] = func&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-----------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local get_command = function()&lt;br /&gt;
  -- A command in initiated by a &amp;quot;\&amp;quot;, and terminated by a&lt;br /&gt;
  -- &amp;quot;[&amp;quot;, &amp;quot;{&amp;quot;, or whitespace. (But the initiating &amp;quot;\&amp;quot; has&lt;br /&gt;
  -- already been read past.) Return the command as a string.&lt;br /&gt;
  -- We also &amp;#039;eat&amp;#039; any extra following whitespace, and then&lt;br /&gt;
  -- back up by one character, so the command can see the&lt;br /&gt;
  -- terminator; although we may lose the distinction of&lt;br /&gt;
  -- which whitespace terminated the command.&lt;br /&gt;
  -- This backing up will also allow the main_loop to see&lt;br /&gt;
  -- the &amp;quot;{&amp;quot;, if there was one, and so doing the do_command_start.&lt;br /&gt;
&lt;br /&gt;
  local command = &amp;quot;&amp;quot;&lt;br /&gt;
  local value = read_value()&lt;br /&gt;
&lt;br /&gt;
  if is_command_terminator(value) then&lt;br /&gt;
    -- A one character command, consisting solely of a command terminator.&lt;br /&gt;
    command = unicode.utf8.char(value)&lt;br /&gt;
  else&lt;br /&gt;
    while (value and (not is_command_terminator(value))) do&lt;br /&gt;
      command = command .. unicode.utf8.char(value)&lt;br /&gt;
      value = read_value()&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  while is_whitespace(value) do&lt;br /&gt;
    -- eat the white&lt;br /&gt;
    value = read_value()&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  -- so command can see the &amp;#039;terminator&amp;#039;&lt;br /&gt;
  -- Note that if the command was terminated by whitespace,&lt;br /&gt;
  -- and then followed by more whitespace, we will not be&lt;br /&gt;
  -- distinguishing between the various types of whitespace.&lt;br /&gt;
  -- Does this matter?&lt;br /&gt;
  unread_value()&lt;br /&gt;
  &lt;br /&gt;
  return command&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--- WARNING: An Emph in a Footnote will result in a change of font size!&lt;br /&gt;
--- There should be some notion of a font family where given the current&lt;br /&gt;
--- font, an appropriate Emph font can be chosen. At least consider size.&lt;br /&gt;
&lt;br /&gt;
--- Emph displays most of the standard ways to do a command.&lt;br /&gt;
--- We define a function do_emph, which will then be registered.&lt;br /&gt;
&lt;br /&gt;
local do_emph = function()&lt;br /&gt;
  -- We start off with some initialization. In this case, are we&lt;br /&gt;
  -- emphasizing the following group, or are we (presumably) already&lt;br /&gt;
  -- within a group?&lt;br /&gt;
&lt;br /&gt;
  local value = read_value()&lt;br /&gt;
  unread_value{}&lt;br /&gt;
&lt;br /&gt;
  if value == unicode.utf8.byte(&amp;quot;{&amp;quot;) then&lt;br /&gt;
    -- We emphasize the following group&lt;br /&gt;
&lt;br /&gt;
    -- We now finish the initialization in this branch of the&lt;br /&gt;
    -- if statement.&lt;br /&gt;
    &lt;br /&gt;
    -- We push the current table, to that we can restore it&lt;br /&gt;
    -- at the end, namely in the do_command_stop.&lt;br /&gt;
    push_tbl(copy_table(top_tbl()))&lt;br /&gt;
    &lt;br /&gt;
    -- We have finished the initialization, so we define a&lt;br /&gt;
    -- do_command_start function to be executed upon encountering&lt;br /&gt;
    -- the &amp;quot;{&amp;quot;&lt;br /&gt;
    local do_command_start = function()&lt;br /&gt;
                               -- Switch over to the Emph font.&lt;br /&gt;
                               local tbl = top_tbl()&lt;br /&gt;
                               tbl.font = emph_text_font&lt;br /&gt;
                             end&lt;br /&gt;
 &lt;br /&gt;
    -- We then put this function into the proper place in State.&lt;br /&gt;
    State.do_command_start = do_command_start&lt;br /&gt;
    &lt;br /&gt;
    -- We also define a do_command_stop function, to be executed&lt;br /&gt;
    -- upon encountering the terminating &amp;quot;}&amp;quot;.&lt;br /&gt;
    local do_command_stop  = function()&lt;br /&gt;
                               -- Pop the table, to return to the&lt;br /&gt;
                               -- previous situation.&lt;br /&gt;
                               pop_tbl()&lt;br /&gt;
                             end&lt;br /&gt;
    -- We then put this function into the proper place in State.&lt;br /&gt;
    push_do_command_stop(do_command_stop)&lt;br /&gt;
&lt;br /&gt;
  else&lt;br /&gt;
    -- Emphasize all the following text (presumably within a group)&lt;br /&gt;
    -- This change of font will get reset when the group is exited,&lt;br /&gt;
    -- since State.tbl has been copied and pushed upon entrance into&lt;br /&gt;
    -- the group.&lt;br /&gt;
    local tbl = top_tbl()&lt;br /&gt;
    tbl.font = emph_text_font&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
register_command(&amp;quot;Emph&amp;quot;, do_emph)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local do_bold = function()&lt;br /&gt;
  local value = read_value()&lt;br /&gt;
  unread_value{}&lt;br /&gt;
&lt;br /&gt;
  if value == unicode.utf8.byte(&amp;quot;{&amp;quot;) then&lt;br /&gt;
    push_tbl(copy_table(top_tbl()))&lt;br /&gt;
    local do_command_start = function()&lt;br /&gt;
                               local tbl = top_tbl()&lt;br /&gt;
                               tbl.font = bold_text_font&lt;br /&gt;
                             end&lt;br /&gt;
    State.do_command_start = do_command_start&lt;br /&gt;
    local do_command_stop  = function()&lt;br /&gt;
                               pop_tbl()&lt;br /&gt;
                             end&lt;br /&gt;
    push_do_command_stop(do_command_stop)&lt;br /&gt;
  else&lt;br /&gt;
    local tbl = top_tbl()&lt;br /&gt;
    tbl.font = bold_text_font&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
register_command(&amp;quot;Bold&amp;quot;, do_bold)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local do_input = function()&lt;br /&gt;
  -- Input a file.&lt;br /&gt;
&lt;br /&gt;
  local filename&lt;br /&gt;
&lt;br /&gt;
  local do_command_start = function()&lt;br /&gt;
                             -- so that the following read_group will see the opening &amp;quot;{&amp;quot;&lt;br /&gt;
                             unread_value()&lt;br /&gt;
                             -- Note that with the argument true to read_group&lt;br /&gt;
                             -- Input{filename}&lt;br /&gt;
                             -- Input  {  filename  }&lt;br /&gt;
                             -- Input{file name}&lt;br /&gt;
                             -- wil all read &amp;quot;filename&amp;quot;&lt;br /&gt;
                             -- Do we want this? The second seems useful, the&lt;br /&gt;
                             -- third does not.&lt;br /&gt;
                             filename = read_group(true)&lt;br /&gt;
                             -- So that main_loop will see the closing &amp;quot;}&amp;quot;&lt;br /&gt;
                             -- and call do_command_stop.&lt;br /&gt;
                             unread_value()&lt;br /&gt;
                           end&lt;br /&gt;
  State.do_command_start = do_command_start&lt;br /&gt;
  local do_command_stop = function()&lt;br /&gt;
                            -- We could have done all this above.&lt;br /&gt;
                            -- Now read in the file&lt;br /&gt;
                            push_reader(&amp;quot;file:&amp;quot; .. filename)&lt;br /&gt;
                            -- Recursively call main_loop to typeset the&lt;br /&gt;
                            -- material we have read in. At the end of the&lt;br /&gt;
                            -- files contents, main_loop will terminate,&lt;br /&gt;
                            -- and execution will resume with the call to&lt;br /&gt;
                            -- pop_reader below.&lt;br /&gt;
                            -- Why do I need to qualify this?&lt;br /&gt;
                            main.main_loop()&lt;br /&gt;
                            -- Back to the original reader.&lt;br /&gt;
                            pop_reader()&lt;br /&gt;
                            -- And we now build the pages. We could probably&lt;br /&gt;
                            -- just leave the material there, but I am&lt;br /&gt;
                            -- envisioning each of these input files to&lt;br /&gt;
                            -- represent a chapter, to be typeset as their&lt;br /&gt;
                            -- own set of pages.&lt;br /&gt;
                            build_pages()&lt;br /&gt;
                          end&lt;br /&gt;
 push_do_command_stop(do_command_stop)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
register_command(&amp;quot;Input&amp;quot;, do_input)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local do_fix = function()&lt;br /&gt;
  -- If one is transcribing a document, one may wish to correct&lt;br /&gt;
  -- typos. Three args - {&amp;lt;old&amp;gt;}{&amp;lt;new&amp;gt;}{&amp;lt;reason&amp;gt;}&lt;br /&gt;
  -- Perhaps not too useful in general, but a nice demonstration&lt;br /&gt;
  -- piece.&lt;br /&gt;
&lt;br /&gt;
  -- Read the three groups, and insert the new text.&lt;br /&gt;
  local start  = pos()&lt;br /&gt;
  local old    = read_group(false)&lt;br /&gt;
  local new    = read_group(false)&lt;br /&gt;
  local reason = read_group(false)&lt;br /&gt;
  local stop   = pos()&lt;br /&gt;
  replace_text(new, start, stop-1)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
register_command(&amp;quot;Fix&amp;quot;, do_fix)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local do_nb_space = function()&lt;br /&gt;
  -- Non breaking space. Note that we may have eaten any&lt;br /&gt;
  -- extra following white space, so the char at pos() may not&lt;br /&gt;
  -- be the original space.&lt;br /&gt;
  local cur_pos = pos()&lt;br /&gt;
  replace_text(unicode.utf8.char(0x00A0), cur_pos -2, cur_pos -1)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
register_command(&amp;quot; &amp;quot;, do_nb_space)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--- QUESTION: Why, unlike in Footnote, do we not need to save the&lt;br /&gt;
--- current head and tail? Why do we set them to nil when we return&lt;br /&gt;
--- in do_command_stop?&lt;br /&gt;
&lt;br /&gt;
local do_title = function()&lt;br /&gt;
  local value = read_value()&lt;br /&gt;
  if value == unicode.utf8.byte(&amp;quot;[&amp;quot;) then&lt;br /&gt;
    -- We use the contents of this optional argument to set the&lt;br /&gt;
    -- text of the header.&lt;br /&gt;
    unread_value()&lt;br /&gt;
    local args = read_group(false)&lt;br /&gt;
    -- Set the text of the header.&lt;br /&gt;
    State.header_text = args&lt;br /&gt;
  else&lt;br /&gt;
    -- So that the opening &amp;quot;{&amp;quot; will be seen.&lt;br /&gt;
    unread_value()&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  local old_baselineskip = tex.baselineskip&lt;br /&gt;
  push_tbl(copy_table(top_tbl()))  &lt;br /&gt;
&lt;br /&gt;
  local do_command_start = function()&lt;br /&gt;
                             -- Set the new font and baselineskip&lt;br /&gt;
                             tex.baselineskip   = make_glue_spec(tex.sp(&amp;quot;25pt&amp;quot;))&lt;br /&gt;
                             -- Add a title_tbl in format.lua?&lt;br /&gt;
                             local tbl = top_tbl()&lt;br /&gt;
                             tbl.font      = title_font&lt;br /&gt;
&lt;br /&gt;
                             tbl.parindent = tex.sp(&amp;quot;0pt&amp;quot;)&lt;br /&gt;
                             tbl.leftskip  = filll()&lt;br /&gt;
                             tbl.rightskip = filll()&lt;br /&gt;
                           end&lt;br /&gt;
  State.do_command_start = do_command_start&lt;br /&gt;
  local do_command_stop = function()&lt;br /&gt;
                            -- We have now read the title, so force&lt;br /&gt;
                            -- building a paragraph&lt;br /&gt;
                            local head, tail, _, _ = update_locals()&lt;br /&gt;
                            local par = build_par(head, tail)&lt;br /&gt;
                            process_par(par)&lt;br /&gt;
                            -- Insert the (vertical) space after the title.&lt;br /&gt;
                            local title_sep = make_glue(&amp;quot;userskip&amp;quot;, tex.sp(&amp;quot;0.25in&amp;quot;))&lt;br /&gt;
                            process_par(title_sep)&lt;br /&gt;
                            -- Reset various variables&lt;br /&gt;
                            update_state(nil, nil, false, false)&lt;br /&gt;
                            tex.baselineskip   = old_baselineskip&lt;br /&gt;
                            pop_tbl()&lt;br /&gt;
&lt;br /&gt;
                            -- New chapter started&lt;br /&gt;
                            State.first_paragraph_of_chapter = true&lt;br /&gt;
                            State.first_page_of_chapter      = true&lt;br /&gt;
                            State.notes     = {}&lt;br /&gt;
                            State.max_notes = 0&lt;br /&gt;
                          end&lt;br /&gt;
  push_do_command_stop(do_command_stop)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
register_command(&amp;quot;Title&amp;quot;, do_title)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local do_footnote = function()&lt;br /&gt;
&lt;br /&gt;
  -- See the QUESTION: before do_title.&lt;br /&gt;
  local old_head, old_tail, _, _ = update_locals()&lt;br /&gt;
  local old_baselineskip = tex.baselineskip&lt;br /&gt;
  State.max_notes = State.max_notes + 1&lt;br /&gt;
&lt;br /&gt;
  local do_command_start = function()&lt;br /&gt;
                             -- We want to mark the first preceding glyph&lt;br /&gt;
                             -- node with the Footnote marker.&lt;br /&gt;
                             local to_be_marked = old_tail&lt;br /&gt;
                             -- Search backward&lt;br /&gt;
                             while (node_type(to_be_marked) ~= &amp;quot;glyph&amp;quot;) do&lt;br /&gt;
                               to_be_marked = to_be_marked.prev&lt;br /&gt;
                             end&lt;br /&gt;
                             -- Naked glyphs cannot go into a vlist:&lt;br /&gt;
                             local marker = node.hpack(make_glyph(unicode.utf8.byte(tostring(State.max_notes)),&lt;br /&gt;
                                                       superscript_font,&lt;br /&gt;
                                                       1, 3, 3))&lt;br /&gt;
                             -- Some glue to raise the mark&lt;br /&gt;
                             local marker_glue = make_glue(0, tex.sp(&amp;quot;5pt&amp;quot;))&lt;br /&gt;
                             link_nodes(marker, marker_glue)&lt;br /&gt;
                             -- vpack, so that the glue is on the bottom,&lt;br /&gt;
                             -- not the left.&lt;br /&gt;
                             local packed = node.vpack(marker)&lt;br /&gt;
                             -- Link things back up.&lt;br /&gt;
                             if (to_be_marked == old_tail) then&lt;br /&gt;
                               link_nodes(to_be_marked, packed)&lt;br /&gt;
                               old_tail = packed&lt;br /&gt;
                             else&lt;br /&gt;
                               link_nodes(to_be_marked, packed, to_be_marked.next)&lt;br /&gt;
                             end&lt;br /&gt;
                             -- Add attribute to to_be_marked, so that we can&lt;br /&gt;
                             -- see it while building the page, and get the&lt;br /&gt;
                             -- note.&lt;br /&gt;
                             node.set_attribute(to_be_marked, 444, State.max_notes)&lt;br /&gt;
                             &lt;br /&gt;
                             -- Now, set up the first glyph of the footnote&lt;br /&gt;
                             -- to also receive the footnote mark. Here we need&lt;br /&gt;
                             -- to search forward using the reader.&lt;br /&gt;
                             local pos = pos()&lt;br /&gt;
                             local value = read_value()&lt;br /&gt;
                             -- We make the (possibly false) assumption that&lt;br /&gt;
                             -- the footnote starts with a glyph. There should&lt;br /&gt;
                             -- be some way to identify glyphs. What if the&lt;br /&gt;
                             -- footnote started with an Emph?&lt;br /&gt;
                             replace_text(&amp;quot;\\Mark{&amp;quot; .. unicode.utf8.char(value) .. &amp;quot;}&amp;quot;, pos, pos)&lt;br /&gt;
                             &lt;br /&gt;
                             -- Switch to footnote mode, and call main_loop&lt;br /&gt;
                             -- to typeset the footnote.&lt;br /&gt;
                             State.mode = &amp;quot;footnote&amp;quot;&lt;br /&gt;
                             update_state(nil, nil, false, false)&lt;br /&gt;
                             push_tbl(footnote_tbl)&lt;br /&gt;
                             main.main_loop()&lt;br /&gt;
                           end&lt;br /&gt;
  State.do_command_start = do_command_start&lt;br /&gt;
  local do_command_stop = function()&lt;br /&gt;
                            -- We now build the (final) paragraph of the&lt;br /&gt;
                            -- footnote and process it (put it in&lt;br /&gt;
                            -- State.notes[max_notes]). Note that if the&lt;br /&gt;
                            -- footnote contains multiple paragraphs, the&lt;br /&gt;
                            -- earlier ones have already been processed.&lt;br /&gt;
                            -- Note also that, unlike with Input, where&lt;br /&gt;
                            -- main_loop will terminate on eol, and so&lt;br /&gt;
                            -- build_par, process_par, and build_pages,&lt;br /&gt;
                            -- we have to do some of this now.&lt;br /&gt;
                            local head, tail, _, _ = update_locals()&lt;br /&gt;
                            tex.baselineskip = make_glue_spec(tex.sp(&amp;quot;12pt&amp;quot;))&lt;br /&gt;
                            local par = build_par(head, tail)&lt;br /&gt;
                            process_par(par)&lt;br /&gt;
                            tex.baselineskip = old_baselineskip&lt;br /&gt;
                            -- and restore the previous mode, head, and tail.&lt;br /&gt;
                            pop_tbl()&lt;br /&gt;
                            State.mode = &amp;quot;main_text&amp;quot;&lt;br /&gt;
                            update_state(old_head, old_tail, false, false)&lt;br /&gt;
                          end&lt;br /&gt;
  push_do_command_stop(do_command_stop)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
register_command(&amp;quot;Footnote&amp;quot;, do_footnote)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local do_mark = function()&lt;br /&gt;
&lt;br /&gt;
  -- Even though we do nothing in do_command_start, we&lt;br /&gt;
  -- must define it, so that upon seeing the &amp;quot;{&amp;quot; main_loop&lt;br /&gt;
  -- will know that we are starting a command, and not&lt;br /&gt;
  -- entering a new group.&lt;br /&gt;
  local do_command_start = function()&lt;br /&gt;
                           end&lt;br /&gt;
  State.do_command_start = do_command_start&lt;br /&gt;
  local do_command_stop  = function()&lt;br /&gt;
                             local head, tail, _, _ = update_locals()&lt;br /&gt;
                             -- We should have just read the single chararcter&lt;br /&gt;
                             -- at the start of the footnote. Therefore head&lt;br /&gt;
                             -- and tail should be the same. Check this.&lt;br /&gt;
                             assert((head == tail), &amp;quot;Head and tail are not the same.&amp;quot;)&lt;br /&gt;
                             -- add the mark as in Footnote.&lt;br /&gt;
                             local marker = node.hpack(make_glyph(unicode.utf8.byte(tostring(State.max_notes)),&lt;br /&gt;
                                                         superscript_font,&lt;br /&gt;
                                                         1, 3, 3))&lt;br /&gt;
                             local marker_glue = make_glue(0, tex.sp(&amp;quot;5pt&amp;quot;))&lt;br /&gt;
                             link_nodes(marker, marker_glue)&lt;br /&gt;
                             local packed = node.vpack(marker)&lt;br /&gt;
                             link_nodes(packed, head)&lt;br /&gt;
                             update_state(packed, tail, false, false)&lt;br /&gt;
                           end&lt;br /&gt;
  push_do_command_stop(do_command_stop)&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
register_command(&amp;quot;Mark&amp;quot;, do_mark)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local initialize_command = function(command)&lt;br /&gt;
  return command_table[command]()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local commands = {get_command        = get_command,&lt;br /&gt;
                  initialize_command = initialize_command,&lt;br /&gt;
                  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
return commands&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rkrug</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.luatex.org/index.php?title=T_wo_T_r:pages.lua&amp;diff=3562</id>
		<title>T wo T r:pages.lua</title>
		<link rel="alternate" type="text/html" href="https://wiki.luatex.org/index.php?title=T_wo_T_r:pages.lua&amp;diff=3562"/>
		<updated>2021-02-22T18:33:27Z</updated>

		<summary type="html">&lt;p&gt;Rkrug: Created page with &amp;quot; &amp;lt;nowiki&amp;gt;   --- Copyright (c) 2021 by Toadstone Enterprises. --- ISC-type license, see License.txt for details.   -------------------------------------------------------------...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &amp;lt;nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--- Copyright (c) 2021 by Toadstone Enterprises.&lt;br /&gt;
--- ISC-type license, see License.txt for details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-----------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local util = require(&amp;quot;utils&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
local node_type        = util.node_type&lt;br /&gt;
local link_nodes       = util.link_nodes&lt;br /&gt;
local make_glue        = util.make_glue&lt;br /&gt;
local make_rule        = util.make_rule&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local format = require(&amp;quot;format&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
local text_height   = format.text_height&lt;br /&gt;
&lt;br /&gt;
local top_margin    = format.top_margin&lt;br /&gt;
local left_margin   = format.left_margin&lt;br /&gt;
&lt;br /&gt;
local header_height = format.header_height&lt;br /&gt;
local header_sep    = format.header_sep&lt;br /&gt;
&lt;br /&gt;
local footer_height = format.footer_height&lt;br /&gt;
local footer_sep    = format.footer_sep&lt;br /&gt;
&lt;br /&gt;
local page_number   = format.page_number&lt;br /&gt;
&lt;br /&gt;
local header_tbl    = format.header_tbl&lt;br /&gt;
local footer_tbl    = format.footer_tbl&lt;br /&gt;
local push_tbl      = format.push_tbl&lt;br /&gt;
local pop_tbl       = format.pop_tbl&lt;br /&gt;
local top_tbl       = format.top_tbl&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local reader = require(&amp;quot;reader&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
local push_reader = reader.push_reader&lt;br /&gt;
local pop_reader  = reader.pop_reader&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local main = main or require(&amp;quot;main&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
local main_loop = main.main_loop&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-----------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local par_height = function(par)&lt;br /&gt;
  -- But can really be used on any list of lines including&lt;br /&gt;
  -- multiple paragraphs.&lt;br /&gt;
  local height = 0&lt;br /&gt;
  while par do&lt;br /&gt;
    if (node_type(par) == &amp;quot;hlist&amp;quot;) then&lt;br /&gt;
      height = height + par.height + par.depth&lt;br /&gt;
    elseif (node_type(par) == &amp;quot;glue&amp;quot;) then&lt;br /&gt;
      height = height + par.width&lt;br /&gt;
    else&lt;br /&gt;
      -- A penalty has zero height, but what else might we find?&lt;br /&gt;
      assert((node_type(par) == &amp;quot;penalty&amp;quot;), &amp;quot;Found a: &amp;quot; .. node_type(par))&lt;br /&gt;
    end&lt;br /&gt;
    par = par.next&lt;br /&gt;
  end&lt;br /&gt;
  return height&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local build_par = function(head, tail)&lt;br /&gt;
  -- We have a linked list of nodes, starting with head, and ending&lt;br /&gt;
  -- with tail. We insert the initial parindent and final penalty&lt;br /&gt;
  -- and parfillskip.&lt;br /&gt;
&lt;br /&gt;
  local tbl = top_tbl()&lt;br /&gt;
&lt;br /&gt;
  local n&lt;br /&gt;
  if State.first_paragraph_of_chapter then&lt;br /&gt;
    -- This is the first paragraph after a title. Do not indent.&lt;br /&gt;
    n = make_glue(0, 0)&lt;br /&gt;
    State.first_paragraph_of_chapter = false&lt;br /&gt;
  else&lt;br /&gt;
    --indent.&lt;br /&gt;
    n = make_glue(0,&lt;br /&gt;
                  tbl.parindent or tex.parindent)&lt;br /&gt;
  end&lt;br /&gt;
  link_nodes(n, head)&lt;br /&gt;
  head = n&lt;br /&gt;
&lt;br /&gt;
  local penalty = node.new(&amp;quot;penalty&amp;quot;)&lt;br /&gt;
  penalty.penalty = 10000&lt;br /&gt;
&lt;br /&gt;
  local parfillskip = make_glue(&amp;quot;parfillskip&amp;quot;,&lt;br /&gt;
                                0,&lt;br /&gt;
                                tbl.parfillskipstretch  or 2^16, 0,&lt;br /&gt;
                                tbl.parfillskipstretch_order or 2, 0)&lt;br /&gt;
&lt;br /&gt;
  link_nodes(tail, penalty, parfillskip)&lt;br /&gt;
&lt;br /&gt;
  -- hyphenate, kern, and ligature&lt;br /&gt;
  lang.hyphenate(head)&lt;br /&gt;
  -- With otf fonts, use this rather than kern and ligature.&lt;br /&gt;
  nodes.simple_font_handler(head)&lt;br /&gt;
&lt;br /&gt;
  -- and make the paragraph.&lt;br /&gt;
  local par = tex.linebreak(head, tbl)&lt;br /&gt;
&lt;br /&gt;
  return par&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local process_par = function(par)&lt;br /&gt;
  -- Move par to the appropriate place, based on State.mode&lt;br /&gt;
  &lt;br /&gt;
  -- If we want to build pages as we go, instead of in batches,&lt;br /&gt;
  -- we can call the page builder from in here.&lt;br /&gt;
&lt;br /&gt;
  local a_par_is_already_there&lt;br /&gt;
  if (State.mode == &amp;quot;main_text&amp;quot;) then&lt;br /&gt;
    a_par_is_already_there = State.main&lt;br /&gt;
  elseif (State.mode == &amp;quot;header&amp;quot;) then&lt;br /&gt;
    a_par_is_already_there = State.header&lt;br /&gt;
  elseif (State.mode == &amp;quot;footer&amp;quot;) then&lt;br /&gt;
    a_par_is_already_there = State.footer&lt;br /&gt;
  elseif (State.mode == &amp;quot;footnote&amp;quot;) then&lt;br /&gt;
    a_par_is_already_there = State.notes[State.max_notes]&lt;br /&gt;
  else&lt;br /&gt;
    assert(false, &amp;quot;Invalid mode seen in process_par&amp;quot;)&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  if a_par_is_already_there then&lt;br /&gt;
  &lt;br /&gt;
    -- at least one paragraph has already been processed, so we link&lt;br /&gt;
    -- the new par to the old one.&lt;br /&gt;
    local tail = node.tail(a_par_is_already_there)&lt;br /&gt;
    if ((node_type(tail) == &amp;quot;hlist&amp;quot;) and&lt;br /&gt;
        (node_type(par)  == &amp;quot;hlist&amp;quot;)) then&lt;br /&gt;
      -- add tex.baselineskip&lt;br /&gt;
      local glue_needed = tex.baselineskip.width - (par.height + tail.depth)&lt;br /&gt;
      local n = make_glue(&amp;quot;baselineskip&amp;quot;,&lt;br /&gt;
                          glue_needed)&lt;br /&gt;
      link_nodes(tail, n, par)&lt;br /&gt;
    else&lt;br /&gt;
      -- tail or par is glue?&lt;br /&gt;
      assert(((node_type(tail) == &amp;quot;glue&amp;quot;) or&lt;br /&gt;
              (node_type(par)  == &amp;quot;glue&amp;quot;)), &amp;quot;Not glue!&amp;quot;)&lt;br /&gt;
      -- We assume that this glue is enough.&lt;br /&gt;
      link_nodes(tail, par)&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
  else&lt;br /&gt;
&lt;br /&gt;
    -- This is the first par, so we just put it where it belongs.&lt;br /&gt;
    if (State.mode == &amp;quot;main_text&amp;quot;) then&lt;br /&gt;
      State.main = par&lt;br /&gt;
    elseif (State.mode == &amp;quot;header&amp;quot;) then&lt;br /&gt;
      State.header = par&lt;br /&gt;
    elseif (State.mode == &amp;quot;footer&amp;quot;) then&lt;br /&gt;
      State.footer = par&lt;br /&gt;
    elseif (State.mode == &amp;quot;footnote&amp;quot;) then&lt;br /&gt;
      State.notes[State.max_notes] = par&lt;br /&gt;
    else&lt;br /&gt;
      assert(false, &amp;quot;Invalid mode seen in process_par&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local pop_line = function()&lt;br /&gt;
  -- Pop the top line from State.main.&lt;br /&gt;
  -- This is used by build_page to incrementally build a page.&lt;br /&gt;
&lt;br /&gt;
  if State.main then&lt;br /&gt;
    local line = State.main&lt;br /&gt;
    State.main = State.main.next&lt;br /&gt;
    if State.main then&lt;br /&gt;
      State.main.prev = nil&lt;br /&gt;
    end&lt;br /&gt;
    line.next = nil&lt;br /&gt;
    return line&lt;br /&gt;
  else&lt;br /&gt;
    return nil&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local return_line = function(line)&lt;br /&gt;
  -- Return a (previously popped) line to State.main&lt;br /&gt;
&lt;br /&gt;
  line.next = State.main&lt;br /&gt;
  if State.main then&lt;br /&gt;
    State.main.prev = line&lt;br /&gt;
  end&lt;br /&gt;
  State.main = line&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-----------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--- Now, on to build_page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local make_header = function()&lt;br /&gt;
  -- Make the header&lt;br /&gt;
&lt;br /&gt;
  -- The text of our header.&lt;br /&gt;
  -- When we call main_loop, this will be the reader used.&lt;br /&gt;
  if State.header_text then&lt;br /&gt;
    push_reader(State.header_text)&lt;br /&gt;
  else&lt;br /&gt;
    push_reader(&amp;quot;Header&amp;quot;)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  -- This is the tbl that will be used by main_loop.&lt;br /&gt;
  push_tbl(header_tbl)&lt;br /&gt;
  local old_mode = State.mode&lt;br /&gt;
  State.mode = &amp;quot;header&amp;quot;&lt;br /&gt;
  -- Now we do the work.&lt;br /&gt;
  -- When pages and main became mutually dependant, I had to&lt;br /&gt;
  -- prefix main_loop with the package name. Otherwise:&lt;br /&gt;
  -- attempt to call a nil value (upvalue &amp;#039;main_loop&amp;#039;)&lt;br /&gt;
  -- Similarly in make_footer.&lt;br /&gt;
  -- Why is this?&lt;br /&gt;
  main.main_loop()&lt;br /&gt;
  State.mode = old_mode&lt;br /&gt;
&lt;br /&gt;
  -- Restore the old reader and tbl.&lt;br /&gt;
  pop_reader()&lt;br /&gt;
  pop_tbl()&lt;br /&gt;
&lt;br /&gt;
  -- We assume that the header is only one line&lt;br /&gt;
  local line = State.header&lt;br /&gt;
  State.header = nil&lt;br /&gt;
  assert((line.next == nil), &amp;quot;Header is not just one line.&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
  -- We center the header (vertically) in its header_height box&lt;br /&gt;
  local needed_height  = header_height - line.height&lt;br /&gt;
  local top_glue       = make_glue(0, needed_height / 2)&lt;br /&gt;
  local bot_glue       = make_glue(0, needed_height / 2)&lt;br /&gt;
&lt;br /&gt;
  -- Add a rule&lt;br /&gt;
  local header_rule = make_rule(&amp;quot;normal&amp;quot;, text_width, tex.sp(&amp;quot;1pt&amp;quot;))&lt;br /&gt;
  header_rule_box   = node.hpack(header_rule)  -- Must hpack. Why?&lt;br /&gt;
&lt;br /&gt;
  -- centered (vertically) in its header_sep height box&lt;br /&gt;
  local top_sep_glue = make_glue(0, (header_sep - tex.sp(&amp;quot;1pt&amp;quot;) / 2))&lt;br /&gt;
  local bot_sep_glue = make_glue(0, (header_sep - tex.sp(&amp;quot;1pt&amp;quot;) / 2))&lt;br /&gt;
&lt;br /&gt;
  -- link it al together&lt;br /&gt;
  link_nodes(top_glue, line, bot_glue,&lt;br /&gt;
             top_sep_glue, header_rule_box, bot_sep_glue)&lt;br /&gt;
&lt;br /&gt;
  -- and package it up in a vbox&lt;br /&gt;
  local header = node.vpack(top_glue)&lt;br /&gt;
&lt;br /&gt;
  return header&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local make_footer = function()&lt;br /&gt;
&lt;br /&gt;
  -- the text of our footer&lt;br /&gt;
  push_reader(tostring(page_number))&lt;br /&gt;
&lt;br /&gt;
  push_tbl(footer_tbl)&lt;br /&gt;
  &lt;br /&gt;
  local old_mode = State.mode&lt;br /&gt;
  State.mode = &amp;quot;footer&amp;quot;&lt;br /&gt;
  main.main_loop()&lt;br /&gt;
  State.mode = old_mode&lt;br /&gt;
&lt;br /&gt;
  pop_reader()&lt;br /&gt;
  pop_tbl()&lt;br /&gt;
&lt;br /&gt;
  local line = State.footer&lt;br /&gt;
  State.footer = nil&lt;br /&gt;
  assert((line.next == nil), &amp;quot;Footer is not just one line.&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
  local needed_height  = footer_height - line.height&lt;br /&gt;
  local foot_glue      = make_glue(0, needed_height)&lt;br /&gt;
&lt;br /&gt;
  local sep_glue = make_glue(0, footer_sep)&lt;br /&gt;
&lt;br /&gt;
  link_nodes(sep_glue, foot_glue, line)&lt;br /&gt;
  &lt;br /&gt;
  local footer = node.vpack(foot_glue)&lt;br /&gt;
&lt;br /&gt;
  return footer&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local build_page_step_one = function(line)&lt;br /&gt;
  -- 1) get the main text from main_text, a line at a time until&lt;br /&gt;
  --    we either run out of lines or text_height.&lt;br /&gt;
&lt;br /&gt;
  local head = line&lt;br /&gt;
  local tail = line&lt;br /&gt;
  local note = nil&lt;br /&gt;
  local notes = nil&lt;br /&gt;
  local current_height = 0   &lt;br /&gt;
  while ((current_height &amp;lt; text_height) and line) do&lt;br /&gt;
&lt;br /&gt;
    if node_type(line) == &amp;quot;hlist&amp;quot; then&lt;br /&gt;
      -- See if this line has an associated footnote.&lt;br /&gt;
      local v, _ = node.find_attribute(line.head, 444)&lt;br /&gt;
      if v then&lt;br /&gt;
        -- Get the note, and account for its height.&lt;br /&gt;
        note = State.notes[v]&lt;br /&gt;
        local extra = par_height(note)&lt;br /&gt;
        if notes then&lt;br /&gt;
          -- The separation between notes.&lt;br /&gt;
          extra = extra + tex.sp(&amp;quot;4pt&amp;quot;)&lt;br /&gt;
        else&lt;br /&gt;
          -- The separation before the first note.&lt;br /&gt;
          extra = extra + tex.sp(&amp;quot;8pt&amp;quot;)&lt;br /&gt;
        end&lt;br /&gt;
        -- Does the line still fit on the page?&lt;br /&gt;
        if (current_height + line.height + line.depth + extra) &amp;lt; text_height then&lt;br /&gt;
          -- Add the line to the end of the text.&lt;br /&gt;
          link_nodes(tail, line)&lt;br /&gt;
          tail = line&lt;br /&gt;
          current_height = (current_height + line.height + line.depth + par_height(note))&lt;br /&gt;
          if notes then&lt;br /&gt;
            -- Add the note to the notes.&lt;br /&gt;
            local n = make_glue(0, tex.sp(&amp;quot;4pt&amp;quot;))&lt;br /&gt;
            link_nodes(node.tail(notes), n, note)&lt;br /&gt;
          else&lt;br /&gt;
            -- This is the first note.&lt;br /&gt;
            notes = note&lt;br /&gt;
          end&lt;br /&gt;
        else&lt;br /&gt;
          -- The line plus the note do not fit on the page.&lt;br /&gt;
          return_line(line, main_text)&lt;br /&gt;
          return current_height, head, tail, notes&lt;br /&gt;
        end&lt;br /&gt;
      elseif (current_height + line.height + line.depth) &amp;lt; text_height then&lt;br /&gt;
        -- We have a line without a note, that fits on the page.&lt;br /&gt;
        link_nodes(tail, line)&lt;br /&gt;
        tail = line&lt;br /&gt;
        current_height = (current_height + line.height + line.depth)&lt;br /&gt;
      else&lt;br /&gt;
        -- The line does not fit on the page.&lt;br /&gt;
        return_line(line, main_text)&lt;br /&gt;
        return current_height, head, tail, notes&lt;br /&gt;
      end&lt;br /&gt;
    elseif node_type(line) == &amp;quot;glue&amp;quot; then&lt;br /&gt;
      -- line is glue, not an hlist.&lt;br /&gt;
      if (current_height + line.width) &amp;lt; text_height then&lt;br /&gt;
        -- line fits on the page.&lt;br /&gt;
        link_nodes(tail, line)&lt;br /&gt;
        tail = line&lt;br /&gt;
        current_height = current_height + line.width&lt;br /&gt;
      else&lt;br /&gt;
        -- line does not fit on the page.&lt;br /&gt;
        return_line(line, main_text)&lt;br /&gt;
        return current_height, head, tail, notes&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      -- line is neither an hlist nor glue.&lt;br /&gt;
      assert((node_type(line) == &amp;quot;penalty&amp;quot;), &amp;quot;Threw away a non-penalty: &amp;quot; .. node_type(line))&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    -- Get the next line, and go to the top of the while loop&lt;br /&gt;
    line = pop_line()&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
  return current_height, head, tail, notes&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local build_page_step_four = function(text_box, notes, header_box, footer_box)&lt;br /&gt;
  -- 4) put it all together&lt;br /&gt;
  &lt;br /&gt;
  local top_margin_glue = make_glue(0, top_margin)&lt;br /&gt;
&lt;br /&gt;
  if State.first_page_of_chapter then&lt;br /&gt;
    -- No header&lt;br /&gt;
    if notes then&lt;br /&gt;
      local n = make_glue(0, tex.sp(&amp;quot;8pt&amp;quot;))&lt;br /&gt;
      link_nodes(top_margin_glue, text_box, n, notes)&lt;br /&gt;
    else&lt;br /&gt;
      link_nodes(top_margin_glue, text_box)&lt;br /&gt;
    end&lt;br /&gt;
    State.first_page_of_chapter = false&lt;br /&gt;
  else&lt;br /&gt;
    -- Include a header&lt;br /&gt;
    if notes then&lt;br /&gt;
      local n = make_glue(0, tex.sp(&amp;quot;8pt&amp;quot;))&lt;br /&gt;
      link_nodes(top_margin_glue, header_box, text_box, n, notes, footer_box)&lt;br /&gt;
    else&lt;br /&gt;
      link_nodes(top_margin_glue, header_box, text_box, footer_box)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  -- 4a) Finish the assembly of the page, and ship it out.&lt;br /&gt;
  &lt;br /&gt;
  local main_box = node.vpack(top_margin_glue)&lt;br /&gt;
&lt;br /&gt;
  local left_margin_glue = make_glue(0, left_margin)&lt;br /&gt;
&lt;br /&gt;
  link_nodes(left_margin_glue, main_box)&lt;br /&gt;
&lt;br /&gt;
  local page_box = node.hpack(left_margin_glue)&lt;br /&gt;
&lt;br /&gt;
  tex.setbox(666, page_box)&lt;br /&gt;
&lt;br /&gt;
  tex.shipout(666)&lt;br /&gt;
&lt;br /&gt;
  -- Increment the page counters, both tex&amp;#039;s and ours.&lt;br /&gt;
  tex.count[0] = tex.count[0] + 1&lt;br /&gt;
  page_number = page_number + 1&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local build_page = function()&lt;br /&gt;
  -- Build a page by:&lt;br /&gt;
  -- 1) get the main text from main_text, a line at a time until&lt;br /&gt;
  --    we either run out of lines or text_height.&lt;br /&gt;
  -- 2) pad out the text to fill text_height&lt;br /&gt;
  -- 3) make our header and footer&lt;br /&gt;
  -- 4) put it all together&lt;br /&gt;
&lt;br /&gt;
  local line = pop_line()&lt;br /&gt;
  local current_height = 0&lt;br /&gt;
  local head, tail&lt;br /&gt;
  local notes&lt;br /&gt;
&lt;br /&gt;
  -- We are at the top of the page, so we throw away anything&lt;br /&gt;
  -- that is not an hlist&lt;br /&gt;
  while node_type(line) ~= &amp;quot;hlist&amp;quot; do&lt;br /&gt;
    print(&amp;quot;Throwing away a: &amp;quot; .. node_type(line))&lt;br /&gt;
    line = pop_line(main_text)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  -- 1) get the main text from State.text, a line at a time until&lt;br /&gt;
  --    we either run out of lines or text_height.&lt;br /&gt;
  current_height, head, tail, notes = build_page_step_one(line)  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  -- We have fit all the text that will fit on the page.&lt;br /&gt;
  -- 2) pad out the text to fill text_height&lt;br /&gt;
  &lt;br /&gt;
  if (current_height &amp;lt; text_height) then&lt;br /&gt;
    local needed_height = text_height - current_height&lt;br /&gt;
    local n = make_glue(0, needed_height)&lt;br /&gt;
    link_nodes(tail, n)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  local text_box = node.vpack(head)&lt;br /&gt;
&lt;br /&gt;
  -- 3) make our header and footer&lt;br /&gt;
&lt;br /&gt;
  local header_box = make_header()&lt;br /&gt;
  local footer_box = make_footer()&lt;br /&gt;
&lt;br /&gt;
  -- 4) put it all together&lt;br /&gt;
&lt;br /&gt;
  build_page_step_four(text_box, notes, header_box, footer_box)&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local build_pages = function()&lt;br /&gt;
  -- While there is text to fill a page, we build pages.&lt;br /&gt;
  while State.main do&lt;br /&gt;
    build_page()&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
return {build_par   = build_par,&lt;br /&gt;
        process_par = process_par,&lt;br /&gt;
        build_pages = build_pages}&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rkrug</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.luatex.org/index.php?title=T_wo_T_r:main.lua&amp;diff=3561</id>
		<title>T wo T r:main.lua</title>
		<link rel="alternate" type="text/html" href="https://wiki.luatex.org/index.php?title=T_wo_T_r:main.lua&amp;diff=3561"/>
		<updated>2021-02-22T18:32:47Z</updated>

		<summary type="html">&lt;p&gt;Rkrug: Created page with &amp;quot; &amp;lt;nowiki&amp;gt;   --- Copyright (c) 2021 by Toadstone Enterprises. --- ISC-type license, see License.txt for details.   -------------------------------------------------------------...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &amp;lt;nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--- Copyright (c) 2021 by Toadstone Enterprises.&lt;br /&gt;
--- ISC-type license, see License.txt for details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-----------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--- Why is this needed?&lt;br /&gt;
local main = {}&lt;br /&gt;
package.loaded[...] = main&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local util = require(&amp;quot;utils&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
local link_nodes     = util.link_nodes&lt;br /&gt;
local make_glyph     = util.make_glyph&lt;br /&gt;
local make_glue      = util.make_glue&lt;br /&gt;
local make_penalty   = util.make_penalty&lt;br /&gt;
local is_whitespace  = util.is_whitespace&lt;br /&gt;
local is_linefeed    = util.is_linefeed&lt;br /&gt;
local is_nobreak     = util.is_nobreak&lt;br /&gt;
local copy_table     = util.copy_table&lt;br /&gt;
local read_line      = util.read_line&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local reader = require(&amp;quot;reader&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
local read_value   = reader.read_value&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local format = require(&amp;quot;format&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
local update_state         = format.update_state&lt;br /&gt;
local update_locals        = format.update_locals&lt;br /&gt;
local push_tbl             = format.push_tbl&lt;br /&gt;
local pop_tbl              = format.pop_tbl&lt;br /&gt;
local top_tbl              = format.top_tbl&lt;br /&gt;
local pop_do_command_stop  = format.pop_do_command_stop&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local commands = commands or require(&amp;quot;commands&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
local get_command        = commands.get_command&lt;br /&gt;
local initialize_command = commands.initialize_command&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local pages = pages or require(&amp;quot;pages&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
local build_par   = pages.build_par&lt;br /&gt;
local process_par = pages.process_par&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-----------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local do_char = function(value, head, tail)&lt;br /&gt;
  -- We are building the hlist that will be passed on to&lt;br /&gt;
  -- tex.linebreak for creating a paragraph.&lt;br /&gt;
&lt;br /&gt;
  local tbl = top_tbl()&lt;br /&gt;
&lt;br /&gt;
  local n = nil&lt;br /&gt;
  local p = nil  -- for penalties&lt;br /&gt;
&lt;br /&gt;
  if is_nobreak(value) then&lt;br /&gt;
    -- we treat all unbreakable whitespace equally&lt;br /&gt;
    p = make_penalty(10000)&lt;br /&gt;
    n = make_glue(&amp;quot;spaceskip&amp;quot;,&lt;br /&gt;
                  tbl.space,&lt;br /&gt;
                  tbl.space_stretch,&lt;br /&gt;
                  tbl.space_shrink)&lt;br /&gt;
  elseif is_whitespace(value) then&lt;br /&gt;
    -- we treat all (breakable) whitespace equally&lt;br /&gt;
    n = make_glue(&amp;quot;spaceskip&amp;quot;,&lt;br /&gt;
                  tbl.space,&lt;br /&gt;
                  tbl.space_stretch,&lt;br /&gt;
                  tbl.space_shrink)&lt;br /&gt;
  else&lt;br /&gt;
    -- presumably a glyph&lt;br /&gt;
    n = make_glyph(value,&lt;br /&gt;
                   tbl.font,&lt;br /&gt;
                   tbl.lang,&lt;br /&gt;
                   tbl.lefthyphenmin,&lt;br /&gt;
                   tbl.righthyphenmin)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  if (head == nil) then&lt;br /&gt;
    -- starting a new paragraph, but we add the initial glue in&lt;br /&gt;
    -- build_par.&lt;br /&gt;
    head = n&lt;br /&gt;
  elseif p then&lt;br /&gt;
    -- We have a penalty&lt;br /&gt;
    link_nodes(tail, p, n)&lt;br /&gt;
  else&lt;br /&gt;
    -- only a single node&lt;br /&gt;
    link_nodes(tail, n)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  -- n is our new tail&lt;br /&gt;
  return head, n&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local reading_par = function(head, tail)&lt;br /&gt;
  -- before we start reading a paragraph, head and tail will be nil.&lt;br /&gt;
  return (node.is_node(head) and node.is_node(tail))&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
main.main_loop = function()&lt;br /&gt;
&lt;br /&gt;
  local head, tail, eat_the_white, eol_seen = update_locals()&lt;br /&gt;
&lt;br /&gt;
  local value = read_value()&lt;br /&gt;
&lt;br /&gt;
  while value do&lt;br /&gt;
&lt;br /&gt;
    if value == unicode.utf8.byte(&amp;quot;%&amp;quot;) then&lt;br /&gt;
      -- Start of comment. Comment goes to the end of the line.&lt;br /&gt;
&lt;br /&gt;
      read_line()&lt;br /&gt;
 &lt;br /&gt;
    elseif is_linefeed(value) then&lt;br /&gt;
    &lt;br /&gt;
      if (eol_seen and reading_par(head, tail)) then&lt;br /&gt;
        -- eol_seen ==&amp;gt; this is a blank line,&lt;br /&gt;
        -- reading_par(head, tail) ==&amp;gt; we are in the middle of a paragraph.&lt;br /&gt;
        -- Thus we avoid building &amp;#039;empty&amp;#039; paragraphs.&lt;br /&gt;
        local par = build_par(head, tail)&lt;br /&gt;
        process_par(par)&lt;br /&gt;
        -- After we process the par, we reset head and tail to nil&lt;br /&gt;
        -- in preparation for the next paragraph to be read in.&lt;br /&gt;
        head = nil&lt;br /&gt;
        tail = nil&lt;br /&gt;
        &lt;br /&gt;
      elseif ((not eat_the_white) and reading_par(head, tail)) then&lt;br /&gt;
        -- (not eat_the_white) ==&amp;gt; this is the first bit of white space&lt;br /&gt;
        -- seen,&lt;br /&gt;
        -- reading_par(head, tail) ==&amp;gt; we are in the middle of a paragraph.&lt;br /&gt;
        -- Thus, we avoid starting a paragraph with white space.&lt;br /&gt;
        head, tail    = do_char(value, head, tail)&lt;br /&gt;
        eat_the_white = true&lt;br /&gt;
        eol_seen      = true&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
    elseif is_whitespace(value) then&lt;br /&gt;
    &lt;br /&gt;
      if ((not eat_the_white) and reading_par(head, tail)) then&lt;br /&gt;
        -- (not eat_the_white) ==&amp;gt; this is the first bit of white space&lt;br /&gt;
        -- seen,&lt;br /&gt;
        -- reading_par(head, tail) ==&amp;gt; we are in the middle of a paragraph.&lt;br /&gt;
        -- Thus, we avoid starting a paragraph with white space.&lt;br /&gt;
        head, tail    = do_char(value, head, tail)&lt;br /&gt;
        -- But we do not set eol_seen to false. Thus an &amp;quot;empty&amp;quot; line can&lt;br /&gt;
        -- contain white space.&lt;br /&gt;
        eat_the_white = true&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
    elseif value == unicode.utf8.byte(&amp;quot;\\&amp;quot;) then&lt;br /&gt;
    &lt;br /&gt;
      -- get the command, and initialize it&lt;br /&gt;
      command       = get_command()&lt;br /&gt;
      update_state(head, tail, false, false)&lt;br /&gt;
      initialize_command(command)&lt;br /&gt;
      -- initialize_command may hace done some stuff, resetting&lt;br /&gt;
      -- head, tail, eat_the_white, and eol_seen so we reset them here.&lt;br /&gt;
      head, tail, eat_the_white, eol_seen = update_locals()&lt;br /&gt;
      &lt;br /&gt;
    elseif value == unicode.utf8.byte(&amp;quot;{&amp;quot;) then&lt;br /&gt;
      -- enter a group or start a command&lt;br /&gt;
      &lt;br /&gt;
      update_state(head, tail, false , false)&lt;br /&gt;
      local do_command_start = State.do_command_start&lt;br /&gt;
      if do_command_start then&lt;br /&gt;
        -- We have a command, but before executing it, we reset&lt;br /&gt;
        -- State.do_command_start so that we do not get into a loop.&lt;br /&gt;
        State.do_command_start = nil&lt;br /&gt;
        do_command_start()&lt;br /&gt;
        head, tail, eat_the_white, eol_seen = update_locals()&lt;br /&gt;
        &lt;br /&gt;
      else&lt;br /&gt;
        -- enter a group.&lt;br /&gt;
        push_tbl(copy_table(top_tbl()))&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
    elseif value == unicode.utf8.byte(&amp;quot;}&amp;quot;) then&lt;br /&gt;
      -- leave a group or stop a command&lt;br /&gt;
&lt;br /&gt;
      local do_command_stop = pop_do_command_stop()&lt;br /&gt;
      if do_command_stop then&lt;br /&gt;
        update_state(head, tail, false, false)&lt;br /&gt;
        do_command_stop()&lt;br /&gt;
        head, tail, eat_the_white, eol_seen = update_locals()&lt;br /&gt;
      else&lt;br /&gt;
        pop_tbl()&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
    else&lt;br /&gt;
      -- presumably a glyph&lt;br /&gt;
&lt;br /&gt;
      eat_the_white = false&lt;br /&gt;
      eol_seen      = false&lt;br /&gt;
      head, tail    = do_char(value, head, tail)&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    value = read_value()&lt;br /&gt;
    &lt;br /&gt;
  end  -- while (value) do&lt;br /&gt;
  &lt;br /&gt;
  if reading_par(head, tail) then&lt;br /&gt;
    -- eof, and we may have a par to build.&lt;br /&gt;
    if reading_par(head, tail) then&lt;br /&gt;
      local par = build_par(head, tail)&lt;br /&gt;
      process_par(par)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  update_state(nil, nil, false, false)&lt;br /&gt;
&lt;br /&gt;
  -- Check for unpopped tbls or do_command_stops?&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
return main&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rkrug</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.luatex.org/index.php?title=T_wo_T_r:format.lua&amp;diff=3560</id>
		<title>T wo T r:format.lua</title>
		<link rel="alternate" type="text/html" href="https://wiki.luatex.org/index.php?title=T_wo_T_r:format.lua&amp;diff=3560"/>
		<updated>2021-02-22T18:32:00Z</updated>

		<summary type="html">&lt;p&gt;Rkrug: Created page with &amp;quot;  &amp;lt;nowiki&amp;gt;   --- Copyright (c) 2021 by Toadstone Enterprises. --- ISC-type license, see License.txt for details.   ------------------------------------------------------------...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;  &amp;lt;nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--- Copyright (c) 2021 by Toadstone Enterprises.&lt;br /&gt;
--- ISC-type license, see License.txt for details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-----------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local util = require(&amp;quot;utils&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
local filll = util.filll&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-----------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--- Page Layout&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- This should be set based on the current font!&lt;br /&gt;
tex.baselineskip = tex.sp(&amp;quot;14pt&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- set tex&amp;#039;s margins to the edge of the page, so that we can define&lt;br /&gt;
-- our own page layout more easily&lt;br /&gt;
tex.hoffset = tex.sp(&amp;quot;-1.in&amp;quot;)&lt;br /&gt;
tex.voffset = tex.sp(&amp;quot;-1.in&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- American paper size. USA!&lt;br /&gt;
local paper_width  = tex.sp(&amp;quot;8.5in&amp;quot;)&lt;br /&gt;
local paper_height = tex.sp(&amp;quot;11in&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
local top_margin    = tex.sp(&amp;quot;0.75in&amp;quot;)&lt;br /&gt;
local right_margin  = tex.sp(&amp;quot;0.75in&amp;quot;)&lt;br /&gt;
local bottom_margin = tex.sp(&amp;quot;0.75in&amp;quot;)&lt;br /&gt;
local left_margin   = tex.sp(&amp;quot;0.75in&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- header_height is the height of the header box, and it is&lt;br /&gt;
-- separated from the main text box by header_sep.&lt;br /&gt;
local header_height = tex.sp(&amp;quot;0.5in&amp;quot;)&lt;br /&gt;
local header_sep    = tex.sp(&amp;quot;0.25in&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
local footer_height = tex.sp(&amp;quot;0.5in&amp;quot;)&lt;br /&gt;
local footer_sep    = tex.sp(&amp;quot;0.25in&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- The main text box.&lt;br /&gt;
local text_width  = paper_width - (right_margin + left_margin)&lt;br /&gt;
local text_height = paper_height - (top_margin +&lt;br /&gt;
                                    header_height + header_sep +&lt;br /&gt;
                                    footer_height + footer_sep +&lt;br /&gt;
                                    bottom_margin)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local page_number = 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-----------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--- We define all the fonts we will be using here.&lt;br /&gt;
--- This requires the luatex-plain format, or (untested) luaotfload.&lt;br /&gt;
&lt;br /&gt;
-- fonts.definers.read returns a table representing the font.&lt;br /&gt;
-- font.define ties this font to an integer which we can use to refer&lt;br /&gt;
-- to the desired font.&lt;br /&gt;
&lt;br /&gt;
local main_text_font_table   = fonts.definers.read(&amp;quot;lmroman12-regular.otf:mode=node;liga=true;kern=true;&amp;quot;, tex.sp(&amp;quot;12pt&amp;quot;))&lt;br /&gt;
local main_text_font         = font.define(main_text_font_table)&lt;br /&gt;
&lt;br /&gt;
local emph_text_font_table   = fonts.definers.read(&amp;quot;lmroman12-italic.otf:mode=node;liga=true;kern=true;&amp;quot;, tex.sp(&amp;quot;12pt&amp;quot;))&lt;br /&gt;
local emph_text_font         = font.define(emph_text_font_table)&lt;br /&gt;
&lt;br /&gt;
local bold_text_font_table   = fonts.definers.read(&amp;quot;lmroman12-bold.otf:mode=node;liga=true;kern=true;&amp;quot;, tex.sp(&amp;quot;12pt&amp;quot;))&lt;br /&gt;
local bold_text_font         = font.define(bold_text_font_table)&lt;br /&gt;
&lt;br /&gt;
local title_font_table   = fonts.definers.read(&amp;quot;lmroman17-regular.otf:mode=node;liga=true;kern=true;&amp;quot;, tex.sp(&amp;quot;17pt&amp;quot;))&lt;br /&gt;
local title_font         = font.define(title_font_table)&lt;br /&gt;
&lt;br /&gt;
local header_font_table      = fonts.definers.read(&amp;quot;lmroman12-regular.otf:mode=node;liga=true;kern=true;&amp;quot;, tex.sp(&amp;quot;12pt&amp;quot;))&lt;br /&gt;
local header_font            = font.define(header_font_table)&lt;br /&gt;
&lt;br /&gt;
local footer_font_table      = fonts.definers.read(&amp;quot;lmroman12-regular.otf:mode=node;liga=true;kern=true;&amp;quot;, tex.sp(&amp;quot;12pt&amp;quot;))&lt;br /&gt;
local footer_font            = font.define(footer_font_table)&lt;br /&gt;
&lt;br /&gt;
local footnote_font_table    = fonts.definers.read(&amp;quot;lmroman10-regular.otf::mode=node;liga=true;kern=true;&amp;quot;, tex.sp(&amp;quot;10pt&amp;quot;))&lt;br /&gt;
local footnote_font          = font.define(footnote_font_table)&lt;br /&gt;
&lt;br /&gt;
-- For the footnote markers.&lt;br /&gt;
local superscript_font_table = fonts.definers.read(&amp;quot;lmroman7-regular.otf:mode=node;liga=true;kern=true;&amp;quot;, tex.sp(&amp;quot;7pt&amp;quot;))&lt;br /&gt;
local superscript_font       = font.define(superscript_font_table)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-----------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--- This is the state that we will be passing around as we typeset.&lt;br /&gt;
&lt;br /&gt;
State = {-- What are we typesetting now?&lt;br /&gt;
         -- One of &amp;quot;main_text&amp;quot;, &amp;quot;header&amp;quot;, &amp;quot;footer&amp;quot;, or &amp;quot;footnote&amp;quot;&lt;br /&gt;
         mode = &amp;quot;main_text&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
         -- Where we will store the main text as we build our paragraphs.&lt;br /&gt;
         main   = nil,&lt;br /&gt;
         -- Where we store the header and footer, as we build them.&lt;br /&gt;
         header = nil,&lt;br /&gt;
         footer = nil,&lt;br /&gt;
         -- We use a table of notes, indexed by footnote number&lt;br /&gt;
         max_notes = 0,&lt;br /&gt;
         notes     = {},&lt;br /&gt;
&lt;br /&gt;
         -- We store some of main_loops local variables, so that we&lt;br /&gt;
         -- can pass them around as needed.&lt;br /&gt;
         head          = nil,&lt;br /&gt;
         tail          = nil,&lt;br /&gt;
         eat_the_white = false,&lt;br /&gt;
         eol_seen      = false,&lt;br /&gt;
&lt;br /&gt;
         -- We want to be able to use different parameters for typesetting&lt;br /&gt;
         -- the different pieces of text. A header is not the same as a&lt;br /&gt;
         -- footnote. We therefore keep a stack of tbls containing the&lt;br /&gt;
         -- settings for formatting a paragraph (these are passed to&lt;br /&gt;
         -- tex.linebreak).&lt;br /&gt;
         max_tbls = 0,&lt;br /&gt;
         tbls     = {},&lt;br /&gt;
&lt;br /&gt;
         -- When we see a command, do_command_start will (potentially)&lt;br /&gt;
         -- be filled in with the part of the command to do upon&lt;br /&gt;
         -- encountering a &amp;quot;{&amp;quot;&lt;br /&gt;
         do_command_start     = nil,&lt;br /&gt;
         -- And a stack of do_command_stops: do_command_stops&lt;br /&gt;
         -- We need a stack, because commands can be nested.&lt;br /&gt;
         -- e.g., an Emph inside a Bold.&lt;br /&gt;
         -- We need only one do_command_start, because that is for&lt;br /&gt;
         -- the current command and the next &amp;quot;{&amp;quot; seen.&lt;br /&gt;
         max_do_command_stops = 0,&lt;br /&gt;
         do_command_stops     = {},&lt;br /&gt;
&lt;br /&gt;
         -- A place to store the text to be made into the header.&lt;br /&gt;
         header_text = nil,&lt;br /&gt;
&lt;br /&gt;
         -- So we can format the first paragraph of a chapter&lt;br /&gt;
         -- differently from the rest.&lt;br /&gt;
         first_paragraph_of_chapter = false,&lt;br /&gt;
         -- So we can format the first page of a chapter&lt;br /&gt;
         -- differently from the rest.&lt;br /&gt;
         first_page_of_chapter      = false,&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local main_text_tbl = {hsize = text_width,&lt;br /&gt;
&lt;br /&gt;
                       parindent                = tex.parindent,&lt;br /&gt;
                       parfillskipstretch       = 2^16,&lt;br /&gt;
                       parfillskipstretch_order = 2,&lt;br /&gt;
&lt;br /&gt;
                       font           = main_text_font,&lt;br /&gt;
                       space          = font.fonts[main_text_font].parameters.space,&lt;br /&gt;
                       space_stretch  = font.fonts[main_text_font].parameters.space_stretch,&lt;br /&gt;
                       space_shrink   = font.fonts[main_text_font].parameters.space_shrink,&lt;br /&gt;
&lt;br /&gt;
                       lang           = tex.language,&lt;br /&gt;
                       lefthyphenmin  = tex.lefthyphenmin,&lt;br /&gt;
                       righthyphenmin = tex.righthyphenmin,&lt;br /&gt;
                      }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local header_tbl = {hsize = text_width,&lt;br /&gt;
&lt;br /&gt;
                    -- The header will be centered.&lt;br /&gt;
                    leftskip                 = filll(),&lt;br /&gt;
                    rightskip                = filll(),&lt;br /&gt;
                    parindent                = 0,&lt;br /&gt;
                    parfillskipstretch       = 2^16,&lt;br /&gt;
                    parfillskipstretch_order = 2,&lt;br /&gt;
&lt;br /&gt;
                    font           = header_font,&lt;br /&gt;
                    space          = font.fonts[header_font].parameters.space,&lt;br /&gt;
                    space_stretch  = font.fonts[header_font].parameters.space_stretch,&lt;br /&gt;
                    space_shrink   = font.fonts[header_font].parameters.space_shrink,&lt;br /&gt;
                          &lt;br /&gt;
                    lang           = tex.language,&lt;br /&gt;
                    lefthyphenmin  = tex.lefthyphenmin,&lt;br /&gt;
                    righthyphenmin = tex.righthyphenmin,&lt;br /&gt;
                   }&lt;br /&gt;
&lt;br /&gt;
local footer_tbl = {hsize = text_width,&lt;br /&gt;
                &lt;br /&gt;
                    leftskip                 = filll(),&lt;br /&gt;
                    rightskip                = filll(),&lt;br /&gt;
                    parindent                = 0,&lt;br /&gt;
                    parfillskipstretch       = 2^16,&lt;br /&gt;
                    parfillskipstretch_order = 2,&lt;br /&gt;
&lt;br /&gt;
                    font           = footer_font,&lt;br /&gt;
                    space          = font.fonts[footer_font].parameters.space,&lt;br /&gt;
                    space_stretch  = font.fonts[footer_font].parameters.space_stretch,&lt;br /&gt;
                    space_shrink   = font.fonts[footer_font].parameters.space_shrink,&lt;br /&gt;
                          &lt;br /&gt;
                    lang           = tex.language,&lt;br /&gt;
                    lefthyphenmin  = tex.lefthyphenmin,&lt;br /&gt;
                    righthyphenmin = tex.righthyphenmin,&lt;br /&gt;
                   }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local footnote_tbl = {hsize = text_width,&lt;br /&gt;
                &lt;br /&gt;
                       parindent                = 0,&lt;br /&gt;
                       parfillskipstretch       = 2^16,&lt;br /&gt;
                       parfillskipstretch_order = 2,&lt;br /&gt;
&lt;br /&gt;
                       font           = footnote_font,&lt;br /&gt;
                       space          = font.fonts[footnote_font].parameters.space,&lt;br /&gt;
                       space_stretch  = font.fonts[footnote_font].parameters.space_stretch,&lt;br /&gt;
                       space_shrink   = font.fonts[footnote_font].parameters.space_shrink,&lt;br /&gt;
                          &lt;br /&gt;
                       lang           = tex.language,&lt;br /&gt;
                       lefthyphenmin  = tex.lefthyphenmin,&lt;br /&gt;
                       righthyphenmin = tex.righthyphenmin,&lt;br /&gt;
                      }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local update_state = function(head, tail, eat_the_white, eol_seen)&lt;br /&gt;
  -- As we pass the State around, we wil want to pass along the&lt;br /&gt;
  -- current values of head, tail, eat_the_white, and eol_seen.&lt;br /&gt;
  -- See main_loop and the commands for examples.&lt;br /&gt;
  State.head          = head&lt;br /&gt;
  State.tail          = tail&lt;br /&gt;
  State.eat_the_white = eat_the_white&lt;br /&gt;
  State.eol_seen      = eol_seen&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local update_locals = function()&lt;br /&gt;
  -- As we return from calls in which we passed the State out, the&lt;br /&gt;
  -- values of head, tail, eat_the_white, and eol_seen may have been&lt;br /&gt;
  -- changed. So we update them from the current State. See main_loop&lt;br /&gt;
  -- and the commands for examples.&lt;br /&gt;
  local head          = State.head&lt;br /&gt;
  local tail          = State.tail&lt;br /&gt;
  local eat_the_white = State.eat_the_white&lt;br /&gt;
  local eol_seen      = State.eol_seen&lt;br /&gt;
  return head, tail, eat_the_white, eol_seen&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local push_tbl = function(tbl)&lt;br /&gt;
  local max           = State.max_tbls&lt;br /&gt;
  State.max_tbls      = max + 1&lt;br /&gt;
  State.tbls[max + 1] = tbl&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local pop_tbl = function()&lt;br /&gt;
  local max       = State.max_tbls&lt;br /&gt;
  if (max &amp;gt; 0) then&lt;br /&gt;
    local tbl = State.tbls[max]&lt;br /&gt;
    State.tbls[max] = nil&lt;br /&gt;
    State.max_tbls  = max - 1&lt;br /&gt;
    return tbl&lt;br /&gt;
  else&lt;br /&gt;
    return nil&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local top_tbl = function()&lt;br /&gt;
  local max       = State.max_tbls&lt;br /&gt;
  if (max &amp;gt; 0) then&lt;br /&gt;
    return State.tbls[max]&lt;br /&gt;
  else&lt;br /&gt;
    return nil&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local push_do_command_stop = function(do_command_stop)&lt;br /&gt;
  local max                       = State.max_do_command_stops&lt;br /&gt;
  State.max_do_command_stops      = max + 1&lt;br /&gt;
  State.do_command_stops[max + 1] = do_command_stop&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local pop_do_command_stop = function()&lt;br /&gt;
  local max                     = State.max_do_command_stops&lt;br /&gt;
  if (max &amp;gt; 0) then&lt;br /&gt;
    local do_command_stop       = State.do_command_stops[max]&lt;br /&gt;
    State.do_command_stops[max] = nil&lt;br /&gt;
    State.max_do_command_stops  = max - 1&lt;br /&gt;
    return do_command_stop&lt;br /&gt;
  else&lt;br /&gt;
    return nil&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local format = {paper_width  = paper_width,&lt;br /&gt;
                paper_height = paper_height,&lt;br /&gt;
                &lt;br /&gt;
                top_margin    = top_margin,&lt;br /&gt;
                right_margin  = right_margin,&lt;br /&gt;
                bottom_margin = bottom_margin,&lt;br /&gt;
                left_margin   = left_margin,&lt;br /&gt;
                header_height = header_height,&lt;br /&gt;
                header_sep    = header_sep,&lt;br /&gt;
                footer_height = footer_height,&lt;br /&gt;
                footer_sep    = footer_sep,&lt;br /&gt;
                text_width    = text_width,&lt;br /&gt;
                text_height   = text_height,&lt;br /&gt;
                &lt;br /&gt;
                page_number = page_number,&lt;br /&gt;
&lt;br /&gt;
                update_state         = update_state,&lt;br /&gt;
                update_locals        = update_locals,&lt;br /&gt;
                push_tbl             = push_tbl,&lt;br /&gt;
                pop_tbl              = pop_tbl,&lt;br /&gt;
                top_tbl              = top_tbl,&lt;br /&gt;
                push_do_command_stop = push_do_command_stop,&lt;br /&gt;
                pop_do_command_stop  = pop_do_command_stop,&lt;br /&gt;
                &lt;br /&gt;
                main_text_tbl = main_text_tbl,&lt;br /&gt;
                header_tbl    = header_tbl,&lt;br /&gt;
                footer_tbl    = footer_tbl,&lt;br /&gt;
                footnote_tbl  = footnote_tbl,&lt;br /&gt;
&lt;br /&gt;
                main_text_font   = main_text_font,&lt;br /&gt;
                emph_text_font   = emph_text_font,&lt;br /&gt;
                bold_text_font   = bold_text_font,&lt;br /&gt;
                title_font       = title_font,&lt;br /&gt;
                header_font      = header_font,&lt;br /&gt;
                footer_font      = footer_font,&lt;br /&gt;
                footnote_font    = footnote_font,&lt;br /&gt;
                superscript_font = superscript_font,&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
return format&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rkrug</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.luatex.org/index.php?title=T_wo_T_r:reader.lua&amp;diff=3559</id>
		<title>T wo T r:reader.lua</title>
		<link rel="alternate" type="text/html" href="https://wiki.luatex.org/index.php?title=T_wo_T_r:reader.lua&amp;diff=3559"/>
		<updated>2021-02-22T18:31:09Z</updated>

		<summary type="html">&lt;p&gt;Rkrug: Created page with &amp;quot; &amp;lt;nowiki&amp;gt;   --- Copyright (c) 2021 by Toadstone Enterprises. --- ISC-type license, see License.txt for details.   -------------------------------------------------------------...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &amp;lt;nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--- Copyright (c) 2021 by Toadstone Enterprises.&lt;br /&gt;
--- ISC-type license, see License.txt for details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-----------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--- We maintain a stack of &amp;#039;readers&amp;#039;.&lt;br /&gt;
--- push_reader will push a new &amp;#039;reader&amp;#039; onto the stack, and&lt;br /&gt;
--- pop_reader will pop it. push_reader should be given a string or a&lt;br /&gt;
--- filename (of the form &amp;quot;file:filename&amp;quot;) If a string is passed in,&lt;br /&gt;
--- its contents will be used by the &amp;#039;reader&amp;#039;.  If a filename is&lt;br /&gt;
--- passed in, the file will be read, and its contents will form the&lt;br /&gt;
--- contents of the &amp;#039;reader&amp;#039;.&lt;br /&gt;
--- The top &amp;#039;reader&amp;#039; is the current one, and read_value will return a&lt;br /&gt;
--- char (really a Unicode integer value) from that &amp;#039;reader&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-----------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--- The index of the current &amp;#039;reader&amp;#039;. No &amp;#039;readers&amp;#039; yet.&lt;br /&gt;
&lt;br /&gt;
local n = 0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local explode = function(s)&lt;br /&gt;
  -- This is the lower level function used by push_reader to create&lt;br /&gt;
  -- a &amp;#039;reader&amp;#039;.&lt;br /&gt;
  --&lt;br /&gt;
  -- Take the string s, and break it into unicode values (integers)&lt;br /&gt;
  -- and place these into the table, text, indexed by position.&lt;br /&gt;
  -- text.max is the maximum index.&lt;br /&gt;
  -- text.pos is the current position to be read from. Initially the&lt;br /&gt;
  -- start of the text.&lt;br /&gt;
  &lt;br /&gt;
  assert((type(s) == &amp;quot;string&amp;quot;),&lt;br /&gt;
         &amp;quot;explode was given a &amp;quot; .. type(s) .. &amp;quot; instead of a string.&amp;quot;)&lt;br /&gt;
  local text = {}&lt;br /&gt;
  local i = 0&lt;br /&gt;
  &lt;br /&gt;
  for v in string.utfvalues(s) do&lt;br /&gt;
    i = i + 1&lt;br /&gt;
    text[i] = v&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  text.max = i&lt;br /&gt;
  text.pos = 1&lt;br /&gt;
  return text&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local push_reader = function(data)&lt;br /&gt;
  -- Create a &amp;#039;reader&amp;#039;. That is, use explode to create a table&lt;br /&gt;
  -- containing the text from data (either a file pointer or the&lt;br /&gt;
  -- text itself). Then place this table into the next index of&lt;br /&gt;
  -- the &amp;#039;reader&amp;#039; table, Reader, in the next available index.&lt;br /&gt;
  &lt;br /&gt;
  local text&lt;br /&gt;
&lt;br /&gt;
  assert((type(data) == &amp;quot;string&amp;quot;), &amp;quot;Bad arg to push_reader.&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
  if (unicode.utf8.sub(data, 1, 5) == &amp;quot;file:&amp;quot;) then&lt;br /&gt;
    local f = io.open(unicode.utf8.sub(data, 6, -1))&lt;br /&gt;
    assert(f, &amp;quot;File &amp;quot; .. unicode.utf8.sub(data, 6, -1) .. &amp;quot;failed to open.&amp;quot;)&lt;br /&gt;
    text = f:read(&amp;quot;a&amp;quot;)&lt;br /&gt;
  else&lt;br /&gt;
    text = data&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  local reader = explode(text)&lt;br /&gt;
&lt;br /&gt;
  n = n + 1&lt;br /&gt;
  Reader[n] = reader&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local pop_reader = function()&lt;br /&gt;
  -- Remove the currently active &amp;#039;reader&amp;#039; from Reader.&lt;br /&gt;
  &lt;br /&gt;
  assert((n &amp;gt; 0), &amp;quot;No reader to pop!&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
  Reader[n] = nil&lt;br /&gt;
  n = n - 1&lt;br /&gt;
  &lt;br /&gt;
end&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
local read_value = function()&lt;br /&gt;
  -- Get the char (a Unicode integer) from the currenly active&lt;br /&gt;
  -- &amp;#039;reader&amp;#039;.&lt;br /&gt;
  &lt;br /&gt;
  local value&lt;br /&gt;
  &lt;br /&gt;
  assert((n &amp;gt; 0), &amp;quot;No reader to read from!&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
  local reader = Reader[n]&lt;br /&gt;
  local max = reader.max&lt;br /&gt;
  local pos = reader.pos&lt;br /&gt;
  &lt;br /&gt;
  if (pos &amp;lt;= max) then&lt;br /&gt;
    value = reader[pos]&lt;br /&gt;
  else&lt;br /&gt;
    -- We are already at the end.&lt;br /&gt;
    return nil&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  reader.pos = pos + 1&lt;br /&gt;
  return value&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local unread_value = function()&lt;br /&gt;
  -- Back the indexed position of the currently active &amp;#039;reader&amp;#039;&lt;br /&gt;
  -- by one.&lt;br /&gt;
  &lt;br /&gt;
  assert((n &amp;gt; 0), &amp;quot;No reader to unread to!&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
  local reader = Reader[n]&lt;br /&gt;
  local pos = reader.pos&lt;br /&gt;
  &lt;br /&gt;
  assert((pos &amp;gt; 1), &amp;quot;Already at start of text!&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
  reader.pos = pos - 1&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local replace_text = function(text, start, stop)&lt;br /&gt;
  -- Insert some text (a string) into the current &amp;#039;reader&amp;#039; replacing&lt;br /&gt;
  -- the text from the indices start to stop, and reset the &amp;#039;reader&amp;#039;&lt;br /&gt;
  -- to the beginning of inserted text&lt;br /&gt;
  -- There are three special cases,&lt;br /&gt;
  -- 1. prepend some text, before any reading&lt;br /&gt;
  -- 2. insert without replacing any text&lt;br /&gt;
  -- 3. deleting text, without inserting&lt;br /&gt;
  -- These can be handled by using&lt;br /&gt;
  -- 1. start = 0, stop = -1&lt;br /&gt;
  -- 2. stop = start -1&lt;br /&gt;
  -- 3. text = &amp;quot;&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  assert((n &amp;gt; 0), &amp;quot;No reader to replace text in!&amp;quot;)&lt;br /&gt;
  local reader = Reader[n]&lt;br /&gt;
  local max = reader.max&lt;br /&gt;
&lt;br /&gt;
  assert((type(text) == &amp;quot;string&amp;quot;), &amp;quot;Text is not a string!&amp;quot;)&lt;br /&gt;
  assert((start &amp;gt;= 0), &amp;quot;Start must be a non-negative integer&amp;quot;)&lt;br /&gt;
  assert((stop &amp;lt;= max), &amp;quot;Stop must be less than max&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
  local insert = explode(text)&lt;br /&gt;
  local difference = insert.max - (stop - start + 1)&lt;br /&gt;
&lt;br /&gt;
  if (difference &amp;gt; 0) then&lt;br /&gt;
    -- move up&lt;br /&gt;
    for i = max, stop + 1, -1 do&lt;br /&gt;
      reader[i + difference] = reader[i]&lt;br /&gt;
    end&lt;br /&gt;
  elseif (difference &amp;lt; 0) then&lt;br /&gt;
    -- move down&lt;br /&gt;
    for i = stop + 1, max do&lt;br /&gt;
      reader[i + difference] = reader[i]&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  -- insert&lt;br /&gt;
  -- If we are prepending some text (special case 1. above)&lt;br /&gt;
  -- we need to reset start from 0 to 1.&lt;br /&gt;
  if (start == 0) then start = 1 end&lt;br /&gt;
  for i = 1, insert.max do&lt;br /&gt;
    reader[start + i - 1] = insert[i]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  reader.max = reader.max + difference&lt;br /&gt;
  reader.pos = start&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local pos = function()&lt;br /&gt;
  -- Return the position of the current &amp;#039;reader&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
  assert((n &amp;gt; 0), &amp;quot;No reader to replace text in!&amp;quot;)&lt;br /&gt;
  local reader = Reader[n]&lt;br /&gt;
&lt;br /&gt;
  return reader.pos&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Reader = {push_reader   = push_reader,&lt;br /&gt;
          pop_reader    = pop_reader,&lt;br /&gt;
          read_value    = read_value,&lt;br /&gt;
          unread_value  = unread_value,&lt;br /&gt;
          replace_text  = replace_text,&lt;br /&gt;
          pos           = pos,}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
return Reader&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rkrug</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.luatex.org/index.php?title=T_wo_T_r:utils.lua&amp;diff=3558</id>
		<title>T wo T r:utils.lua</title>
		<link rel="alternate" type="text/html" href="https://wiki.luatex.org/index.php?title=T_wo_T_r:utils.lua&amp;diff=3558"/>
		<updated>2021-02-22T18:30:10Z</updated>

		<summary type="html">&lt;p&gt;Rkrug: Created page with &amp;quot; &amp;lt;nowiki&amp;gt;   --- Copyright (c) 2021 by Toadstone Enterprises. --- ISC-type license, see License.txt for details.   -------------------------------------------------------------...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &amp;lt;nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--- Copyright (c) 2021 by Toadstone Enterprises.&lt;br /&gt;
--- ISC-type license, see License.txt for details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-----------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local reader = require(&amp;quot;reader&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
local read_value   = reader.read_value&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-----------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local sp_to_p = function(sp)&lt;br /&gt;
  -- Convert scaled points to points.&lt;br /&gt;
  return sp/65536&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local sp_to_in = function(sp)&lt;br /&gt;
  -- Convert scaled points to inches.&lt;br /&gt;
  return sp_to_p(sp)/72.27&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local node_type = function(x)&lt;br /&gt;
  -- Return the type of a node as a string.&lt;br /&gt;
  return node.types()[x.id]&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local node_subtype = function(x)&lt;br /&gt;
  -- Return the subtype of a node as a string.&lt;br /&gt;
  local type = node_type(x)&lt;br /&gt;
  return node.subtypes(type)[x.subtype]&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local link_nodes = function(...)&lt;br /&gt;
  -- Link the nodes, setting both the next and prev fields.&lt;br /&gt;
  local arg = {...}&lt;br /&gt;
  for i = 1, (#arg - 1) do&lt;br /&gt;
    arg[i].next = arg[i+1]&lt;br /&gt;
    arg[i+1].prev = arg[i]&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local make_glyph = function(value, fnt, lang, lefthyphenmin, righthyphenmin)&lt;br /&gt;
  local n   = node.new(&amp;quot;glyph&amp;quot;)&lt;br /&gt;
  n.font    = fnt or font.current()&lt;br /&gt;
  n.subtype = 1&lt;br /&gt;
  n.char    = value&lt;br /&gt;
  n.lang    = lang or tex.language&lt;br /&gt;
  n.uchyph  = 1&lt;br /&gt;
  n.left    = lefthyphenmin or tex.lefthyphenmin&lt;br /&gt;
  n.right   = righthyphenmin or tex.righthyphenmin&lt;br /&gt;
  return n&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local make_glue = function(subtype,&lt;br /&gt;
                           width,&lt;br /&gt;
                           stretch, shrink,&lt;br /&gt;
                           stretch_order, shrink_order)&lt;br /&gt;
  local n = node.new(&amp;quot;glue&amp;quot;, subtype)&lt;br /&gt;
  node.setglue(n, width or 0,&lt;br /&gt;
                  stretch or 0,&lt;br /&gt;
                  shrink or 0,&lt;br /&gt;
                  stretch_order or 0,&lt;br /&gt;
                  shrink_order or 0)&lt;br /&gt;
  return n&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local make_glue_spec = function(width,&lt;br /&gt;
                                stretch, shrink,&lt;br /&gt;
                                stretch_order, shrink_order)&lt;br /&gt;
  local n         = node.new(&amp;quot;glue_spec&amp;quot;)&lt;br /&gt;
  n.width         = width or 0&lt;br /&gt;
  n.stretch       = stretch or 0&lt;br /&gt;
  n.shrink        = shrink or 0&lt;br /&gt;
  n.stretch_order = stretch_order or 0&lt;br /&gt;
  n.shrink_order  = shrink_order or 0&lt;br /&gt;
  return n&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local make_rule = function(subtype, width, height, depth, dir)&lt;br /&gt;
  local n  = node.new(&amp;quot;rule&amp;quot;, subtype or 0)&lt;br /&gt;
  n.width  = width or 0&lt;br /&gt;
  n.height = height or 0&lt;br /&gt;
  n.depth  = depth or 0&lt;br /&gt;
  n.dir    = dir or &amp;quot;TLT&amp;quot;&lt;br /&gt;
  return n&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local make_penalty = function(penalty)&lt;br /&gt;
  local n   = node.new(&amp;quot;penalty&amp;quot;)&lt;br /&gt;
  n.penalty = penalty&lt;br /&gt;
  return n&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local fil = function()&lt;br /&gt;
  -- Return a &amp;quot;fil&amp;quot; glue_spec.&lt;br /&gt;
  return make_glue_spec(0, tex.sp(&amp;quot;1pt&amp;quot;), 0, 1, 0)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local fill = function()&lt;br /&gt;
  -- Return a &amp;quot;fill&amp;quot; glue_spec.&lt;br /&gt;
  return make_glue_spec(0, tex.sp(&amp;quot;1pt&amp;quot;), 0, 2, 0)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local filll = function()&lt;br /&gt;
  -- Return a &amp;quot;filll&amp;quot; glue_spec.&lt;br /&gt;
  return make_glue_spec(0, tex.sp(&amp;quot;1pt&amp;quot;), 0, 3, 0)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-----------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local read_string = function()&lt;br /&gt;
  -- We return a regular (not exploded or anything) string.&lt;br /&gt;
&lt;br /&gt;
  local ans = &amp;quot;&amp;quot;&lt;br /&gt;
  local value = read_value()&lt;br /&gt;
  &lt;br /&gt;
  -- Should we be eat any white space before the string?&lt;br /&gt;
  while is_whitespace(value) do&lt;br /&gt;
    value = read_value()&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  if ((value ~= unicode.utf8.byte(&amp;#039;&amp;quot;&amp;#039;)) and &lt;br /&gt;
      (value ~= unicode.utf8.byte(&amp;quot;&amp;#039;&amp;quot;))) then&lt;br /&gt;
    error(&amp;quot;Not a string. No opening quoteation mark.&amp;quot;)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  -- So we can look only for the matching quote&lt;br /&gt;
  local delimiter = value&lt;br /&gt;
&lt;br /&gt;
  value = read_value()&lt;br /&gt;
  while (value and (value ~= delimiter)) do&lt;br /&gt;
    -- We want to return a regular string.&lt;br /&gt;
    ans = ans .. unicode.utf8.char(value)&lt;br /&gt;
    value = read_value()&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  if (not value) then  -- eof&lt;br /&gt;
    error(&amp;quot;Not a string. No closing quotation mark.&amp;quot;)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  return ans&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local read_group = function(eat_the_white)&lt;br /&gt;
  -- We read a group, (delimited by matching &amp;quot;{&amp;quot;, &amp;quot;}&amp;quot; or &amp;quot;[&amp;quot;, &amp;quot;]&amp;quot;)&lt;br /&gt;
  -- possibly eating any white space within the group.&lt;br /&gt;
  -- We return a regular (not exploded or anything) string.&lt;br /&gt;
&lt;br /&gt;
  local ans = &amp;quot;&amp;quot;&lt;br /&gt;
  local value = read_value()&lt;br /&gt;
  &lt;br /&gt;
  -- Should we eat any white space before the group?&lt;br /&gt;
  while is_whitespace(value) do&lt;br /&gt;
    value = read_value()&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  -- So we can look only for the matching delimiter  &lt;br /&gt;
  local delimiter&lt;br /&gt;
  if (value == unicode.utf8.byte(&amp;quot;{&amp;quot;)) then&lt;br /&gt;
    delimiter = unicode.utf8.byte(&amp;quot;}&amp;quot;)&lt;br /&gt;
  elseif (value == unicode.utf8.byte(&amp;quot;[&amp;quot;)) then&lt;br /&gt;
    delimiter = unicode.utf8.byte(&amp;quot;]&amp;quot;)&lt;br /&gt;
  else&lt;br /&gt;
    error(&amp;quot;Not a group. No opening group delimiter.&amp;quot;)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  value = read_value()&lt;br /&gt;
  while (value and (value ~= delimiter)) do&lt;br /&gt;
    if ((not eat_the_white) or (not is_whitespace(value))) then&lt;br /&gt;
      ans = ans .. unicode.utf8.char(value)&lt;br /&gt;
    end&lt;br /&gt;
    value = read_value()&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  if (not value) then   -- eof&lt;br /&gt;
    error(&amp;quot;Not a group. No closing group delimiter.&amp;quot;)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  return ans&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local read_line = function()&lt;br /&gt;
  -- Read to the end of the current line (and throw away the result).&lt;br /&gt;
  local value = read_value()&lt;br /&gt;
  while (not is_linefeed(value)) do&lt;br /&gt;
    value = read_value()&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-----------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local copy_table = function(tbl)&lt;br /&gt;
  -- Make a deep copy of the table.&lt;br /&gt;
  -- We do not copy the keys.&lt;br /&gt;
&lt;br /&gt;
  local result = {}&lt;br /&gt;
  if type(tbl) == &amp;quot;table&amp;quot; then&lt;br /&gt;
    for k,v in pairs(tbl) do&lt;br /&gt;
      result[k] = copy_table(v)&lt;br /&gt;
    end&lt;br /&gt;
  else&lt;br /&gt;
    result = tbl&lt;br /&gt;
  end&lt;br /&gt;
  return result&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-----------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--- Character categories&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local whitespace = {[0x0009] = true,  -- Tab&lt;br /&gt;
                    [0x000A] = true,  -- LF  -- Line Break&lt;br /&gt;
                    [0x000B] = true,  -- Line Tab  -- Line Break&lt;br /&gt;
                    [0x000C] = true,  -- Form Feed  -- Line Break&lt;br /&gt;
                    [0x000D] = true,  -- CR  -- Line Break&lt;br /&gt;
                    [0x0020] = true,  -- Space&lt;br /&gt;
                    [0x0085] = true,  -- Next Line  -- Line Break&lt;br /&gt;
                    [0x00A0] = true,  -- NB Space  -- No Break&lt;br /&gt;
                    [0x1680] = true,  -- Ogham Space Mark&lt;br /&gt;
                    [0x2000] = true,  -- EN Quad&lt;br /&gt;
                    [0x2001] = true,  -- EM Quad&lt;br /&gt;
                    [0x2002] = true,  -- EN Space&lt;br /&gt;
                    [0x2003] = true,  -- EM Space&lt;br /&gt;
                    [0x2004] = true,  -- Three per EM Space&lt;br /&gt;
                    [0x2005] = true,  -- Four per EM Space&lt;br /&gt;
                    [0x2006] = true,  -- Six per Em Space&lt;br /&gt;
                    [0x2007] = true,  -- Figure Space  -- No Break&lt;br /&gt;
                    [0x2008] = true,  -- Punctuation Space&lt;br /&gt;
                    [0x2009] = true,  -- Thin Space&lt;br /&gt;
                    [0x200A] = true,  -- Hair Space&lt;br /&gt;
                    [0x2028] = true,  -- Line Separator  -- Line Break&lt;br /&gt;
                    [0x2029] = true,  -- Paragraph Separator  -- Line Break&lt;br /&gt;
                    [0x202F] = true,  -- Narrow NB Space  -- No Break&lt;br /&gt;
                    [0x205F] = true,  -- Medium Mathematical Space&lt;br /&gt;
                    [0x3000] = true   -- Ideographic Space&lt;br /&gt;
                   }&lt;br /&gt;
&lt;br /&gt;
local is_whitespace = function(value)&lt;br /&gt;
  return whitespace[value]&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local linefeed = {[0x000A] = true,  -- LF  -- Line Break&lt;br /&gt;
                  [0x000B] = true,  -- Line Tab  -- Line Break&lt;br /&gt;
                  [0x000C] = true,  -- Form Feed  -- Line Break&lt;br /&gt;
                  [0x000D] = true,  -- CR  -- Line Break&lt;br /&gt;
                  [0x0085] = true,  -- Next Line  -- Line Break&lt;br /&gt;
                  [0x2028] = true,  -- Line Separator  -- Line Break&lt;br /&gt;
                  [0x2029] = true   -- Paragraph Separator  -- Line Break&lt;br /&gt;
                 }&lt;br /&gt;
                      &lt;br /&gt;
&lt;br /&gt;
local is_linefeed = function(value)&lt;br /&gt;
  return linefeed[value]  &lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local nobreak = {[0x00A0] = true,  -- NB Space  -- No Break&lt;br /&gt;
                 [0x2007] = true,  -- Figure Space  -- No Break&lt;br /&gt;
                 [0x202F] = true,  -- Narrow NB Space  -- No Break&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
local is_nobreak = function(value)&lt;br /&gt;
  return nobreak[value]&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local command_terminator = {[unicode.utf8.byte(&amp;quot;{&amp;quot;)] = true,&lt;br /&gt;
                            [unicode.utf8.byte(&amp;quot;[&amp;quot;)] = true,&lt;br /&gt;
                            -- But we want to terminate on&lt;br /&gt;
                            -- whitespace in general&lt;br /&gt;
                            -- [unicode.utf8.byte(&amp;quot; &amp;quot;)] = true&lt;br /&gt;
                           }&lt;br /&gt;
&lt;br /&gt;
local is_command_terminator = function(value)&lt;br /&gt;
  return (command_terminator[value] or is_whitespace(value))&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-----------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--- Functions for exploring the state of nodes and tables.&lt;br /&gt;
&lt;br /&gt;
--- With this schema, if you are in the REPL and discover that&lt;br /&gt;
--- a node you wish to show is not yet supported, for a node of&lt;br /&gt;
--- type xxx, define a function (in the REPL):&lt;br /&gt;
--- util.show_node_functions.show_xxx_node(n)&lt;br /&gt;
--- If you can&amp;#039;t remember the correct name of the table,&lt;br /&gt;
--- walk_table(util)&lt;br /&gt;
--- will remind you.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local show_node_functions = {}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
show_node_functions.show_hlist_node = function(n)&lt;br /&gt;
  local id      = node_type(n)&lt;br /&gt;
  local subtype = node.subtypes(tostring(id))[n.subtype]&lt;br /&gt;
  print(&amp;quot;id:      &amp;quot; .. id)&lt;br /&gt;
  print(&amp;quot;subtype: &amp;quot; .. subtype)&lt;br /&gt;
  print(&amp;quot;width:   &amp;quot; .. sp_to_in(n.width) .. &amp;quot;in&amp;quot;)&lt;br /&gt;
  print(&amp;quot;height:  &amp;quot; .. sp_to_p(n.height) .. &amp;quot;p&amp;quot;)&lt;br /&gt;
  print(&amp;quot;depth:   &amp;quot; .. sp_to_p(n.depth)  .. &amp;quot;p&amp;quot;)&lt;br /&gt;
  print()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
show_node_functions.show_vlist_node = function(n)&lt;br /&gt;
  local id      = node_type(n)&lt;br /&gt;
  local subtype = node_subtype(n)&lt;br /&gt;
  print(&amp;quot;id:      &amp;quot; .. id)&lt;br /&gt;
  print(&amp;quot;subtype: &amp;quot; .. subtype)&lt;br /&gt;
  print(&amp;quot;width:   &amp;quot; .. sp_to_in(n.width)  .. &amp;quot;in&amp;quot;)&lt;br /&gt;
  print(&amp;quot;height:  &amp;quot; .. sp_to_in(n.height) .. &amp;quot;in&amp;quot;)&lt;br /&gt;
  print(&amp;quot;depth:   &amp;quot; .. sp_to_in(n.depth)  .. &amp;quot;in&amp;quot;)&lt;br /&gt;
  print()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
show_node_functions.show_glyph_node = function(n)&lt;br /&gt;
  local id      = node_type(n)&lt;br /&gt;
  local subtype = node_subtype(n)&lt;br /&gt;
  print(&amp;quot;id:      &amp;quot; .. id)&lt;br /&gt;
  -- sometimes a glyph node will not have a subtype?&lt;br /&gt;
  if subtype then print(&amp;quot;subtype: &amp;quot; .. subtype) end&lt;br /&gt;
  print(&amp;quot;char:    &amp;quot; .. unicode.utf8.char(n.char))&lt;br /&gt;
  print(&amp;quot;font:    &amp;quot; .. n.font)&lt;br /&gt;
  print(&amp;quot;lang:    &amp;quot; .. n.lang)&lt;br /&gt;
  print()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
show_node_functions.show_glue_node = function(n)&lt;br /&gt;
  local id      = node_type(n)&lt;br /&gt;
  local subtype = node_subtype(n)&lt;br /&gt;
  print(&amp;quot;id:      &amp;quot; .. id)&lt;br /&gt;
  print(&amp;quot;subtype: &amp;quot; .. subtype)&lt;br /&gt;
  print(&amp;quot;width:   &amp;quot; .. sp_to_p(n.width)   .. &amp;quot;p&amp;quot;)&lt;br /&gt;
  print(&amp;quot;stretch: &amp;quot; .. sp_to_p(n.stretch) .. &amp;quot;p&amp;quot;)&lt;br /&gt;
  print(&amp;quot;shrink:  &amp;quot; .. sp_to_p(n.stretch) .. &amp;quot;p&amp;quot;)&lt;br /&gt;
  print()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
show_node_functions.show_disc_node = function(n)&lt;br /&gt;
  local id      = node_type(n)&lt;br /&gt;
  local subtype = node_subtype(n)&lt;br /&gt;
  print(&amp;quot;id:      &amp;quot; .. id)&lt;br /&gt;
  print(&amp;quot;subtype: &amp;quot; .. subtype)&lt;br /&gt;
  -- pre&lt;br /&gt;
  -- post&lt;br /&gt;
  -- repl&lt;br /&gt;
  print()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
show_node_functions.show_penalty_node = function(n)&lt;br /&gt;
  local id      = node_type(n)&lt;br /&gt;
  local subtype = node_subtype(n)&lt;br /&gt;
  print(&amp;quot;id:      &amp;quot; .. id)&lt;br /&gt;
  print(&amp;quot;subtype: &amp;quot; .. subtype)&lt;br /&gt;
  print(&amp;quot;penalty: &amp;quot; .. n.penalty)&lt;br /&gt;
  print()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
show_node_functions.show_kern_node = function(n)&lt;br /&gt;
  local id      = node_type(n)&lt;br /&gt;
  local subtype = node_subtype(n)&lt;br /&gt;
  print(&amp;quot;id:               &amp;quot; .. id)&lt;br /&gt;
  print(&amp;quot;subtype:          &amp;quot; .. subtype)&lt;br /&gt;
  print(&amp;quot;kern:             &amp;quot; .. sp_to_p(n.kern) .. &amp;quot;p&amp;quot;)&lt;br /&gt;
  print(&amp;quot;expansion_factor: &amp;quot; .. n.expansion_factor)&lt;br /&gt;
  print()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
show_node_functions.show_rule_node = function(n)&lt;br /&gt;
  local id      = node_type(n)&lt;br /&gt;
  local subtype = node_subtype(n)&lt;br /&gt;
  print(&amp;quot;id:      &amp;quot; .. id)&lt;br /&gt;
  print(&amp;quot;subtype: &amp;quot; .. subtype)&lt;br /&gt;
  print(&amp;quot;width:   &amp;quot; .. sp_to_in(n.width) .. &amp;quot;in&amp;quot;)&lt;br /&gt;
  print(&amp;quot;height:  &amp;quot; .. sp_to_p(n.height) .. &amp;quot;p&amp;quot;)&lt;br /&gt;
  print(&amp;quot;depth:   &amp;quot; .. sp_to_p(n.depth)  .. &amp;quot;p&amp;quot;)&lt;br /&gt;
  print(&amp;quot;dir:     &amp;quot; .. n.dir)&lt;br /&gt;
  print()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local show_node = function(n)&lt;br /&gt;
  local id                 = node_type(n)&lt;br /&gt;
  local show_function_name = &amp;quot;show_&amp;quot; .. id .. &amp;quot;_node&amp;quot;&lt;br /&gt;
  local show_function      = show_node_functions[show_function_name]&lt;br /&gt;
  if show_function then&lt;br /&gt;
    show_function(n)&lt;br /&gt;
  else&lt;br /&gt;
    print(&amp;quot;I don&amp;#039;t know how to show a &amp;quot; .. id .. &amp;quot; node.&amp;quot;)&lt;br /&gt;
    print()&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local walk_list = function(l)&lt;br /&gt;
  -- Walk down a list of nodes, showing them as we go.&lt;br /&gt;
  for n in node.traverse(l) do&lt;br /&gt;
    show_node(n)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local walk_table = function(t)&lt;br /&gt;
  -- Walk through a table, showing the key/value pairs.&lt;br /&gt;
  local k, v&lt;br /&gt;
  for k,v in pairs(t) do&lt;br /&gt;
    print(k,v)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
util = {&lt;br /&gt;
  sp_to_p  = sp_to_p,&lt;br /&gt;
  sp_to_in = sp_to_in,&lt;br /&gt;
&lt;br /&gt;
  node_type    = node_type,&lt;br /&gt;
  node_subtype = node_subtype,&lt;br /&gt;
&lt;br /&gt;
  link_nodes = link_nodes,&lt;br /&gt;
&lt;br /&gt;
  make_glyph     = make_glyph,&lt;br /&gt;
  make_glue      = make_glue,&lt;br /&gt;
  make_glue_spec = make_glue_spec,&lt;br /&gt;
  make_rule      = make_rule,&lt;br /&gt;
  make_penalty   = make_penalty,&lt;br /&gt;
&lt;br /&gt;
  fil   = fil,&lt;br /&gt;
  fill  = fill,&lt;br /&gt;
  filll = filll,&lt;br /&gt;
&lt;br /&gt;
  read_string = read_string,&lt;br /&gt;
  read_group  = read_group,&lt;br /&gt;
  read_line   = read_line,&lt;br /&gt;
&lt;br /&gt;
  copy_table = copy_table,&lt;br /&gt;
&lt;br /&gt;
  is_whitespace         = is_whitespace,&lt;br /&gt;
  is_linefeed           = is_linefeed,&lt;br /&gt;
  is_nobreak            = is_nobreak,&lt;br /&gt;
  is_command_terminator = is_command_terminator,&lt;br /&gt;
&lt;br /&gt;
  show_node           = show_node,&lt;br /&gt;
  walk_list           = walk_list,&lt;br /&gt;
  walk_table          = walk_table,&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
return util&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rkrug</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.luatex.org/index.php?title=T_wo_T_r:repl.lua&amp;diff=3557</id>
		<title>T wo T r:repl.lua</title>
		<link rel="alternate" type="text/html" href="https://wiki.luatex.org/index.php?title=T_wo_T_r:repl.lua&amp;diff=3557"/>
		<updated>2021-02-22T18:28:37Z</updated>

		<summary type="html">&lt;p&gt;Rkrug: Created page with &amp;quot; &amp;lt;nowiki&amp;gt; --- Copyright (c) 2011-2015 Rob Hoelz &amp;lt;rob@hoelz.ro&amp;gt; --- --- Further hacked by others. --- --- Permission is hereby granted, free of charge, to any person --- obtain...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &amp;lt;nowiki&amp;gt;&lt;br /&gt;
--- Copyright (c) 2011-2015 Rob Hoelz &amp;lt;rob@hoelz.ro&amp;gt;&lt;br /&gt;
---&lt;br /&gt;
--- Further hacked by others.&lt;br /&gt;
---&lt;br /&gt;
--- Permission is hereby granted, free of charge, to any person&lt;br /&gt;
--- obtaining a copy of this software and associated documentation&lt;br /&gt;
--- files (the &amp;quot;Software&amp;quot;), to deal in the Software without&lt;br /&gt;
--- restriction, including without limitation the rights to use, copy,&lt;br /&gt;
--- modify, merge, publish, distribute, sublicense, and/or sell copies&lt;br /&gt;
--- of the Software, and to permit persons to whom the Software is&lt;br /&gt;
--- furnished to do so, subject to the following conditions:&lt;br /&gt;
---&lt;br /&gt;
--- The above copyright notice and this permission notice shall be&lt;br /&gt;
--- included in all copies or substantial portions of the Software.&lt;br /&gt;
---&lt;br /&gt;
--- THE SOFTWARE IS PROVIDED &amp;quot;AS IS&amp;quot;, WITHOUT WARRANTY OF ANY KIND,&lt;br /&gt;
--- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF&lt;br /&gt;
--- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND&lt;br /&gt;
--- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS&lt;br /&gt;
--- BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN&lt;br /&gt;
--- ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN&lt;br /&gt;
--- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE&lt;br /&gt;
--- SOFTWARE.&lt;br /&gt;
---&lt;br /&gt;
--- This module implements the core functionality of a REPL.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--- repl() is the REPL.&lt;br /&gt;
&lt;br /&gt;
--- quit() or exit() will terminate the REPL.&lt;br /&gt;
&lt;br /&gt;
--- require(&amp;quot;utils&amp;quot;) or anything else you will want to use in the&lt;br /&gt;
--- REPL as a global, or they will not be visible.&lt;br /&gt;
&lt;br /&gt;
--- Note: The REPL is NOT Unicode aware!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local repl_buffer = &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local function gather_results(success, ...)&lt;br /&gt;
  local n = select(&amp;quot;#&amp;quot;, ...)&lt;br /&gt;
  return success, {n = n, ... }&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local function detectcontinue(err)&lt;br /&gt;
  -- Uses the compilation error to determine whether or not further input&lt;br /&gt;
  -- is pending after the last line. That is, is this a fraction of a&lt;br /&gt;
  -- statement.&lt;br /&gt;
  -- Rather crude, but this seems to work.&lt;br /&gt;
  return string.match(err, &amp;quot;&amp;#039;&amp;lt;eof&amp;gt;&amp;#039;$&amp;quot;) or string.match(err, &amp;quot;&amp;lt;eof&amp;gt;$&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local function compilechunk(chunk)&lt;br /&gt;
  -- If this is an expression, rather than a statement, we should&lt;br /&gt;
  -- get a function, in f, to return the value of that expression.&lt;br /&gt;
  local f, err = load(&amp;quot;return &amp;quot; .. chunk, &amp;quot;REPL&amp;quot;)&lt;br /&gt;
  -- For statements (or fractions thereof).&lt;br /&gt;
  if not f then&lt;br /&gt;
    f, err = load(chunk, &amp;quot;REPL&amp;quot;)&lt;br /&gt;
  end&lt;br /&gt;
  return f, err&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local function displayresults(results)&lt;br /&gt;
  -- @param results The results to display. The results are a table,&lt;br /&gt;
  -- with the integer keys containing the results, and the &amp;quot;n&amp;quot; key&lt;br /&gt;
  -- containing the highest integer key.&lt;br /&gt;
  if results.n == 0 then return end&lt;br /&gt;
  print(table.unpack(results, 1, results.n))&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local function displayerror(err)&lt;br /&gt;
  print(err)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local function handleline(line)&lt;br /&gt;
  -- Evaluates a line of input, and displays return value(s).&lt;br /&gt;
  local chunk  = repl_buffer .. line&lt;br /&gt;
  local f, err = compilechunk(chunk)&lt;br /&gt;
&lt;br /&gt;
  if f then&lt;br /&gt;
    -- We have a (presumed) function. Try to call it, and display the&lt;br /&gt;
    -- results, or error.&lt;br /&gt;
    repl_buffer = &amp;quot;&amp;quot;&lt;br /&gt;
    local success, results = gather_results(xpcall(f, function(...) return debug.traceback(...) end))&lt;br /&gt;
    if success then&lt;br /&gt;
      displayresults(results)&lt;br /&gt;
    else&lt;br /&gt;
      displayerror(results[1])&lt;br /&gt;
    end&lt;br /&gt;
  elseif detectcontinue(err) then&lt;br /&gt;
    -- This is a (presumed) fraction of a statement?&lt;br /&gt;
    repl_buffer = chunk .. &amp;quot;\n&amp;quot;&lt;br /&gt;
    return 2&lt;br /&gt;
  else&lt;br /&gt;
    -- An error. Clear the buffer, so this does not keep happening.&lt;br /&gt;
    repl_buffer = &amp;quot;&amp;quot;&lt;br /&gt;
    displayerror(err)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  return 1&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local function prompt(level)&lt;br /&gt;
  local prompt&lt;br /&gt;
  if level == 1 then prompt=&amp;quot;&amp;gt;&amp;gt;&amp;gt;&amp;quot; else prompt=&amp;quot;...&amp;quot; end&lt;br /&gt;
  io.write(prompt)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local function repl()&lt;br /&gt;
  -- Run a REPL loop in a synchronous fashion.&lt;br /&gt;
  print()&lt;br /&gt;
  prompt(1)&lt;br /&gt;
  for line in io.stdin:lines() do&lt;br /&gt;
    if line == &amp;quot;quit()&amp;quot; then&lt;br /&gt;
      break&lt;br /&gt;
    end&lt;br /&gt;
    if line == &amp;quot;exit()&amp;quot; then&lt;br /&gt;
      break&lt;br /&gt;
    end&lt;br /&gt;
    local level = handleline(line)&lt;br /&gt;
    prompt(level)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return {repl = repl}&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rkrug</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.luatex.org/index.php?title=T_wo_T_r:twotr&amp;diff=3556</id>
		<title>T wo T r:twotr</title>
		<link rel="alternate" type="text/html" href="https://wiki.luatex.org/index.php?title=T_wo_T_r:twotr&amp;diff=3556"/>
		<updated>2021-02-22T18:20:56Z</updated>

		<summary type="html">&lt;p&gt;Rkrug: Rename some files so I could upload them.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== About ==&lt;br /&gt;
&lt;br /&gt;
This is an update and expansion of [[TeX without TeX]] --- using TeX&amp;#039;s&lt;br /&gt;
functionality (typesetting, pdf writing) using only Lua code (no \TeX&lt;br /&gt;
macros).&lt;br /&gt;
&lt;br /&gt;
It is (I believe) an adequate framework for developing a complete&lt;br /&gt;
type-setting system; although one dedicated to a specific task, rather&lt;br /&gt;
than a general purpose system such as LaTeX or ConTeXt. It includes a&lt;br /&gt;
couple of example formatting commands (\Emph and \Bold), titles&lt;br /&gt;
(\Title), the ability to include other subsidiary text files (\Input)&lt;br /&gt;
and footnotes (\Footnote). It can be easily adapted and expanded to&lt;br /&gt;
suit your needs.&lt;br /&gt;
&lt;br /&gt;
I am not much of a programmer, and knew little about TeX and even less&lt;br /&gt;
about Lua when I started this, so there is undoubtedly much that can&lt;br /&gt;
be improved.  All questions, comments, suggestions, and corrections&lt;br /&gt;
will be appreciated. You can reach me at &amp;quot;destiny6 &amp;lt;AT&amp;gt; mac &amp;lt;DOT&amp;gt;&lt;br /&gt;
com&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Pre-requisites ==&lt;br /&gt;
&lt;br /&gt;
This system requires the luatex-plain format (from ConTeXt), so that&lt;br /&gt;
we have access to Open Type Fonts and other goodies. This is what I&lt;br /&gt;
did on my system:&lt;br /&gt;
&lt;br /&gt;
# Find the luatex-plain.tex file. On my system (with TeX-Live 2020)&lt;br /&gt;
it was at:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;code&amp;gt;&lt;br /&gt;
  /usr/local/share/texmf-dist/tex/generic/context/luatex/luatex-plain.tex&lt;br /&gt;
  &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# If you just build a format file,&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;code&amp;gt;&lt;br /&gt;
  luatex --ini /usr/local/share/texmf-dist/tex/generic/context/luatex/luatex-plain.tex&lt;br /&gt;
  &amp;lt;/code&amp;gt; &lt;br /&gt;
  &lt;br /&gt;
  you will probably get warnings about using the &amp;quot;merged&amp;quot; file, and not&lt;br /&gt;
  the more current and supported files. Delete, move, or rename this&lt;br /&gt;
  file. On my system I did:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;code&amp;gt;&lt;br /&gt;
  doas mv /usr/local/share/texmf-dist/tex/generic/context/luatex/luatex-fonts-merged.lua /usr/local/share/texmf-dist/tex/generic/context/luatex/luatex-fonts-merged.lua.bak&lt;br /&gt;
  &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Now, build the format file.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;code&amp;gt;&lt;br /&gt;
  luatex --ini /usr/local/share/texmf-dist/tex/generic/context/luatex/luatex-plain.tex&lt;br /&gt;
  &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# We are almost done. If the resulting format file (luatex-plain.fmt)&lt;br /&gt;
is in the current working directory, you can use it with something&lt;br /&gt;
like:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;code&amp;gt;&lt;br /&gt;
  luatex --fmt luatex-plain test&lt;br /&gt;
  &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# But, this is too restrictive.&lt;br /&gt;
&lt;br /&gt;
  ## Create a new executable with the name luatex-plain. Something&lt;br /&gt;
  like:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;code&amp;gt;&lt;br /&gt;
    ln -s `which luatex` /usr/local/bin/luatex-plain&lt;br /&gt;
    &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  ## When you try to invoke it:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;code&amp;gt;&lt;br /&gt;
    luatex-plain test&lt;br /&gt;
    &amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
  it will fail with a message about failing to find the proper&lt;br /&gt;
  format file. There should be a line something like:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;code&amp;gt;&lt;br /&gt;
    mktexfmt [INFO]: writing formats under ~/.texlive2020/texmf-var/web2c&lt;br /&gt;
    &amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
  so, copy the format file to that location:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;code&amp;gt;&lt;br /&gt;
    cp luatex-plain.fmt ~/.texlive2020/texmf-var/web2c/&lt;br /&gt;
    &amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
  now, this should work:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;code&amp;gt;&lt;br /&gt;
    luatex-plain test&lt;br /&gt;
    &amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
    Finally, run mtxrun to generate a fonts database: &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;code&amp;gt;&lt;br /&gt;
    mtxrun --script fonts --reload --simple&lt;br /&gt;
    &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Contents ==&lt;br /&gt;
&lt;br /&gt;
This files for this project are also available at:&lt;br /&gt;
[https://github.com/s-dismas/TeX-without-TeX-revised GitHub]&lt;br /&gt;
&lt;br /&gt;
There is a Read Eval Print Loop available for interactively exploring:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:repl.lua|repl.lua]]&lt;br /&gt;
&lt;br /&gt;
It can be invoked with &amp;lt;code&amp;gt;repl.repl()&amp;lt;code/&amp;gt;, and either&lt;br /&gt;
&amp;lt;code&amp;gt;quit()&amp;lt;code/&amp;gt; or &amp;lt;code&amp;gt;exit&amp;lt;code/&amp;gt; will exit it. I use Shell Mode in&lt;br /&gt;
Emacs, but a simple terminal or similar should also work.&lt;br /&gt;
&lt;br /&gt;
Some utilites are in the file:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:utils.lua|utils.lua]]&lt;br /&gt;
&lt;br /&gt;
The following five files comprise the system:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:reader.lua|reader.lua]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:format.lua|format.lua]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:main.lua|main.lua]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:pages.lua|pages.lua]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:commands.lua|commands.lua]]&lt;br /&gt;
&lt;br /&gt;
The license for this software can be seen at:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:LICENSE.txt| License.]]&lt;br /&gt;
&lt;br /&gt;
The TeX file to be compiled by luatex-plain is:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:test.tex|test.tex]]&lt;br /&gt;
&lt;br /&gt;
The Lua file executed by &amp;lt;code&amp;gt;\directlua{dofile &amp;quot;test.lua&amp;quot;}&amp;lt;/code&amp;gt;&lt;br /&gt;
within [[T_wo_T_r:test.tex|test.tex]] is:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:test.lua|test.tex]]&lt;br /&gt;
&lt;br /&gt;
The main text file to be typeset is:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:text.tex|text.tex]]&lt;br /&gt;
&lt;br /&gt;
It includes the following five files:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:chapter-1.tex|chapter 1]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:chapter-2.tex|chapter 2]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:chapter-3.tex|chapter 3]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:chapter-4.tex|chapter 4]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:chapter-5.tex|chapter 5]]&lt;/div&gt;</summary>
		<author><name>Rkrug</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.luatex.org/index.php?title=T_wo_T_r:twotr&amp;diff=3553</id>
		<title>T wo T r:twotr</title>
		<link rel="alternate" type="text/html" href="https://wiki.luatex.org/index.php?title=T_wo_T_r:twotr&amp;diff=3553"/>
		<updated>2021-02-22T02:25:57Z</updated>

		<summary type="html">&lt;p&gt;Rkrug: TeX without TeX Revised and expanded&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== About ==&lt;br /&gt;
&lt;br /&gt;
This is an update and expansion of [[TeX without TeX]] --- using TeX&amp;#039;s&lt;br /&gt;
functionality (typesetting, pdf writing) using only Lua code (no \TeX&lt;br /&gt;
macros).&lt;br /&gt;
&lt;br /&gt;
It is (I believe) an adequate framework for developing a complete&lt;br /&gt;
type-setting system; although one dedicated to a specific task, rather&lt;br /&gt;
than a general purpose system such as LaTeX or ConTeXt. It includes a&lt;br /&gt;
couple of example formatting commands (\Emph and \Bold), titles&lt;br /&gt;
(\Title), the ability to include other subsidiary text files (\Input)&lt;br /&gt;
and footnotes (\Footnote). It can be easily adapted and expanded to&lt;br /&gt;
suit your needs.&lt;br /&gt;
&lt;br /&gt;
I am not much of a programmer, and knew little about TeX and even less&lt;br /&gt;
about Lua when I started this, so there is undoubtedly much that can&lt;br /&gt;
be improved.  All questions, comments, suggestions, and corrections&lt;br /&gt;
will be appreciated. You can reach me at &amp;quot;destiny6 &amp;lt;AT&amp;gt; mac &amp;lt;DOT&amp;gt;&lt;br /&gt;
com&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Pre-requisites ==&lt;br /&gt;
&lt;br /&gt;
This system requires the luatex-plain format (from ConTeXt), so that&lt;br /&gt;
we have access to Open Type Fonts and other goodies. This is what I&lt;br /&gt;
did on my system:&lt;br /&gt;
&lt;br /&gt;
# Find the luatex-plain.tex file. On my system (with TeX-Live 2020)&lt;br /&gt;
it was at:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;code&amp;gt;&lt;br /&gt;
  /usr/local/share/texmf-dist/tex/generic/context/luatex/luatex-plain.tex&lt;br /&gt;
  &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# If you just build a format file,&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;code&amp;gt;&lt;br /&gt;
  luatex --ini /usr/local/share/texmf-dist/tex/generic/context/luatex/luatex-plain.tex&lt;br /&gt;
  &amp;lt;/code&amp;gt; &lt;br /&gt;
  &lt;br /&gt;
  you will probably get warnings about using the &amp;quot;merged&amp;quot; file, and not&lt;br /&gt;
  the more current and supported files. Delete, move, or rename this&lt;br /&gt;
  file. On my system I did:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;code&amp;gt;&lt;br /&gt;
  doas mv /usr/local/share/texmf-dist/tex/generic/context/luatex/luatex-fonts-merged.lua /usr/local/share/texmf-dist/tex/generic/context/luatex/luatex-fonts-merged.lua.bak&lt;br /&gt;
  &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Now, build the format file.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;code&amp;gt;&lt;br /&gt;
  luatex --ini /usr/local/share/texmf-dist/tex/generic/context/luatex/luatex-plain.tex&lt;br /&gt;
  &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# We are almost done. If the resulting format file (luatex-plain.fmt)&lt;br /&gt;
is in the current working directory, you can use it with something&lt;br /&gt;
like:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;code&amp;gt;&lt;br /&gt;
  luatex --fmt luatex-plain test&lt;br /&gt;
  &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# But, this is too restrictive.&lt;br /&gt;
&lt;br /&gt;
  ## Create a new executable with the name luatex-plain. Something&lt;br /&gt;
  like:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;code&amp;gt;&lt;br /&gt;
    ln -s `which luatex` /usr/local/bin/luatex-plain&lt;br /&gt;
    &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  ## When you try to invoke it:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;code&amp;gt;&lt;br /&gt;
    luatex-plain test&lt;br /&gt;
    &amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
  it will fail with a message about failing to find the proper&lt;br /&gt;
  format file. There should be a line something like:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;code&amp;gt;&lt;br /&gt;
    mktexfmt [INFO]: writing formats under ~/.texlive2020/texmf-var/web2c&lt;br /&gt;
    &amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
  so, copy the format file to that location:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;code&amp;gt;&lt;br /&gt;
    cp luatex-plain.fmt ~/.texlive2020/texmf-var/web2c/&lt;br /&gt;
    &amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
  now, this should work:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;code&amp;gt;&lt;br /&gt;
    luatex-plain test&lt;br /&gt;
    &amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
    Finally, run mtxrun to generate a fonts database: &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;code&amp;gt;&lt;br /&gt;
    mtxrun --script fonts --reload --simple&lt;br /&gt;
    &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Contents ==&lt;br /&gt;
&lt;br /&gt;
This files for this project are also available at:&lt;br /&gt;
[https://github.com/s-dismas/TeX-without-TeX-revised GitHub]&lt;br /&gt;
&lt;br /&gt;
There is a Read Eval Print Loop available for interactively exploring:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:repl.lua|repl.lua]]&lt;br /&gt;
&lt;br /&gt;
It can be invoked with &amp;lt;code&amp;gt;repl.repl()&amp;lt;code/&amp;gt;, and either&lt;br /&gt;
&amp;lt;code&amp;gt;quit()&amp;lt;code/&amp;gt; or &amp;lt;code&amp;gt;exit&amp;lt;code/&amp;gt; will exit it. I use Shell Mode in&lt;br /&gt;
Emacs, but a simple terminal or similar should also work.&lt;br /&gt;
&lt;br /&gt;
Some utilites are in the file:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:utils.lua|utils.lua]]&lt;br /&gt;
&lt;br /&gt;
The following five files comprise the system:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:reader.lua|reader.lua]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:format.lua|format.lua]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:main.lua|main.lua]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:pages.lua|pages.lua]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:commands.lua|commands.lua]]&lt;br /&gt;
&lt;br /&gt;
The license for this software can be seen at:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:LICENSE.txt| License.]]&lt;br /&gt;
&lt;br /&gt;
The TeX file to be compiled by luatex-plain is:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:test.tex|test.tex]]&lt;br /&gt;
&lt;br /&gt;
The Lua file executed by &amp;lt;code&amp;gt;\directlua{dofile &amp;quot;test.lua&amp;quot;}&amp;lt;/code&amp;gt;&lt;br /&gt;
within [[T_wo_T_r:test.tex|test.tex]] is:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:test.lua|test.tex]]&lt;br /&gt;
&lt;br /&gt;
The main text file to be typeset is:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:text.txt|text.txt]]&lt;br /&gt;
&lt;br /&gt;
It includes the following five files:&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:chapter-1.txt|chapter 1]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:chapter-2.txt|chapter 2]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:chapter-3.txt|chapter 3]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:chapter-4.txt|chapter 4]]&lt;br /&gt;
&lt;br /&gt;
[[T_wo_T_r:chapter-5.txt|chapter 5]]&lt;/div&gt;</summary>
		<author><name>Rkrug</name></author>
		
	</entry>
</feed>