diff --git a/app/views/wiki/tex.rhtml b/app/views/wiki/tex.rhtml
index d1d6a733..c4b5563c 100644
--- a/app/views/wiki/tex.rhtml
+++ b/app/views/wiki/tex.rhtml
@@ -4,6 +4,9 @@
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
+<%- if @tex_content =~ /\\mathbb\{[^}]*[a-z0-9]+[^}]*\}/ -%>
+\usepackage{mathbbol}
+<% end -%>
\usepackage{graphicx}
\usepackage{color}
\usepackage{ucs}
diff --git a/test/functional/wiki_controller_test.rb b/test/functional/wiki_controller_test.rb
index 81a9d2a3..ffce37d5 100755
--- a/test/functional/wiki_controller_test.rb
+++ b/test/functional/wiki_controller_test.rb
@@ -31,6 +31,7 @@ class WikiControllerTest < ActionController::TestCase
@oak = pages(:oak)
@elephant = pages(:elephant)
@eternity = Regexp.new('author=.*; path=/; expires=' + Time.utc(2030).strftime("%a, %d-%b-%Y %H:%M:%S GMT"))
+ set_tex_header
end
def test_authenticate
@@ -849,17 +850,15 @@ class WikiControllerTest < ActionController::TestCase
assert_response :missing
end
- def test_tex
- r = process('tex', 'web' => 'wiki1', 'id' => 'HomePage')
- assert_response(:success)
-
- assert_equal %q!\documentclass[12pt,titlepage]{article}
+ def set_tex_header
+ @tex_header1 = %q!\documentclass[12pt,titlepage]{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
-\usepackage{graphicx}
+!
+ @tex_header2 = %q!\usepackage{graphicx}
\usepackage{color}
\usepackage{ucs}
\usepackage[utf8x]{inputenc}
@@ -1084,7 +1083,14 @@ class WikiControllerTest < ActionController::TestCase
%-------------------------------------------------------------------
-\section*{HomePage}
+!
+ end
+
+ def test_tex
+ r = process('tex', 'web' => 'wiki1', 'id' => 'HomePage')
+ assert_response(:success)
+
+ assert_equal @tex_header1 + @tex_header2 + %q!\section*{HomePage}
HisWay would be MyWay $\sin(x) \includegraphics[width=3em]{foo}$ in kinda ThatWay in HisWay though MyWay $\backslash$OverThere --{} see SmartEngine in that SmartEngineGUI
@@ -1094,6 +1100,22 @@ HisWay would be MyWay $\sin(x) \includegraphics[width=3em]{foo}$ in kinda ThatWa
!, r.body
end
+ def test_tex_with_blackboard_digits
+ @wiki.write_page('wiki1', 'Page2',
+ "Page2 contents $\\mathbb{01234}$.\n",
+ Time.now, Author.new('AnotherAuthor', '127.0.0.2'), test_renderer)
+ r = process('tex', 'web' => 'wiki1', 'id' => 'Page2')
+ assert_response(:success)
+
+ assert_equal @tex_header1 + "\\usepackage{mathbbol}\n" + @tex_header2 + %q!\section*{Page2}
+
+Page2 contents $\mathbb{01234}$.
+
+
+
+\end{document}
+!, r.body
+ end
def test_web_list
another_wiki = @wiki.create_web('Another Wiki', 'another_wiki')
diff --git a/test/unit/page_renderer_test.rb b/test/unit/page_renderer_test.rb
index 4595fdee..d5791cea 100644
--- a/test/unit/page_renderer_test.rb
+++ b/test/unit/page_renderer_test.rb
@@ -213,6 +213,12 @@ END_THM
%{display='inline' xmlns='http://www.w3.org/1998/Math/MathML'>} +
%{
blackboard digits:
}, + "blackboard digits: $\mathbb{123}$") end def test_blahtex