Class: Deplate::Formatter::Sweave

Inherits:
LaTeX
  • Object
show all
Defined in:
lib/deplate/fmt/sweave.rb

Instance Method Summary collapse

Methods inherited from LaTeX

#format_footer, #format_header, #format_header_or_footer, #format_header_or_footer_error, #format_header_or_footer_slots, #format_list_of_endnotes, #format_pagenumber, #formatter_initialize_latex_emph_table_head, #formatter_initialize_latex_styles, #formatter_initialize_latex_verbatim_small, #hook_pre_setup_zh_cn_autospace, #prepare_endnotes, #prepare_zh_cn, #set_document_encoding, #setup_styler

Instance Method Details

#img_R(invoker, body) ⇒ Object



36
37
38
39
40
41
42
43
44
45
# File 'lib/deplate/fmt/sweave.rb', line 36

def img_R(invoker, body)
    if invoker.args['noFloat']
        pre = post = nil
    else
        pre = with_agent(:figure_top, String, invoker)
        post = with_agent(:figure_bottom, String, invoker).strip
    end
    opts = sweave_options(invoker, 'fig=TRUE')
    return join_blocks([pre, "<<#{opts}>>=", body, '@', post].compact)
end

#prepareObject



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/deplate/fmt/sweave.rb', line 22

def prepare
    super
    sweave = @deplate.variables['sweaveOpts']
    if sweave
        output_at(:pre, :doc_def, "\\SweaveOpts{#{sweave}}")
    end
    sweavePath = @deplate.variables['sweavePath']
    if sweavePath
        # add_package('Sweave')
        add_package(sweavePath)
    end
end

#region_R(invoker, body) ⇒ Object



48
49
50
51
# File 'lib/deplate/fmt/sweave.rb', line 48

def region_R(invoker, body)
    opts = sweave_options(invoker)
    return join_blocks(["<<#{opts}>>=", body, '@'])
end