ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Pandoc Academic

by larlequin ALL

A Sublime Text 2/3 plugin to handle Pandoc document (syntax) add functionnalities (bibliography, etc.) and convert them to other formats.

Details

  • 2017.02.21.00.50.36
  • github.​com
  • github.​com
  • 8 years ago
  • 1 hour ago
  • 12 years ago

Installs

  • Total 8K
  • Win 3K
  • Mac 3K
  • Linux 2K
Nov 11 Nov 10 Nov 9 Nov 8 Nov 7 Nov 6 Nov 5 Nov 4 Nov 3 Nov 2 Nov 1 Oct 31 Oct 30 Oct 29 Oct 28 Oct 27 Oct 26 Oct 25 Oct 24 Oct 23 Oct 22 Oct 21 Oct 20 Oct 19 Oct 18 Oct 17 Oct 16 Oct 15 Oct 14 Oct 13 Oct 12 Oct 11 Oct 10 Oct 9 Oct 8 Oct 7 Oct 6 Oct 5 Oct 4 Oct 3 Oct 2 Oct 1 Sep 30 Sep 29 Sep 28 Sep 27
Windows 0 0 0 0 1 1 1 1 1 1 0 0 0 1 0 0 1 0 0 0 0 1 2 1 0 1 0 1 1 1 1 0 1 0 3 0 0 1 2 2 1 1 1 1 1 1
Mac 0 1 0 1 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0
Linux 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

Pandoc Academic Plugin for Sublime Text 2/3

A Sublime Text 2/3 plugin to handle Pandoc. The plugin proposes:

  • a syntax highlighting tool associated with two dark color themes,
  • different snippets to quickly add Pandoc functions
  • a conversion tool to transform a Pandoc file to HTML, DocX, PDF and Beamer documents.

Based on the Pandoc Render plugin.

Version

Plugin version: v1.1 – Automatically launch the file-associated program after the compilation.

Plugin version: v1.2 – Add the grid table module and the LaTeX class option.

Plugin version: v1.3 – Convert the script to run on Python 3 / Sublime Text 3

Installation

The easiest way to install the package is to use the package control manager. Go to Preferences > Package Control > Install Package and search for “Pandoc Academic”.

You can also install the plugin manually. Download the latest version from Github and copy the folder into your Sublime Text 2 Packages folder. (for instance in Linux: ~/.config/sublime-text-2/Packages).

$ git clone git@github.com:larlequin/PandocAcademic.git

Dependencies

You need to have a working installation of Pandoc, version 1.9.4.2 or higher.

Available Commands

Syntax and color scheme

You can select the syntax for a markdown file (Pandoc) in the Menu: View > Syntax > Pandoc. This syntax should be selected to make the conversion menu available.

The compatible color schemes are available in the Menu: Preferences > Color Scheme > Pandoc Academic > ColorScheme.

Conversion

Conversions are available in the Menu: Tools > Pandoc Academic > Pandoc Convert (only if Pandoc is defined as syntax). You can convert a Pandoc file to:

  • HTML
  • DocX
  • PDF (via LaTeX, see Pandoc documentation)
  • Beamer (via LaTeX, see Pandoc documentation)

You can also use key shortcuts to launch the conversions:

  • HTML > CTL+ALT+h
  • DocX > CTL+ALT+d
  • Beamer > CTL+ALT+b
  • PDF > CTL+SHIFT+ALT+p

Snippets

Generic snippets:

  • co + tabulation = snippet to add a comment (HTML format)
  • bo + tabulation = snippet to add bold text in Pandoc/Markdown (**)
  • it + tabulation = snippet to add italic text in Pandoc/Markdown (*)
  • link + tabulation= snippet to add a web link in Pandoc/Markdown

Figures and Tables:

  • img + tabulation = snippet to add a picture in Pandoc
  • tab + tabulation = snippet to add a table from a file and its title (as for an article)

Citation/bibliography snippets:

  • ci + tabulation = snippet to add a citation in brackets [text? @citationkey]
  • bib + tabulation = add the [[BIB]] option to the current file

