Back to home

Here’s what I did to set up this site

I originally forked Barry Clark’s jekyll-now repository, but then I deleted everything except those things that were absolutely necessary. I plan to possibly add these things back in as I understand them. The bulk of these things I don’t understand because I don’t know css, so I guess I should learn css next. But is it really so bad if a website looks really minimal like this? Maybe I could still do a minimal look better by knowing css.

Also, jekyll seems to be designed for blogs, but I don’t plan for this site to be a blog, so I got rid of the stock index.html with its fee, iterating through the posts in the _posts directory. I also removed the _posts directory. In the place of index.html, I put an index.md file.

KaTeX Support

I thought KaTeX was pretty cool, because it does annoy me how long MathJax takes to load. I got it working by copying the KaTeX layout from here. Here are some examples:

\[\frac{3}{2}=\int_{-\infty}^\epsilon\dfrac{x}{y}+\textrm{some text}\]

Here is some inline math: \(x\), \(y\), and \(x+y=\frac{2}{3}\sim\dfrac{3}{2}\).

Windows Development Environment

I am doing this on Windows! It was really time-consuming to set up a way to host the website locally! I had to install all sorts of things, like chocolatey and ruby. As usual, the information was scattered all over the web. This guide in particular really helped.

Here is what I think I did (I don’t remember exactly, but it’s better than nothing):

> Set-ExecutionPolicy RemoteSigned
> (new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1') | iex
$ choco install ruby
$ cd
$ touch .bashrc
$ echo "export SSL_CERT_DIR=/mingw64/ssl/certs" >> .bashrc
$ echo "export SSL_CERT_FILE=/mingw64/ssl/cert.pem" >> .bashrc
$ source .bashrc

Now close git-bash and restart it.

$ gem install github-pages

Now, to host a github-pages website locally, type

$ jekyll serve --watch

and go in your browser to “localhost:4000”.

Download the version of DevKit from here corresponding to your version of Ruby. (To see what version of Ruby you have, type ruby -v in git-bash.

In git-bash, navigate to wherever you unpacked DevKit and type:

$ ruby dk.rb init

Find where Ruby was installed, and add a line with a space, a dash, a space, and then the path of the Ruby directory to the config.yml file in the DevKit directory. This line should look something like this:

 - C:/Tools/ruby23

Then type:

$ ruby dk.rb install

You also need the bundle gem:

$ gem bundle

Now, whenever you edit the Rubyfile, you have to type this:

$ gem install

to generate a Rubyfile.lock file.

Then instead of jekyll serve, you have to type bundle exec jekyll serve.

Haskell Diagrams

The diagrams this site are svg files that are generated with Haskell diagrams. Here is an example:

All of the svg files, and the lhs files that generate them, are in _includes/svg/diagrams/. To compile them yourself, first install the Haskell platform. Then update cabal, the Haskell package manager, and use it to make a sandbox in your working directory:

$ cabal update
$ cabal sandbox init

Now install diagrams:

$ cabal install diagrams -j1

The -j1 flag is only necessary for Windows. It prevents cabal from editing the package.cache file multiple times at one, which is a problem for Windows but not for *nix. See here and here for more information.

Then you can compile a haskell file diagram.lhs with

$ cabal exec -- ghc --make diagram.lhs

or, in PowerShell,

> cabal exec (ghc --make diagram.lhs)

This runs ghc --make diagram.lhs in the sandbox environment, which generates an executable diagram.exe. We now run this executable to generate an svg file diagram.svg.

Bash:

$ ./diagram

Cmd.exe

> diagram.exe

PowerShell

> .\diagram.exe

If you are using bash, then you can run the shell script ./compileDiagrams.sh. This compiles some or all of the haskell files in _includes/svg/diagrams/, executes the resulting executables, and also does some postprocessing (replaces & with & to reverse the xml-encoding of the svg builder).

To use this script on all diagrams:

$ ./compileDiagrams

To use it just on diagrams thisOne.lhs, thisOneToo.lhs, and alsoThis.lhs:

$ ./compileDiagrams thisOne.lhs thisOneToo.lhs alsoThis.lhs

View this page on github to suggest edits.