Created
October 29, 2010 00:20
-
-
Save rbonvall/652626 to your computer and use it in GitHub Desktop.
Sphinx extension for mapping unicode symbols to their LaTeX equivalents
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
import sphinx.util.texescape as te | |
replacements = ur''' | |
✓ OK | |
✗ XX | |
⁰ \ensuremath{^{0}} | |
¹ \ensuremath{^{1}} | |
² \ensuremath{^{2}} | |
³ \ensuremath{^{3}} | |
₀ \ensuremath{_{0}} | |
₁ \ensuremath{_{1}} | |
₂ \ensuremath{_{2}} | |
₃ \ensuremath{_{3}} | |
♥ \ensuremath{\heartsuit} | |
♣ \ensuremath{\clubsuit} | |
♦ \ensuremath{\diamondsuit} | |
♠ \ensuremath{\spadesuit} | |
┌ + | |
┬ + | |
┐ + | |
└ + | |
┴ + | |
┘ + | |
│ \textbar{} | |
─ - | |
Δ D | |
± \ensuremath{\pm} | |
− \ensuremath{-} | |
⌈ \ensuremath{\lceil} | |
⌉ \ensuremath{\rceil} | |
⌊ \ensuremath{\lfloor} | |
⌋ \ensuremath{\rfloor} | |
''' | |
def setup(app): | |
replacement_list = [ | |
tuple(line.strip().split()) | |
for line in replacements.strip().splitlines() | |
] | |
te.tex_replacements += replacement_list | |
te.init() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment