Skip to content

mhartl/jekyll-latex

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code
This branch is 11 commits ahead, 9 commits behind jekyll:master.

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
lib
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Jekyll::Latex

Use LaTeX with Jekyll.

Supports all LaTeX syntax supported by PolyTeXnic. For Jekyll 3.0 and up.

Installation

Add this line to your application's Gemfile:

gem 'jekyll-latex'

And then execute:

$ bundle

Or install it yourself as:

$ gem install jekyll-latex

Lastly, add it to the plugins section of the _config.yml file:

plugins:
  - jekyll-latex

Usage

Create files with the .tex extension in the _posts directory, as in

_posts/2017-07-12-test-post.tex:

---
layout: post
title:  "Welcome to Jekyll 3"
categories: jekyll update
published: true
---

This is a \LaTeX\ file. 

\emph{This} is a \LaTeX\ file. 

This \emph{is} a \LaTeX\ file.

Mathematics

To get mathematics to render, you should include MathJax on your site. The simplest configuration looks like this and should be put in the head of your page:

<!DOCTYPE html>
<html>
  .
  .
  .
  <head>
    .
    .
    .
    <script type="text/javascript" async
  src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML">
    </script>
  </head>
  <body>
    .
    .
    .
  </body>
</html>

MathJax includes many options; here’s one configuration that I like that hides the “processing” message and supports dollar-sign-style math input like $x$ (note that this means you will have to escape out literal dollar signs with a leading backslash, as in This costs \$20):

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS_HTML">
  MathJax.Hub.Config({
    "HTML-CSS": {
      availableFonts: ["TeX"],
    },
    tex2jax: {
      inlineMath: [['$','$'],["\\(","\\)"]]},
      displayMath: [ ['$$','$$'], ['\[','\]'] ],
    TeX: {
      extensions: ["AMSmath.js", "AMSsymbols.js", "color.js"],
      equationNumbers: {
        autoNumber: "AMS"
      }
    },
    showProcessingMessages: false,
    messageStyle: "none",
    imageFont: null,
    "AssistiveMML": { disabled: true }
  });
</script>

About

LaTeX converter for Jekyll

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 92.3%
  • HTML 4.1%
  • Shell 3.6%