Module RedCloth::Formatters::LATEX
In: lib/redcloth/formatters/latex.rb
lib/redcloth/formatters/latex.rb

Methods

arrow   arrow   bc_close   bc_close   bc_open   bc_open   bq_close   bq_close   bq_open   bq_open   copyright   copyright   dim   dim   ellipsis   ellipsis   emdash   emdash   endash   endash   entity   entity   escape   escape   escape_pre   escape_pre   fn   fn   footno   footno   image   image   li_close   li_close   li_open   li_open   link   link   p   p   quote1   quote1   quote2   quote2   registered   registered   snip   snip   table_close   table_close   table_open   table_open   td   td   tr_close   tr_close   tr_open   tr_open   trademark   trademark  

Included Modules

RedCloth::Formatters::Base RedCloth::Formatters::Base

Classes and Modules

Module RedCloth::Formatters::LATEX::Settings

Constants

ENTITIES = YAML::load(File.read(File.dirname(__FILE__)+'/latex_entities.yml'))
ENTITIES = YAML::load(File.read(File.dirname(__FILE__)+'/latex_entities.yml'))

Public Instance methods

[Source]

     # File lib/redcloth/formatters/latex.rb, line 201
201:   def arrow(opts)
202:     "\\rightarrow{}"
203:   end

[Source]

     # File lib/redcloth/formatters/latex.rb, line 201
201:   def arrow(opts)
202:     "\\rightarrow{}"
203:   end

[Source]

     # File lib/redcloth/formatters/latex.rb, line 130
130:   def bc_close(opts)
131:     end_chunk("verbatim") + "\n"
132:   end

[Source]

     # File lib/redcloth/formatters/latex.rb, line 130
130:   def bc_close(opts)
131:     end_chunk("verbatim") + "\n"
132:   end

[Source]

     # File lib/redcloth/formatters/latex.rb, line 125
125:   def bc_open(opts)
126:     opts[:block] = true
127:     begin_chunk("verbatim") + "\n"
128:   end

[Source]

     # File lib/redcloth/formatters/latex.rb, line 125
125:   def bc_open(opts)
126:     opts[:block] = true
127:     begin_chunk("verbatim") + "\n"
128:   end

[Source]

     # File lib/redcloth/formatters/latex.rb, line 139
139:   def bq_close(opts)
140:     "\\end{quotation}\n\n"
141:   end

[Source]

     # File lib/redcloth/formatters/latex.rb, line 139
139:   def bq_close(opts)
140:     "\\end{quotation}\n\n"
141:   end

[Source]

     # File lib/redcloth/formatters/latex.rb, line 134
134:   def bq_open(opts)
135:     opts[:block] = true
136:     "\\begin{quotation}\n"
137:   end

[Source]

     # File lib/redcloth/formatters/latex.rb, line 134
134:   def bq_open(opts)
135:     opts[:block] = true
136:     "\\begin{quotation}\n"
137:   end

[Source]

     # File lib/redcloth/formatters/latex.rb, line 213
213:   def copyright(opts)
214:     "\\copyright{}"
215:   end

[Source]

     # File lib/redcloth/formatters/latex.rb, line 213
213:   def copyright(opts)
214:     "\\copyright{}"
215:   end

[Source]

     # File lib/redcloth/formatters/latex.rb, line 224
224:   def dim(opts)
225:     space = opts[:space] ? " " : ''
226:     "#{opts[:text]}#{space}\\texttimes{}#{space}"
227:   end

[Source]

     # File lib/redcloth/formatters/latex.rb, line 224
224:   def dim(opts)
225:     space = opts[:space] ? " " : ''
226:     "#{opts[:text]}#{space}\\texttimes{}#{space}"
227:   end

[Source]

     # File lib/redcloth/formatters/latex.rb, line 189
189:   def ellipsis(opts)
190:     "#{opts[:text]}\\ldots{}"
191:   end

[Source]

     # File lib/redcloth/formatters/latex.rb, line 189
189:   def ellipsis(opts)
190:     "#{opts[:text]}\\ldots{}"
191:   end

[Source]

     # File lib/redcloth/formatters/latex.rb, line 193
193:   def emdash(opts)
194:     "---"
195:   end

[Source]

     # File lib/redcloth/formatters/latex.rb, line 193
193:   def emdash(opts)
194:     "---"
195:   end

[Source]

     # File lib/redcloth/formatters/latex.rb, line 197
197:   def endash(opts)
198:     "--"
199:   end

[Source]

     # File lib/redcloth/formatters/latex.rb, line 197
