From d89769fe8147d75f776bc950443dfa9a7c5059d6 Mon Sep 17 00:00:00 2001 From: Jacques Distler Date: Mon, 5 Oct 2009 02:36:00 -0500 Subject: [PATCH] Update for itex2MML 1.3.13 Implements \mathrlap{}, \mathllap{}, and \mathclap{}. Deprecates the use of \rlap{} (use \mathrlap{}, instead: the latter works in math-mode in the LaTeX export, whereas TeX's \rlap{} did not). --- app/views/wiki/tex.rhtml | 5 +++++ test/functional/wiki_controller_test.rb | 5 +++++ test/unit/page_renderer_test.rb | 11 +++++++++-- 3 files changed, 19 insertions(+), 2 deletions(-) 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