Appendix K Windows Subsystem for Linux
The Windows Subsystem for Linux (WSL) may be installed on computers running Windows 10. Several distributions of Linux are available. We will use Ubuntu as an example; working with other distributions is quite similar. The latest news and announcements about WSL may be found at
If you have Windows 10 with OS Build greater than 16215 (August 2016), then installing WSL is not difficult. Just follow the (reasonably straightforward) instructions given by Microsoft at the address
Upon completion of the installation, you should
be able to use the
bashcommand from the
have your own WSL userid (distinct from Windows),
have your own WSL password (distinct from Windows).
The default configuration of WSL does not have the software needed for creating documents with PreTeXt.
The program xsltproc is used to create your readable documents. It is installed with the command
sudo apt-get install xsltproc.
You are now ready to set up PreTeXt.
Putting PreTeXt on your computer.
Here are the steps necessary to get the PreTeXt software onto your computer:
Make a new directory
Make your own clone of the PreTeXt repository
git clone https://github.com/PreTeXtBook/pretext.git
Move to the new directory
Initialize the new directory with
This last command synchronizes your files with those in the official repository. You should run it frequently to keep your files up to date.
The simplest example.
Here is a brief description of the use of WSL to create readable files. You, as the author, create the xml file. The system will contain an appropriate xsl file that translates your xml file to something readable.
Several editors come with WSL by default including nano, pico, vi, and vim. In addition, editing is possible using notebook.exe. Here are the steps to follow:
Type the command
cdto align yourself in your home directory.
Use one of the editors to create a file called
hw.xml(you could use the command
nano hw.xml), and add the following text:
<?xml version="1.0" encoding="UTF-8" ?> <pretext> <article xml:id="hw"> <p>Hello, World!</p> </article> </pretext>
Run the command
xsltproc mathbook/xsl/pretext-html.xsl hw.xmlUpon completion, your should have a file called
You now want to view the
hw.htmlfile in a browser, This is done with the command
edit-xsltproc-view cycle just given may seem daunting at first blush. Some things that can help:
Pressing the up arrow when at the command line displays the previously executed commands. Hitting the enter key while such a command is displayed executes it. This saves a lot of retyping.
It is possible to define aliases to shorten commands. Your local Linux guru can show how this is done.
It is possible to define scripts to shorten multiple commands. Your local Linux guru can show how this is done.