Skip to content

Instantly share code, notes, and snippets.

@alisianoi
Created March 29, 2015 13:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alisianoi/fdbb327cba1aa79c8b17 to your computer and use it in GitHub Desktop.
Save alisianoi/fdbb327cba1aa79c8b17 to your computer and use it in GitHub Desktop.
---
layout: post
title: "Octopress on Arch Linux: caveats"
date: 2014-07-05 23:20:00 +0400
comments: true
categories: [Octopress, Arch Linux, workarounds]
---
Introduction
------------
[Octopress][2] is a framework designed for [Jekyll][3], the static
blogging engine powering [Github Pages][4]. It allows somebody who
knows next to nothing about HTML and CSS have a decent--looking blog
in little time. However, certain git skills are required but no
worries as there is helpful documentation with specific howtos.
Adding $\LaTeX$ support
-----------------------
Based on [this article][6] and [MathJax docs][7].
1. Add the `gem kramdown` line (with appropriate versioning) to the
`Gemfile`, then run `bundle install`.
2. Edit `_config.yml`, replace the `markdown: rdiscount` line with
`markdown: kramdown`. The latter is a fast, pure-Ruby
Markdown-superset converter.
3. Open `source/_includes/custom/head.html`, and add the following
scripts to use MathJax.
``` javascript
<!-- MathJax -->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
processEscapes: true
}
});
</script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
}
});
</script>
<script type="text/x-mathjax-config">
MathJax.Hub.Queue(function() {
var all = MathJax.Hub.getAllJax(), i;
for(i=0; i < all.length; i += 1) {
all[i].SourceElement().parentNode.className += ' has-jax';
}
});
</script>
<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<!-- MathJax finished -->
```
You should now be all set. However, if you do `rake preview` while
offline, you will not have your $\LaTeX$ rendered nicely. Currently I
do not know how to setup offline $\LaTeX$ rendering.
Running Google Analytics
------------------------
To enable this evil beast in your blog, add your tracking ID into `_config.yml`
and insert the following lines into `source/_includes/google_analytics.html`
``` javascript
_gaq.push(['_setAccount', '{{ site.google_analytics_tracking_id }}']);
_gaq.push(['_setDomainName','username.github.io']);
_gaq.push(['_trackPageview']);
```
where instead of `username.github.io` you need to insert your domain name.
Conclusion
----------
That is it for now, if I get into more trouble, I will update this
post. By the way, if you find the official Jekyll documentation hard
to understand, here is an [alternative source][5].
[1]: https://www.archlinux.org/
[2]: http://octopress.org/
[3]: http://jekyllrb.com/
[4]: https://pages.github.com/
[5]: http://jekyllbootstrap.com/lessons/jekyll-introduction.html
[6]: http://blog.zhengdong.me/2012/12/19/latex-math-in-octopress
[7]: http://docs.mathjax.org/en/latest/platforms/index.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment