to_latex¶ ↑
Adds #to_latex to integers and strings. Works like html_safe in Rails, it escapes special characters as needed. Once converted, a string becomes a ToLatex::LatexString instance, with #latex? returning true, and never again will be escaped.
You can concatenate any escaped or not escaped string to an escaped one, they get properly escaped.
Usage¶ ↑
gem 'to_latex', '~>0.5.0' require 'to_latex'
Features¶ ↑
Strings and Integers are supported by default.
s = ''.to_latex s << 'Hello 50% ' << '\LaTeX'.latex! << ' 50% Ruby!' # => "Hello 50\\% \\LaTeX 50\\% Ruby!" s.latex? # => true 5.to_latex # => "5" 5.to_latex_math # => "\\ensuremath{5}"
See spec/to_latex.spec for further details.
Copyright¶ ↑
Copyright © 2012 Bernát Kalló. See LICENSE.txt for further details.