Module: Tex

Defined in:
lib/rbtex.rb

Defined Under Namespace

Classes: Table

Class Method Summary collapse

Class Method Details

.center(latex) ⇒ Object



31
32
33
# File 'lib/rbtex.rb', line 31

def Tex.center(latex)
    return "\\begin{center}#{latex}\\end{center}"
end

.cmath(math) ⇒ Object



27
28
29
# File 'lib/rbtex.rb', line 27

def Tex.cmath(math)
    return "\\[#{math}\\]"
end

.imath(math) ⇒ Object



23
24
25
# File 'lib/rbtex.rb', line 23

def Tex.imath(math)
    return "$#{math}$"
end

.logoObject



39
40
41
# File 'lib/rbtex.rb', line 39

def Tex.
    return "$\\RbTeX$"
end

.nObject



35
36
37
# File 'lib/rbtex.rb', line 35

def Tex.n
    return "\\\\"
end


19
20
21
# File 'lib/rbtex.rb', line 19

def Tex.print(latex, number, bundle=[])
    printToOutFile(latex, number, bundle)
end

.printToOutFile(line, number, bundle) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/rbtex.rb', line 43

def Tex.printToOutFile(line, number, bundle)
    file = File.open($out_file, 'a')
    if bundle.length == 0
        file.puts "#{line}#{OUT_DELIM}#{number}"
    else
        case bundle[0]
        when "loop"
            $pLoop = true
            file.puts LOOP_START
        when "nloop"
            $pLoop = false
            file.puts LOOP_END
        when "rbtev"
            file.puts RBT_ENV_BEGIN
        when "nrbtev"
            file.puts RBT_ENV_END
        else
            file.puts $pLoop ? "#{line}" : "#{line}#{OUT_DELIM}#{number}"
        end
    end
    file.close
end