197:   def endash(opts)
198:     "--"
199:   end

TODO: what do we do with (unknown) unicode entities ?

[Source]

     # File lib/redcloth/formatters/latex.rb, line 219
219:   def entity(opts)
220:     text = opts[:text][0..0] == '#' ? opts[:text][1..-1] : opts[:text] 
221:     ENTITIES[text]
222:   end

TODO: what do we do with (unknown) unicode entities ?

[Source]

     # File lib/redcloth/formatters/latex.rb, line 219
219:   def entity(opts)
220:     text = opts[:text][0..0] == '#' ? opts[:text][1..-1] : opts[:text] 
221:     ENTITIES[text]
222:   end

[Source]

    # File lib/redcloth/formatters/latex.rb, line 17
17:   def escape(text)
18:     latex_esc(text)
19:   end

[Source]

    # File lib/redcloth/formatters/latex.rb, line 17
17:   def escape(text)
18:     latex_esc(text)
19:   end

[Source]

    # File lib/redcloth/formatters/latex.rb, line 21
21:   def escape_pre(text)
22:     text
23:   end

[Source]

    # File lib/redcloth/formatters/latex.rb, line 21
21:   def escape_pre(text)
22:     text
23:   end

[Source]

     # File lib/redcloth/formatters/latex.rb, line 173
173:   def fn(opts)
174:     "\\footnotetext[#{opts[:id]}]{#{opts[:text]}}"
175:   end

[Source]

     # File lib/redcloth/formatters/latex.rb, line 173
173:   def fn(opts)
174:     "\\footnotetext[#{opts[:id]}]{#{opts[:text]}}"
175:   end

[Source]

     # File lib/redcloth/formatters/latex.rb, line 167
167:   def footno(opts)
168:     # TODO: insert a placeholder until we know the footnote content.
169:     # For this to work, we need some kind of post-processing...
170:     "\\footnotemark[#{opts[:text]}]"
171:   end

[Source]

     # File lib/redcloth/formatters/latex.rb, line 167
167:   def footno(opts)
168:     # TODO: insert a placeholder until we know the footnote content.
169:     # For this to work, we need some kind of post-processing...
170:     "\\footnotemark[#{opts[:text]}]"
171:   end

FIXME: use includegraphics with security verification

Remember to use ’\RequirePackage{graphicx}’ in your LaTeX header

FIXME: Look at dealing with width / height gracefully as this should be specified in a unit like cm rather than px.

[Source]

     # File lib/redcloth/formatters/latex.rb, line 153
153:   def image(opts)
154:     # Don't know how to use remote links, plus can we trust them?
155:     return "" if opts[:src] =~ /^\w+\:\/\//
156:     # Resolve CSS styles if any have been set
157:     styling = opts[:class].to_s.split(/\s+/).collect { |style| latex_image_styles[style] }.compact.join ','
158:     # Build latex code
159:     [ "\\begin{figure}[htp]",
160:       "  \\includegraphics[#{styling}]{#{opts[:src]}}",
161:      ("  \\caption{#{escape opts[:title]}}" if opts[:title]),
162:      ("  \\label{#{escape opts[:alt]}}" if opts[:alt]),
163:       "\\end{figure}",
164:     ].compact.join "\n"
165:   end

FIXME: use includegraphics with security verification

Remember to use ’\RequirePackage{graphicx}’ in your LaTeX header

FIXME: Look at dealing with width / height gracefully as this should be specified in a unit like cm rather than px.

[Source]

     # File lib/redcloth/formatters/latex.rb, line 153
153:   def image(opts)
154:     # Don't know how to use remote links, plus can we trust them?
155:     return "" if opts[:src] =~ /^\w+\:\/\//
156:     # Resolve CSS styles if any have been set
157:     styling = opts[:class].to_s.split(/\s+/).collect { |style| latex_image_styles[style] }.compact.join ','
158:     # Build latex code
159:     [ "\\begin{figure}[htp]",
160:       "  \\includegraphics[#{styling}]{#{opts[:src]}}",
161:      ("  \\caption{#{escape opts[:title]}}" if opts[:title]),
162:      ("  \\label{#{escape opts[:alt]}}" if opts[:alt]),
163:       "\\end{figure}",
164:     ].compact.join "\n"
165:   end

[Source]

    # File lib/redcloth/formatters/latex.rb, line 96
96:   def li_close(opts=nil)
97:     "\n"
98:   end

[Source]

    # File lib/redcloth/formatters/latex.rb, line 96
96:   def li_close(opts=nil)
97:     "\n"
98:   end

