Method: ReVIEW::LATEXBuilder#image_image

Defined in:
lib/review/latexbuilder.rb

#image_image(id, caption = '', metric = nil) ⇒ Object



579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
# File 'lib/review/latexbuilder.rb', line 579

def image_image(id, caption = '', metric = nil)
  @doc_status[:caption] = true
  captionstr = if @book.config.check_version('2', exception: false)
                 macro('caption', compile_inline(caption)) + "\n"
               else
                 macro('reviewimagecaption', compile_inline(caption)) + "\n"
               end
  captionstr << macro('label', image_label(id))
  @doc_status[:caption] = nil

  metrics = parse_metric('latex', metric)
  # image is always bound here
  puts "\\begin{reviewimage}%%#{id}"

  if caption_top?('image')
    puts captionstr
  end

  command = 'reviewincludegraphics'
  if @book.config.check_version('2', exception: false)
    command = 'includegraphics'
  end

  if metrics.present?
    puts "\\#{command}[#{metrics}]{#{@chapter.image(id).path}}"
  else
    puts "\\#{command}[width=\\maxwidth]{#{@chapter.image(id).path}}"
  end

  unless caption_top?('image')
    puts captionstr
  end

  puts '\end{reviewimage}'
end