Method: ReVIEW::LATEXBuilder#headline

Defined in:
lib/review/latexbuilder.rb

#headline(level, label, caption) ⇒ Object



132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/review/latexbuilder.rb', line 132

def headline(level, label, caption)
  _, anchor = headline_prefix(level)
  headline_name = HEADLINE[level]
  if @chapter.is_a?(ReVIEW::Book::Part)
    if @book.config.check_version('2', exception: false)
      headline_name = 'part'
    elsif level == 1
      headline_name = 'part'
      puts '\begin{reviewpart}'
    end
  end
  prefix = ''
  if level > @book.config['secnolevel'] || (@chapter.number.to_s.empty? && level > 1)
    prefix = '*'
  end
  blank unless @output.pos == 0
  @doc_status[:caption] = true
  puts macro(headline_name + prefix, compile_inline(caption))
  @doc_status[:caption] = nil
  if prefix == '*' && level <= @book.config['toclevel'].to_i
    puts "\\addcontentsline{toc}{#{headline_name}}{#{compile_inline(caption)}}"
  end
  if level == 1
    puts macro('label', chapter_label)
  else
    puts macro('label', sec_label(anchor))
    puts macro('label', label) if label
  end
rescue StandardError
  app_error "unknown level: #{level}"
end