Start on LaTeX
Pave the way for Jason's LaTeX macro support. Also, uniformize the capitalization of "ETag".
This commit is contained in:
parent
b0e316e37c
commit
c67382d340
3 changed files with 21 additions and 8 deletions
12
vendor/plugins/maruku/lib/maruku/ext/math/latex_fix.rb
vendored
Normal file
12
vendor/plugins/maruku/lib/maruku/ext/math/latex_fix.rb
vendored
Normal 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
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue