class ReVIEW::LaTeXBox

Public Class Methods

new() click to toggle source
# File lib/review/latexbox.rb, line 11
def initialize
  @logger = ReVIEW.logger
end

Public Instance Methods

tcbox(config) click to toggle source
# File lib/review/latexbox.rb, line 15
    def tcbox(config)
      ret = ''

      %w[column note memo tip info warning important caution notice].each do |name|
        if config['pdfmaker'].nil? || config['pdfmaker']['boxsetting'].nil? ||
           config['pdfmaker']['boxsetting'][name].nil? ||
           config['pdfmaker']['boxsetting'][name]['style'].nil?
          next
        end

        options = '[]'
        options_with_caption = '[]'
        if config['pdfmaker']['boxsetting'][name]['options']
          options = "[#{config['pdfmaker']['boxsetting'][name]['options']}]"
          options_with_caption = options
        end

        if config['pdfmaker']['boxsetting'][name]['options_with_caption']
          options_with_caption = "[#{config['pdfmaker']['boxsetting'][name]['options_with_caption']}]"
        end

        ret << <<EOT
\\renewenvironment{review#{name}}[1][]{%
  \\csdef{rv@tmp@withcaption}{true}
  \\notblank{##1}{
    \\begin{rv@#{config['pdfmaker']['boxsetting'][name]['style']}@caption}{##1}#{options_with_caption}
   }{
    \\csundef{rv@tmp@withcaption}
    \\begin{rv@#{config['pdfmaker']['boxsetting'][name]['style']}@nocaption}#{options}
   }
}{
  \\ifcsdef{rv@tmp@withcaption}{
    \\end{rv@#{config['pdfmaker']['boxsetting'][name]['style']}@caption}
  }{
    \\end{rv@#{config['pdfmaker']['boxsetting'][name]['style']}@nocaption}
  }
}
EOT
      end

      ret
    end