npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@mpoteat/md2latex

v1.1.0

Published

Convert Markdown to IEEE-standard LaTeX for academic publishing

Downloads

3

Readme

md2latex: Fast Academic Writing

Markdown is an efficient way to write documents, but is not usually appropriate for generating academic-style documents. To fix this, md2latex is a simple parser that transforms Markdown to IEEE-styled LaTeX. It is inspired by Pandoc.

How to install

If you're using it from the command line for general purposes, you probably want to install globally from npm:

npm i -g md2latex

If you're using it to generate documentation for a specific project, you can install it locally to the specific project:

npm i md2latex --save-dev

To utilize the automatic LaTeX compilation and preview features, you will need latexmk and SumatraPDF (if on Windows). If you utilize a different PDF viewer, or a different LaTeX build tool, you can customize that in config.json.

How to use

If you installed globally, there should exist a command hook "md2latex" that allows you to use it from the command line (i.e. on the PATH):

md2latex docs/example.md

If it's installed locally, you will have to access the command wrapper file manually:

./node_modules/md2latex/cmd.js docs/example.md

Your md file should have a copy of IEEETrans.cls beside it. A copy is provided under md2latex/lib/.

For a simple example of syntax, see example/test1.md.

Introduction

Markdown is typically used by the software development community for generating code documentation and simple web content publishing (e.g. blogs). It is a light-weight markup language designed to be human readable in its raw text format, and is usually rendered as HTML.

On a number of fronts, Markdown is being used to drive literate programming efforts. It has also been used for document generation by replacing the "copy-and-paste workflow" in statistical analysis in order to improve reproducibility in the sciences.

However, Markdown does not generate documents appropriate for traditional academic publishing, such as publication to conference proceedings or research journals. One promising solution is to convert Markdown to a format more suitable for publication. One popular tool, Pandoc, is capable of converting Markdown to LaTeX, but due to limitations in its internal document representation, does not support many LaTeX features.

Pandoc can convert from and to many formats, and additional destination formats can be specified using LUA scripts. However, one cannot specify custom input formats without modifying Pandoc itself, which is intimidating as the Markdown parser itself is over 2000 lines of sparsely commented Haskell code. This is a problem, because there exist vital elements in LaTeX which do not exist in vanilla Markdown, such as author sections, bibliographies, etc.

md2latex is a simple, extensible parser that transforms Markdown to IEEE-styled LaTeX

Markdown Parsing via Regular Expressions

To parse Markdown into an internal JSON object, we use regular expressions. Since Markdown is ambiguous, parsing it using "regular" expressions (as in a regular language) is not possible from a theoretical standpoint. In fact, any context-free grammar for parsing Markdown (such as BNF) also becomes intractably ambiguous.

However, JS-style regular expressions are not equivalent to what is traditionally meant by a "regular expression". As well, certain structures involving repeated find-replace operations are Turing complete. For this reason, we approach parsing via repeated regular expression matching, with each element type possessing a priority (order) in being matched.