[Source]

    # File lib/redcloth/formatters/latex.rb, line 92
92:   def li_open(opts)
93:     "#{li_close unless opts.delete(:first)}\t\\item #{opts[:text]}"
94:   end

[Source]

    # File lib/redcloth/formatters/latex.rb, line 92
92:   def li_open(opts)
93:     "#{li_close unless opts.delete(:first)}\t\\item #{opts[:text]}"
94:   end

[Source]

     # File lib/redcloth/formatters/latex.rb, line 143
143:   def link(opts)
144:     "\\href{#{opts[:href]}}{#{opts[:name]}}"
145:   end

[Source]

     # File lib/redcloth/formatters/latex.rb, line 143
143:   def link(opts)
144:     "\\href{#{opts[:href]}}{#{opts[:name]}}"
145:   end

[Source]

     # File lib/redcloth/formatters/latex.rb, line 100
100:   def p(opts)
101:     opts[:text] + "\n\n"
102:   end

[Source]

     # File lib/redcloth/formatters/latex.rb, line 100
100:   def p(opts)
101:     opts[:text] + "\n\n"
102:   end

[Source]

     # File lib/redcloth/formatters/latex.rb, line 181
181:   def quote1(opts)
182:     "`#{opts[:text]}'"
183:   end

[Source]

     # File lib/redcloth/formatters/latex.rb, line 181
181:   def quote1(opts)
182:     "`#{opts[:text]}'"
183:   end

[Source]

     # File lib/redcloth/formatters/latex.rb, line 185
185:   def quote2(opts)
186:     "``#{opts[:text]}\""
187:   end

[Source]

     # File lib/redcloth/formatters/latex.rb, line 185
185:   def quote2(opts)
186:     "``#{opts[:text]}\""
187:   end

[Source]

     # File lib/redcloth/formatters/latex.rb, line 209
209:   def registered(opts)
210:     "\\textregistered{}"
211:   end

[Source]

     # File lib/redcloth/formatters/latex.rb, line 209
209:   def registered(opts)
210:     "\\textregistered{}"
211:   end

[Source]

     # File lib/redcloth/formatters/latex.rb, line 177
177:   def snip(opts)
178:     "\\begin{verbatim}#{opts[:text]}\\end{verbatim}"
179:   end

[Source]

     # File lib/redcloth/formatters/latex.rb, line 177
177:   def snip(opts)
178:     "\\begin{verbatim}#{opts[:text]}\\end{verbatim}"
179:   end

[Source]

     # File lib/redcloth/formatters/latex.rb, line 121
121:   def table_close(opts)
122:     "\t\\end{align*}\n"
123:   end

[Source]

     # File lib/redcloth/formatters/latex.rb, line 121
121:   def table_close(opts)
122:     "\t\\end{align*}\n"
123:   end

FIXME: we need to know the column count before opening tabular context.

[Source]

     # File lib/redcloth/formatters/latex.rb, line 117
117:   def table_open(opts)
118:     "\\begin{align*}\n"
119:   end

FIXME: we need to know the column count before opening tabular context.

[Source]

     # File lib/redcloth/formatters/latex.rb, line 117
117:   def table_open(opts)
118:     "\\begin{align*}\n"
119:   end

[Source]

     # File lib/redcloth/formatters/latex.rb, line 104
104:   def td(opts)
105:     "\t\t\t#{opts[:text]} &\n"
106:   end

[Source]

     # File lib/redcloth/formatters/latex.rb, line 104
104:   def td(opts)
105:     "\t\t\t#{opts[:text]} &\n"
106:   end

[Source]

     # File lib/redcloth/formatters/latex.rb, line 112
112:   def tr_close(opts)
113:     "\t\t\\\\\n"
114:   end

[Source]

     # File lib/redcloth/formatters/latex.rb, line 112
112:   def tr_close(opts)
113:     "\t\t\\\\\n"
114:   end

[Source]

     # File lib/redcloth/formatters/latex.rb, line 108
108:   def tr_open(opts)
109:     "\t\t"
110:   end

[Source]

     # File lib/redcloth/formatters/latex.rb, line 108
108:   def tr_open(opts)
109:     "\t\t"
110:   end

[Source]

     # File lib/redcloth/formatters/latex.rb, line 205
205:   def trademark(opts)
206:     "\\texttrademark{}"
207:   end

[Source]

     # File lib/redcloth/formatters/latex.rb, line 205
205:   def trademark(opts)
206:     "\\texttrademark{}"
207:   end

[Validate]