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
  • 7 years ago
  • 2 hours ago
  • 12 years ago

Installs

  • Total 8K
  • Win 3K
  • Mac 3K
  • Linux 2K
Mar 29 Mar 28 Mar 27 Mar 26 Mar 25 Mar 24 Mar 23 Mar 22 Mar 21 Mar 20 Mar 19 Mar 18 Mar 17 Mar 16 Mar 15 Mar 14 Mar 13 Mar 12 Mar 11 Mar 10 Mar 9 Mar 8 Mar 7 Mar 6 Mar 5 Mar 4 Mar 3 Mar 2 Mar 1 Feb 29 Feb 28 Feb 27 Feb 26 Feb 25 Feb 24 Feb 23 Feb 22 Feb 21 Feb 20 Feb 19 Feb 18 Feb 17 Feb 16 Feb 15 Feb 14 Feb 13
Windows 0 1 1 1 0 0 2 0 0 2 1 1 2 0 0 3 0 0 1 0 1 2 3 1 1 1 0 0 0 1 0 3 0 1 0 0 0 3 0 1 1 0 2 2 0 2
Mac 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 1 5
Linux 0 1 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 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