Module: Texas::Template::Helper::TeX

Included in:
Runner::TeX
Defined in:
lib/texas/template/helper/tex.rb

Instance Method Summary collapse

Instance Method Details

Converts all URLs in a text in url TeX commands



9
10
11
# File 'lib/texas/template/helper/tex.rb', line 9

def auto_link(text)
  text.to_s.gsub(/(https*\:\/\/\S+)/, '\url{\1}')
end

#bold(text) ⇒ Object Also known as: b



13
14
15
# File 'lib/texas/template/helper/tex.rb', line 13

def bold(text)
  tex :textbf, text
end

#h1(*args) ⇒ Object



18
# File 'lib/texas/template/helper/tex.rb', line 18

def h1(*args); tex(:section, *args); end

#h2(*args) ⇒ Object



19
# File 'lib/texas/template/helper/tex.rb', line 19

def h2(*args); tex(:subsection, *args); end

#h3(*args) ⇒ Object



20
# File 'lib/texas/template/helper/tex.rb', line 20

def h3(*args); tex(:subsubsection, *args); end

#h4(text) ⇒ Object



21
# File 'lib/texas/template/helper/tex.rb', line 21

def h4(text); '\paragraph{'+text+'} ~\\'; end

#input(*path) ⇒ Object



28
29
30
31
# File 'lib/texas/template/helper/tex.rb', line 28

def input(*path)
  write_template_for_input(path)
  tex :input, relative_template_basename(path)
end

#input!(*path) ⇒ Object



33
34
35
36
# File 'lib/texas/template/helper/tex.rb', line 33

def input!(*path)
  write_template_for_input(path)
  tex :include, relative_template_basename(path)
end

#italic(text) ⇒ Object Also known as: i



23
24
25
# File 'lib/texas/template/helper/tex.rb', line 23

def italic(text)
  tex :emph, text
end

#linebreakObject Also known as: br



38
39
40
# File 'lib/texas/template/helper/tex.rb', line 38

def linebreak
  "\\\\"
end

#quote(string) ⇒ Object



43
44
45
# File 'lib/texas/template/helper/tex.rb', line 43

def quote(string)
  "\"`#{string}\"'"
end

#write_template_for_input(path) ⇒ Object



47
48
49
50
51
# File 'lib/texas/template/helper/tex.rb', line 47

def write_template_for_input(path)
  filename = find_template_file!(path, template_extensions)
  template = Template.create(filename, build)
  template.write
end