Project

to_latex

0.01
No commit activity in last 3 years
No release in over 3 years
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. This gem powers texerb.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
>= 0
 Project Readme

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 © 2012 Bernát Kalló. See LICENSE.txt for further details.