Class Kramdown::Converter::Latex
In: lib/kramdown/converter/latex.rb
Parent: Base

Converts an element tree to LaTeX.

This converter uses ideas from other Markdown-to-LaTeX converters like Pandoc and Maruku.

You can customize this converter by sub-classing it and overriding the convert_NAME methods. Each such method takes the following parameters:

el
The element of type NAME to be converted.
opts
A hash containing processing options that are passed down from parent elements. The key :parent is always set and contains the parent element as value.

The return value of such a method has to be a string containing the element el formatted correctly as LaTeX markup.

Methods

Constants

TYPOGRAPHIC_SYMS = { :mdash => '---', :ndash => '--', :hellip => '\ldots{}', :laquo_space => '\guillemotleft{}~', :raquo_space => '~\guillemotright{}', :laquo => '\guillemotleft{}', :raquo => '\guillemotright{}'
ESCAPE_MAP = { "^" => "\\^{}", "\\" => "\\textbackslash{}", "~" => "\\ensuremath{\\sim}", "|" => "\\textbar{}", "<" => "\\textless{}", ">" => "\\textgreater{}"

Public Class methods

Initialize the LaTeX converter with the root element and the conversion options.

Public Instance methods

Return a LaTeX comment containing all attributes as ‘key="value"’ pairs.

Dispatch the conversion of the element el to a convert_TYPE method using the type of the element.

convert_ol(el, opts)

Alias for convert_ul

Helper method used by convert_p to convert a paragraph that only contains a single :img element.

Escape the special LaTeX characters in the string str.

Return the converted content of the children of el as a string.

Wrap the text inside a LaTeX environment of type type. The element el is passed on to the method attribute_list — the resulting string is appended to both the \begin and the \end lines of the LaTeX environment for easier post-processing of LaTeX environments.

Return a string containing a valid \hypertarget command if the element has an ID defined, or nil otherwise. If the parameter add_label is true, a \label command will also be used additionally to the \hypertarget command.

[Validate]