Skip to content

a versatile tool for converting LaTeX equations between different formats.

Notifications You must be signed in to change notification settings

claws99/latex_equation_formatter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

LaTeX Equation Formatter

This Python script is a versatile tool for converting LaTeX equations between different formats. It allows you to easily switch between the following LaTeX equation formats:

  • $...$ to \( ... \)
  • \( ... \) to $...$
  • $$...$$ to \[ ... \]
  • \[ ... \] to $$...$$

Usage

Command-Line Usage

You can use this tool from the command line by running converter.py with the following arguments:

python converter.py <mode> <path> <filetype>
  • <mode>: The conversion mode, which can be either "dedollarify" or "dollarify" LaTeX format.
  • <path>: The file or directory path to process.
  • <filetype>: applies regex replacements to only files ending with this specified extension. Default is tex.

Examples:

  • To convert LaTeX equations in a single file from $...$ and $$...$$ to \( ... \) and \[ ... \] format:
python converter.py dedollarify input.tex tex
  • To convert LaTeX equations in a single file from\( ... \) and \[ ... \] to $...$ and $$...$$ format:
python converter.py dollarify input.tex tex
  • To convert LaTeX equations in all .tex files within a directory and its subdirectories:
python converter.py dedollarify /path/to/directory md

Unit Tests

To ensure the correctness of the conversion functions, we have included unit tests. You can run them using the following command:

python -m unittest tests/basic_tests.py

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • This project was inspired by the need to simplify LaTeX equation conversion.
  • Special thanks to the Python community for the argparse and unittest modules.

Feel free to contribute, report issues, or provide feedback to make this tool even better!

Make sure to customize the README by adding information specific to your project, such as installation instructions, additional features, and any other relevant details. Also, consider including a license file (e.g., LICENSE) in your repository if you haven't already.

About

a versatile tool for converting LaTeX equations between different formats.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages