diff --git a/app/views/wiki/tex.rhtml b/app/views/wiki/tex.rhtml index 0c5b8380..ec637222 100644 --- a/app/views/wiki/tex.rhtml +++ b/app/views/wiki/tex.rhtml @@ -83,6 +83,11 @@ \def\slash{\protect\itex@pslash} \makeatother +% math-mode versions of \rlap, etc +% from Alexander Perlis, "A complement to \smash, \llap, and lap" +% http://math.arizona.edu/~aprl/publications/mathclap/ +\def\clap#1{\hbox to 0pt{\hss#1\hss}} \def\mathllap{\mathpalette\mathllapinternal} \def\mathrlap{\mathpalette\mathrlapinternal} \def\mathclap{\mathpalette\mathclapinternal} \def\mathllapinternal#1#2{\llap{$\mathsurround=0pt#1{#2}$}} \def\mathrlapinternal#1#2{\rlap{$\mathsurround=0pt#1{#2}$}} \def\mathclapinternal#1#2{\clap{$\mathsurround=0pt#1{#2}$}} + % Renames \sqrt as \oldsqrt and redefine root to result in \sqrt[#1]{#2} \let\oldroot\root \def\root#1#2{\oldroot #1 \of{#2}} diff --git a/test/functional/wiki_controller_test.rb b/test/functional/wiki_controller_test.rb index dde7b9fe..6f0689fa 100755 --- a/test/functional/wiki_controller_test.rb +++ b/test/functional/wiki_controller_test.rb @@ -1007,6 +1007,11 @@ class WikiControllerTest < ActionController::TestCase \def\slash{\protect\itex@pslash} \makeatother +% math-mode versions of \rlap, etc +% from Alexander Perlis, "A complement to \smash, \llap, and lap" +% http://math.arizona.edu/~aprl/publications/mathclap/ +\def\clap#1{\hbox to 0pt{\hss#1\hss}} \def\mathllap{\mathpalette\mathllapinternal} \def\mathrlap{\mathpalette\mathrlapinternal} \def\mathclap{\mathpalette\mathclapinternal} \def\mathllapinternal#1#2{\llap{$\mathsurround=0pt#1{#2}$}} \def\mathrlapinternal#1#2{\rlap{$\mathsurround=0pt#1{#2}$}} \def\mathclapinternal#1#2{\clap{$\mathsurround=0pt#1{#2}$}} + % Renames \sqrt as \oldsqrt and redefine root to result in \sqrt[#1]{#2} \let\oldroot\root \def\root#1#2{\oldroot #1 \of{#2}} diff --git a/test/unit/page_renderer_test.rb b/test/unit/page_renderer_test.rb index 3cbd2967..d50f9322 100644 --- a/test/unit/page_renderer_test.rb +++ b/test/unit/page_renderer_test.rb @@ -212,6 +212,13 @@ END_THM def test_have_latest_itex2mml + assert_markup_parsed_as( + %{

equation AB

}, + "equation $A \\mathllap{B}$") + assert_markup_parsed_as( %{

equation 123

}, + %{inline' xmlns='http://www.w3.org/1998/Math/MathML'>} + + %{123

}, '\rlap: $\rlap{123}$') end