GithubHelp home page GithubHelp logo

garkgarcia / asciidoctor-mathematical Goto Github PK

View Code? Open in Web Editor NEW

This project forked from asciidoctor/asciidoctor-mathematical

0.0 1.0 0.0 56 KB

An extension for Asciidoctor that converts the content of STEM blocks and inline macros using Mathematical.

License: MIT License

Ruby 100.00%

asciidoctor-mathematical's Introduction

asciidoctor-mathematical

Alternative stem processor for asciidoctor based on Mathematical.

Features

asciidoctor-mathematical processes latexmath and stem blocks and inline macros and replaces them with generated SVG or PNG images, thus enables stem contents on a much wider range of asciidoctor backends. Currently, it is tested to works well with the html, docbook, pdf and latex backends. For stem blocks and macros, only the latexmath type is supported.

Package Specific Attributes

These attributes can be set to tweak behaviors of this package:

attribute description valid values default value
mathematical-format format of generated images svg, png png
mathematical-ppi ppi of generated images, only valid for png files any positive number 300.0
mathematical-inline if present will inline equations as svg (only useful for HTML output) true/false false

Usage

asciidoctor-pdf -r asciidoctor-mathematical -o test.pdf sample.adoc

Installation

asciidoctor-mathematical is now available on RubyGems. Installation is done by gem install asciidoctor-mathematical. Install dependencies first.

Dependencies

make, gobject, glib, gio, gdk-pixbuf, gdk, cairo, pangocairo, libxml, bison, flex

For the runtime, the following ttf fonts should be installed: cmr10, cmmi10, cmex10 and cmsy10. They are provided by the lyx-fonts package in fedora, and the fonts-lyx (or previously ttf-lyx) package in debian/ubuntu. In Arch Linux you can install the ttf-computer-modern-fonts package from AUR, you also have the lyx package in extra repo though; both are providing required Computer Modern fonts.

OS X

Make sure you brew install glib gdk-pixbuf cairo pango cmake

You can install the font dependencies by using

cd ~/Library/Fonts
curl -LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/cmex10.ttf \
     -LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/cmmi10.ttf \
     -LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/cmr10.ttf \
     -LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/cmsy10.ttf \
     -LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/esint10.ttf \
     -LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/eufm10.ttf \
     -LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/msam10.ttf \
     -LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/msbm10.ttf

If you experience any compilation errors (caused by Mathematical) try running: brew link gettext --force (you can unlink the libraries later if you want).

Ubuntu

sudo apt-get -qq -y install bison flex libffi-dev libxml2-dev libgdk-pixbuf2.0-dev libcairo2-dev libpango1.0-dev fonts-lyx cmake

Fedora 28

sudo dnf --setopt=install_weak_deps=False install -y \
  bison \
  cairo-devel \
  cmake \
  flex \
  gcc-c++ \
  gdk-pixbuf2-devel \
  libffi-devel \
  libxml2-devel \
  make \
  lyx-fonts \
  pango-devel \
  redhat-rpm-config \
  ruby-devel

The mathematical gem cannot currently be installed on Fedora 29.

Trouble Shooting

The mathematical gem, which is a hard dependency of asciidoctor-mathematical, may fail to build because of its over-writing of strdup. Whether it fail depends on the system. In case it fails, use the following command to install mathematical (see gjtorikian/mathematical#64 for the details):

MATHEMATICAL_SKIP_STRDUP=1 gem install mathematical

asciidoctor-mathematical's People

Contributors

programfan avatar tstumm avatar dalemartin avatar mojavelinux avatar jfernandz avatar lurch avatar bwittman avatar hakandilek avatar lschmelzeisen avatar krooze avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.