Start on LaTeX

Pave the way for Jason's LaTeX macro support.
Also, uniformize the capitalization of "ETag".
This commit is contained in:
Jacques Distler 2007-10-04 02:50:08 -05:00
parent b0e316e37c
commit c67382d340
3 changed files with 21 additions and 8 deletions

View file

@ -0,0 +1,12 @@
class String
# fix some LaTeX command-name clashes
def fix_latex
if #{html_math_engine} == 'itex2mml'
s = self.gsub("\\mathop{", "\\operatorname{")
s.gsub("\\space{", "\\itexspace{")
else
self
end
end
end

View file

@ -1,16 +1,17 @@
module MaRuKu; module Out; module Latex
require 'maruku/ext/math/latex_fix'
def to_latex_inline_math
"$#{self.math.strip}$"
s = "$#{self.math.strip}$".fix_latex
end
def to_latex_equation
if self.label
l = "\\label{#{self.label}}"
"\\begin{equation}\n#{self.math.strip}\n#{l}\\end{equation}\n"
"\\begin{equation}\n#{self.math.strip}\n#{l}\\end{equation}\n".fix_latex
else
"\\begin{displaymath}\n#{self.math.strip}\n\\end{displaymath}\n"
"\\begin{displaymath}\n#{self.math.strip}\n\\end{displaymath}\n".fix_latex
end
end
@ -18,4 +19,4 @@ module MaRuKu; module Out; module Latex
"\\eqref{#{self.eqid}}"
end
end end end
end end end