Automatically number display-math equations in pandoc.
Project description
pandoc-displaymath2equations
Replace blocks of displaymath with the equation environment, and enable links to labeled equations.
This is a very simple filter. For a solution with all the bells and whistles use the (now seemingly unmaintained) pandoc-eqnos.
Usage
Install the pandoc-displaymath2equation
package from PyPI, and add pandoc-displaymath2equation
to your filters.
python -m pip install pandoc-displaymath2equation
pandoc --filter pandoc-displaymath2equation path/to/file.md -o file.pdf
Display Math Conversion
Content that would usually generate output like this:
\[
1 + 1 = 2
\]
will instead generate a block like this:
\begin{equation}
1 + 1 = 2
\end{equation}
Referencing Labelled Equations
To reference an equation labeled id
, use a string of the form (eq:id)
.
This will be replaced with \eqref{id}
.
To label an equation, just use \label{id}
in the display math block.
$$
E = mc^2 \label{important}
$$
This can be referenced in the text by using (eq:important)
.
Development
Source-code goes into displaymath2equation/
, tests go into tst/
.
Code style should conform to PEP-8, and commit messages should follow the conventional commits spec.
Dependencies
Dependencies for development can be installed from requirements-dev.txt
.
New dependencies should go into pyproject.toml
.
If code in displaymath2equation/
depends on them, they go into [project.dependencies]
, otherwise into an environment in [project.optional-dependencies]
, most likely dev
.
If dependencies are added, requirements.txt
and requirements-dev.txt
should be regenerated.
This can be done with make requirements.txt
and make requirements-dev.txt
respectively.
Testing
Having tests is nice. Even though the test we have is a little sparse, it's better than no test.
Docs
Documentation is nice, but doesn't exist yet.
Once it does, it goes into docs
.
TODOs
Possible future features that would be nice to have:
- syntax for determining the text/mark/number rendered next to the equation
- logic to deal with split/align environments
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pandoc_displaymath2equation-0.0.0.1.tar.gz
.
File metadata
- Download URL: pandoc_displaymath2equation-0.0.0.1.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | efc306f470e13a66cd9f0796239e828519e3da91c4c9ebd6ce3f5f5850dd3b1f |
|
MD5 | a5affe566adc9ffd192d6784c8cedae3 |
|
BLAKE2b-256 | 48e404f2a4cffc391659e4f7b548a9d2414adf3b5065156a30623e51d7a2b660 |
File details
Details for the file pandoc_displaymath2equation-0.0.0.1-py3-none-any.whl
.
File metadata
- Download URL: pandoc_displaymath2equation-0.0.0.1-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 10dbb38aea3026552dde09a10492edef792ee6c6d2caf7dd93040fc2c1c9087c |
|
MD5 | 081567d5ebb492edf2e06f6b949183cb |
|
BLAKE2b-256 | eeab5e6fdd6d95ea849659c37832d9ce9c467357e2416d2d1cdd1bec40a7d716 |