Skip to main content

The PreTeXt Guide

Subsection 5.2.4 Viewing output: pretext view

After you convert your source into, say HTML, you can view the output using the command:
$ pretext view web
This will direct you to open a local server at a provided address (perhaps http://localhost:8000). Replace “web” in the above with other build targets as appropriate.
If you are on your own machine (i.e., not CoCalc), pretext view will attempt to open your default program for the type of file you are opening. You can prevent this attempt using the --no-launch flag.
The pretext view command accepts a useful option for small projects that allow you to automatically rebuild your source every time you save it. Try:
$ pretext view web --watch
(You can use -w as a shorthand for --watch.) This currently only supports HTML-format targets.
When you are done, stop the server by hitting CTRL+C

Shortcut 5.2.4.2.

In addition to the watch option -w, you can use the flags -b to build before viewing, -g to generate assets before viewing, or combine these with -bg.
Note that the project is only viewable on your local machine (even if you are working in CoCalc). To make the output available to the public, you will need to copy the output to a web server, or use the pretext deploy command, described below.