Coder Social home page Coder Social logo

pandoc-filters's Introduction

pandoc-filters

Pandoc needs a bit of help to give the full academic writing experience. In particular, we're missing a few important features from LaTeX:

  • internal references to figures and tables
  • ability to use certain formatting environments (e.g. sidewaysfigure / sidewaystable)

The filters here try to help.

Usage

  1. git clone the directory to your favorite folder

  2. compile the filters you want with ghc (e.g. ghc --make pandoc-internalref.hs) -- at some point I might push these onto cabal

  3. add the filter when you run pandoc (pandoc in.md -o out.pdf --filter PATH/TO/pandoc-internalref)

pandoc-internalref

pandoc-internalref tries to implement the internal reference format suggested by jgm:

![Image Caption!](image-place.png){#fig:image-ref class1 class2}

What a great [figure!](#fig:image-ref)

The filter transforms this to the equivalent of:

<div id="fig:image-ref" class="class1 class2">
![Image Caption!](image-place.png)

</div>

Currently, pandoc-internalref only works for figures. What happens:

  • the filter looks for single-image paragraphs with an attributes specification {#fig:* class1 class2 ...}
  • the filter replaces the image paragraph with an internal div element having identifier "fig:*" and classes "class1 class2 ..."
  • for latex/pdf (and native for debugging) output, it adds a \label{fig:*} to the image caption
  • for latex/pdf (+native) output, it wipes out the text of links pointing to #fig:* or #tab:* in favor of \ref*{fig:*} or \ref*{tab:*}

This should work for most cases, though it does mean that at the present moment you need to name/number your figures by hand for formats other than latex: I can't think of a good way to write text that sounds good in latex "Figure \ref" and html "The figure" writing styles. Suggestions welcome.

It might be possible to make the latex filter write something like Figure \ref*{} if not for capitalization issues.

TODO:

  • tables

pandoc-sideways

pandoc-sideways reads the classes of a div to apply special LaTeX environments.

This is a pain, as the filter has to write all of the latex -- pandoc's standard writer is no help.

TODO:

  • implement any of this

pandoc-filters's People

Contributors

aaren avatar balachia avatar

Watchers

 avatar  avatar  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.