Mathematic snippets:

  • mat + tabulation = snippet to add mathematics based on LaTeX style
  • pow + tabulation = snippet to add the eta squared symbol

Other snippets:

  • not + tabulation = add a footnote
  • toc + tabulation = add the [[TOC]] option to the current file
  • temp + tabulation = add the [[DOCSYTLE=name]] option to the current file
  • class + tabulation= add the [[CLASS=name]] option to the current file
  • head + tabulation = add the [[HEADER]] option to the current file
  • rend + tabulation = add the [[NORENDER]] option to the current

Pandoc Options

The following hints can be added in your document to flip on additional features in Pandoc:

  • \: Add a Table of Contents to the top of your output document.
  • \: Turn on numbering of sections.
  • \: Add the bibliography option to handle citation and reference (@citationkey). The bibliography file should have the same name as the Pandoc file.
  • \: Specify a csl bibliography style.
  • \: Specify a template for the convertion to HTML or DOCX or theme in Beamer.
  • \: Specify a class type to use for a PDF, LaTeX or Beamer document.
  • \: Add the option to add a custom header for the convertion to Beamer (the file should be in the same directory as the Pandoc file).
  • \: Option to not automatically start the associated program.

Note: these hints are processed by the plugin and are NOT part of Pandoc itself.

Templates

The Templates could be found in the “Styles” folder in the Pandoc plugin folder (in the package folder of Sublime Text). The version comes with a standard html and docx template (from the Pandoc Render plugin) and with an APA guideline DOCX template.

You can use your custom templates by specifying the path in addition of the template name in the option BIBSTYLE, DOCSTYLE, CLASS and HEADER.

Tables

Create a grid table in Pandoc is a laborious task. With Pandoc Academic you can create or extend existing grid tables easily.

The module will automatically add filling dashed and cross. The module will also automatically resize the columns widths based on the longest cell of each column. You can handle empty cells and extend an existing grid table.

Create a new table

To create a new table, just type your data with at least 2 spaces to separate the columns.

Example:

Conditions  Col1  Col2  Col3
Line 1  data1  data2  data3
Line 2  data4  data5  data6

Then select the data with your mouse and go to Tools > Pandoc Academic > Pandoc Table or use the shortcut CTL+SHIFT+ALT+t. You should see:

+------------+-------+-------+-------+
| Conditions | Col1  | Col2  | Col3  |
+============+=======+=======+=======+
| Line 1     | data1 | data2 | data3 |
+------------+-------+-------+-------+
| Line 2     | data4 | data5 | data6 |
+------------+-------+-------+-------+

The module will always consider the first line as the title line. If one or more cells should be empty just type NA in.

Extend an existing table

The module allows to extend an existing table. Just add the new data or modify the current one, and use the module:

+------------+-------+-------+-------+
| Conditions | Col1  | Col2  | Col3  | Col4
+============+=======+=======+=======+
| Line 1     | rename | data2 | data3 | data7
+------------+-------+-------+-------+
| Line 2     | data4 | long long data | data6 | data8
+------------+-------+-------+-------+

will become:

+------------+--------+----------------+-------+-------+
| Conditions | Col1   | Col2           | Col3  | Col4  |
+============+========+================+=======+=======+
| Line 1     | rename | data2          | data3 | data7 |
+------------+--------+----------------+-------+-------+
| Line 2     | data4  | long long data | data6 | data8 |
+------------+--------+----------------+-------+-------+

Path option

If Pandoc is not in the path of Sublime Text, you can specify a custom path in your file with the following command: [[PATH=path_name]].

If you want to change the path used by the plugin, you can edit the plugin file “PandocConvertor.py”. Change the line 146:

cmd = ['pandoc']

with:

cmd = ['your_path']

Disclosure

I am an academic guy, not a software programmer or a computer guru. This plugin is therefore missing some features and could be improved. I try to do my best, but I need your feedbacks to help me to do so: larlequin@gmail.com. In the same vein, if you're willing to help or to be involved in this project, your participation is more than welcome.

Thanks!

Guillaume