lib/softcover/mathjax.rb in softcover-0.9.12 vs lib/softcover/mathjax.rb in softcover-0.9.13
- old
+ new
@@ -5,22 +5,30 @@
def self.config(options = {})
chapter_number = if options[:chapter_number]
# Call .inspect.inspect to escape the chapter number
# code for interpolation.
options[:chapter_number].inspect.inspect
- else
+ elsif options[:chapter_number].nil?
'#{chapter_number}'
+ else # chapter_number is false, i.e., it's a single page
+ false
end
+ fn = if chapter_number
+ "formatNumber: function (n) { return #{chapter_number} + '.' + n }"
+ else
+ ""
+ end
+
<<-EOS
MathJax.Hub.Config({
"HTML-CSS": {
availableFonts: ["TeX"],
},
TeX: {
extensions: ["AMSmath.js", "AMSsymbols.js"],
equationNumbers: {
autoNumber: "AMS",
- formatNumber: function (n) { return #{chapter_number} + '.' + n }
+ #{fn}
},
Macros: {
PolyTeX: "Poly{\\\\TeX}",
PolyTeXnic: "Poly{\\\\TeX}nic",
#{custom_macros}