dotnet new -i FsLab.Templates dotnet new fslab-journal -lang F# -n Experiment1 cd Experiment1
This creates a new journal. The templates work on Linux, OSX and Windows, and you can edit with Emacs, VSCode, Visual Studio, Vim and other F# editors.
You can now generate HTML and show it:
build run to both show and watch for changes:
You can now edit
Experiment1.fsx or open
The templates are designed to be used from F# Interactive. Select a couple of lines of code and use "Alt+Enter" (in Visual Studio), "Ctrl+Enter" (in VSCode) or other command to send the code to F# Interactive.
The template comes with build scripts
build.cmd that can be used
build rungenerates HTML outputs, opens them in a browser and automatically updates them when the source files change
build showgenerates HTML and shows it
build rungenerates HTML, shows it and watches for changes
build latexgenerates LaTeX output
build pdfgenerates LaTeX and also invokes
The templates use Paket for dependency management. When you use the templates, you'll need to run Paket to get the dependencies. This happens automatically when you build the project, but you can also do it by hand.
In the basic template, run
For example, when using mono on Mac, run:
In the journal template you can use build scripts
The following will process all journals and open them in a web browser:
FsLab is available on NuGet as
To use it directly, create a new project (F# Tutorial is a good start in Visual Studio and VSCode). Then add reference to the FsLab NuGet package and wait until all components are downloaded.
Finally add a new script file, say
Tutorial.fsx and load
FsLab.fsx using the
following command (the version will differ, so you'll have to check the created
packages directory; when the project is in a sub-folder you'll also need
When referencing FsLab using Paket, you'll need to download the latest version of
Paket and create a file called
paket.dependencies with the following contents:
1: 2: 3:
This specifies that Paket should install the
FsLab package for you. Then
run the following command (drop
mono on Windows):
The typical usage is to put
paket.exe into a sub-folder called
.paket, but this
is completely up to you. Paket will drop the version numbers from folder names, so
you can reference FsLab as follows in your scripts:
paket.lock file with the information about installed versions.
Paket makes it easy to update to the latest version of FsLab. Just run