Giter Club home page Giter Club logo

parse-latex-noeq's Introduction

Parse LaTeX but not equations– a Lua filter

This is a fork from tarleb's parse-latex filter to make it work with the mathjax3eqno quarto extension.

A filter to use when the input contains raw LaTeX that should be included in other output formats. The filter uses pandoc's LaTeX reader to parse raw snippets.

Functionality (from original)

The intended use for this filter are cases in which a Markdown document contains LaTeX snippets that are not just formatting additions, but a part of the content. Any raw LaTeX snippet, such as \textcolor{red}{lorem ipsum}, will be parsed as LaTeX. The result is then re-inserted into the document, replacing the snippet. The above will yield <span style="color: red">lorem ipsum</span> when converting to HTML.

The snippets will be passed through unchanged when converting to LaTeX/PDF.

The filter is particularly useful with tables: it becomes possible to use some of extra power of LaTeX, while still getting sensible output with other formats. E.g.:

```{=latex}
\begin{tabular}{|l|l|}
 \hline
 one & two \\
 \hline
 three & four \\
 \hline
\end{tabular}
```

The PDF output will have horizontal and vertical table lines, something that's otherwise difficult to accomplish with pandoc.¹

The filter uses pandoc's LaTeX parser, so if pandoc cannot parse a LaTeX snippet, then neither can this filter.

¹ The reason for this is that vertical lines in tables are considered as ugly and bad style by most typographers.

Usage

This version of the filter is meant to be used with mathjax3eqno in Quarto.

Add this filter to a project

quarto add ute/parse-latex-noeq

and use it by adding parse-latex to the filters entry in their YAML header.

Since it is meant to work together with mathjax3eqno, also add

quarto add ute/mathjax3eqno

Use the two filters together

---
filters:
  - parse-latex-noeq
  - mathjax3eqno
---

Caveat

This filter does not process references \ref anymore, since this is taken care of by mathjax, via filter mathjax3eqno. As a consequence, you can no longer refer to tables or headers the LaTeX way, but have to use quartos cross-referencing mechanism, however quarto is great for this purpose and allows preview on mouse-hover :-).

License

This pandoc Lua filter is published under the MIT license, see file LICENSE for details.

parse-latex-noeq's People

Contributors

tarleb avatar ute avatar ifitrains 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.