remi-maruku 0.5.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (183) hide show
  1. data/Rakefile +73 -0
  2. data/bin/marudown +29 -0
  3. data/bin/maruku +176 -0
  4. data/bin/marutest +338 -0
  5. data/bin/marutex +31 -0
  6. data/docs/changelog.md +334 -0
  7. data/docs/div_syntax.md +36 -0
  8. data/docs/entity_test.md +23 -0
  9. data/docs/markdown_syntax.md +899 -0
  10. data/docs/maruku.md +346 -0
  11. data/docs/math.md +194 -0
  12. data/docs/other_stuff.md +51 -0
  13. data/docs/proposal.md +309 -0
  14. data/lib/maruku.rb +141 -0
  15. data/lib/maruku/attributes.rb +227 -0
  16. data/lib/maruku/defaults.rb +70 -0
  17. data/lib/maruku/errors_management.rb +92 -0
  18. data/lib/maruku/ext/div.rb +100 -0
  19. data/lib/maruku/ext/math.rb +41 -0
  20. data/lib/maruku/ext/math/elements.rb +27 -0
  21. data/lib/maruku/ext/math/latex_fix.rb +11 -0
  22. data/lib/maruku/ext/math/mathml_engines/blahtex.rb +104 -0
  23. data/lib/maruku/ext/math/mathml_engines/itex2mml.rb +29 -0
  24. data/lib/maruku/ext/math/mathml_engines/none.rb +20 -0
  25. data/lib/maruku/ext/math/mathml_engines/ritex.rb +24 -0
  26. data/lib/maruku/ext/math/parsing.rb +105 -0
  27. data/lib/maruku/ext/math/to_html.rb +170 -0
  28. data/lib/maruku/ext/math/to_latex.rb +22 -0
  29. data/lib/maruku/helpers.rb +260 -0
  30. data/lib/maruku/input/charsource.rb +326 -0
  31. data/lib/maruku/input/extensions.rb +69 -0
  32. data/lib/maruku/input/html_helper.rb +189 -0
  33. data/lib/maruku/input/linesource.rb +111 -0
  34. data/lib/maruku/input/parse_block.rb +613 -0
  35. data/lib/maruku/input/parse_doc.rb +227 -0
  36. data/lib/maruku/input/parse_span_better.rb +732 -0
  37. data/lib/maruku/input/rubypants.rb +225 -0
  38. data/lib/maruku/input/type_detection.rb +144 -0
  39. data/lib/maruku/input_textile2/t2_parser.rb +163 -0
  40. data/lib/maruku/maruku.rb +33 -0
  41. data/lib/maruku/output/s5/fancy.rb +756 -0
  42. data/lib/maruku/output/s5/to_s5.rb +125 -0
  43. data/lib/maruku/output/to_html.rb +971 -0
  44. data/lib/maruku/output/to_latex.rb +563 -0
  45. data/lib/maruku/output/to_latex_entities.rb +367 -0
  46. data/lib/maruku/output/to_latex_strings.rb +64 -0
  47. data/lib/maruku/output/to_markdown.rb +164 -0
  48. data/lib/maruku/output/to_s.rb +53 -0
  49. data/lib/maruku/string_utils.rb +191 -0
  50. data/lib/maruku/structures.rb +165 -0
  51. data/lib/maruku/structures_inspect.rb +87 -0
  52. data/lib/maruku/structures_iterators.rb +61 -0
  53. data/lib/maruku/tests/benchmark.rb +82 -0
  54. data/lib/maruku/tests/new_parser.rb +370 -0
  55. data/lib/maruku/tests/tests.rb +136 -0
  56. data/lib/maruku/textile2.rb +1 -0
  57. data/lib/maruku/toc.rb +199 -0
  58. data/lib/maruku/usage/example1.rb +33 -0
  59. data/lib/maruku/version.rb +40 -0
  60. data/tests/bugs/code_in_links.md +16 -0
  61. data/tests/bugs/complex_escaping.md +4 -0
  62. data/tests/math/syntax.md +46 -0
  63. data/tests/math_usage/document.md +13 -0
  64. data/tests/others/abbreviations.md +11 -0
  65. data/tests/others/blank.md +4 -0
  66. data/tests/others/code.md +5 -0
  67. data/tests/others/code2.md +8 -0
  68. data/tests/others/code3.md +16 -0
  69. data/tests/others/email.md +4 -0
  70. data/tests/others/entities.md +19 -0
  71. data/tests/others/escaping.md +16 -0
  72. data/tests/others/extra_dl.md +101 -0
  73. data/tests/others/extra_header_id.md +13 -0
  74. data/tests/others/extra_table1.md +40 -0
  75. data/tests/others/footnotes.md +17 -0
  76. data/tests/others/headers.md +10 -0
  77. data/tests/others/hrule.md +10 -0
  78. data/tests/others/images.md +20 -0
  79. data/tests/others/inline_html.md +42 -0
  80. data/tests/others/links.md +38 -0
  81. data/tests/others/list1.md +4 -0
  82. data/tests/others/list2.md +5 -0
  83. data/tests/others/list3.md +8 -0
  84. data/tests/others/lists.md +32 -0
  85. data/tests/others/lists_after_paragraph.md +44 -0
  86. data/tests/others/lists_ol.md +39 -0
  87. data/tests/others/misc_sw.md +105 -0
  88. data/tests/others/one.md +1 -0
  89. data/tests/others/paragraphs.md +13 -0
  90. data/tests/others/sss06.md +352 -0
  91. data/tests/others/test.md +4 -0
  92. data/tests/s5/s5profiling.md +48 -0
  93. data/tests/unittest/abbreviations.md +72 -0
  94. data/tests/unittest/alt.md +30 -0
  95. data/tests/unittest/attributes/att2.md +34 -0
  96. data/tests/unittest/attributes/att3.md +45 -0
  97. data/tests/unittest/attributes/attributes.md +82 -0
  98. data/tests/unittest/attributes/circular.md +43 -0
  99. data/tests/unittest/attributes/default.md +38 -0
  100. data/tests/unittest/blank.md +39 -0
  101. data/tests/unittest/blanks_in_code.md +106 -0
  102. data/tests/unittest/bug_def.md +29 -0
  103. data/tests/unittest/bug_table.md +67 -0
  104. data/tests/unittest/code.md +53 -0
  105. data/tests/unittest/code2.md +46 -0
  106. data/tests/unittest/code3.md +102 -0
  107. data/tests/unittest/data_loss.md +42 -0
  108. data/tests/unittest/divs/div1.md +204 -0
  109. data/tests/unittest/divs/div2.md +34 -0
  110. data/tests/unittest/divs/div3_nest.md +62 -0
  111. data/tests/unittest/easy.md +28 -0
  112. data/tests/unittest/email.md +33 -0
  113. data/tests/unittest/encoding/iso-8859-1.md +38 -0
  114. data/tests/unittest/encoding/utf-8.md +33 -0
  115. data/tests/unittest/entities.md +124 -0
  116. data/tests/unittest/escaping.md +89 -0
  117. data/tests/unittest/extra_dl.md +72 -0
  118. data/tests/unittest/extra_header_id.md +86 -0
  119. data/tests/unittest/extra_table1.md +55 -0
  120. data/tests/unittest/footnotes.md +126 -0
  121. data/tests/unittest/headers.md +54 -0
  122. data/tests/unittest/hex_entities.md +50 -0
  123. data/tests/unittest/hrule.md +60 -0
  124. data/tests/unittest/html2.md +38 -0
  125. data/tests/unittest/html3.md +47 -0
  126. data/tests/unittest/html4.md +42 -0
  127. data/tests/unittest/html5.md +38 -0
  128. data/tests/unittest/ie.md +82 -0
  129. data/tests/unittest/images.md +114 -0
  130. data/tests/unittest/images2.md +46 -0
  131. data/tests/unittest/inline_html.md +260 -0
  132. data/tests/unittest/inline_html2.md +36 -0
  133. data/tests/unittest/links.md +197 -0
  134. data/tests/unittest/list1.md +66 -0
  135. data/tests/unittest/list2.md +76 -0
  136. data/tests/unittest/list3.md +88 -0
  137. data/tests/unittest/list4.md +116 -0
  138. data/tests/unittest/lists.md +241 -0
  139. data/tests/unittest/lists11.md +31 -0
  140. data/tests/unittest/lists6.md +54 -0
  141. data/tests/unittest/lists7.md +79 -0
  142. data/tests/unittest/lists7b.md +136 -0
  143. data/tests/unittest/lists8.md +83 -0
  144. data/tests/unittest/lists9.md +85 -0
  145. data/tests/unittest/lists_after_paragraph.md +268 -0
  146. data/tests/unittest/lists_ol.md +324 -0
  147. data/tests/unittest/loss.md +29 -0
  148. data/tests/unittest/math/equations.md +69 -0
  149. data/tests/unittest/math/inline.md +66 -0
  150. data/tests/unittest/math/math2.md +110 -0
  151. data/tests/unittest/math/notmath.md +40 -0
  152. data/tests/unittest/math/table.md +43 -0
  153. data/tests/unittest/math/table2.md +60 -0
  154. data/tests/unittest/misc_sw.md +615 -0
  155. data/tests/unittest/notyet/escape.md +36 -0
  156. data/tests/unittest/notyet/header_after_par.md +81 -0
  157. data/tests/unittest/notyet/ticks.md +31 -0
  158. data/tests/unittest/notyet/triggering.md +206 -0
  159. data/tests/unittest/olist.md +64 -0
  160. data/tests/unittest/one.md +28 -0
  161. data/tests/unittest/paragraph.md +29 -0
  162. data/tests/unittest/paragraph_rules/dont_merge_ref.md +57 -0
  163. data/tests/unittest/paragraph_rules/tab_is_blank.md +39 -0
  164. data/tests/unittest/paragraphs.md +66 -0
  165. data/tests/unittest/pending/amps.md +29 -0
  166. data/tests/unittest/pending/empty_cells.md +53 -0
  167. data/tests/unittest/pending/link.md +103 -0
  168. data/tests/unittest/recover/recover_links.md +28 -0
  169. data/tests/unittest/references/long_example.md +88 -0
  170. data/tests/unittest/references/spaces_and_numbers.md +28 -0
  171. data/tests/unittest/smartypants.md +171 -0
  172. data/tests/unittest/syntax_hl.md +80 -0
  173. data/tests/unittest/table_attributes.md +52 -0
  174. data/tests/unittest/test.md +32 -0
  175. data/tests/unittest/wrapping.md +88 -0
  176. data/tests/unittest/xml.md +54 -0
  177. data/tests/unittest/xml2.md +34 -0
  178. data/tests/unittest/xml3.md +44 -0
  179. data/tests/unittest/xml_instruction.md +72 -0
  180. data/tests/utf8-files/simple.md +1 -0
  181. data/unit_test_block.sh +5 -0
  182. data/unit_test_span.sh +2 -0
  183. metadata +243 -0
@@ -0,0 +1,136 @@
1
+ #--
2
+ # Copyright (C) 2006 Andrea Censi <andrea (at) rubyforge.org>
3
+ #
4
+ # This file is part of Maruku.
5
+ #
6
+ # Maruku is free software; you can redistribute it and/or modify
7
+ # it under the terms of the GNU General Public License as published by
8
+ # the Free Software Foundation; either version 2 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # Maruku is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with Maruku; if not, write to the Free Software
18
+ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
+ #++
20
+
21
+
22
+ require 'maruku'
23
+
24
+ class Maruku
25
+
26
+
27
+ def Maruku.failed(test, doc, s)
28
+ raise "Test failed: #{s}\n*****\n#{test}\n*****\n"+
29
+ "#{doc.inspect}\n*****\n{doc.to_html}"
30
+ end
31
+
32
+ def Maruku.metaTests
33
+ ref = {:id => 'id1', :class => ['class1','class2'],
34
+ :style=> 'Style is : important = for all } things'}
35
+
36
+
37
+ tests = MetaTests.split('***')
38
+ for test in tests
39
+ #puts "Test: #{test.inspect}"
40
+ doc = Maruku.new(test)
41
+
42
+ doc.children.size == 1 ||
43
+ failed(test, doc, "children != 1")
44
+
45
+
46
+ h = doc.children[0]
47
+
48
+ h.node_type==:header ||
49
+ failed(test, doc, "child not header")
50
+
51
+ # puts doc.inspect
52
+ # puts doc.to_html
53
+ end
54
+ end
55
+
56
+ MetaTests = <<EOF
57
+
58
+ # Head # {ref1 ref2 ref3}
59
+
60
+ {ref1}: id: id1; class: class1
61
+ {ref2}: class: class2
62
+ {ref3}: style: "Style is : important = for all } things"
63
+
64
+ ***
65
+
66
+ # Head # {ref1 ref3 ref2}
67
+
68
+ {ref1}: id: id1; class: class1
69
+ {ref2}: class: class2
70
+ {ref3}: style: "Style is : important = for all } things"
71
+
72
+ ***
73
+
74
+ # Head # {ref1 ref2 ref3}
75
+
76
+ {ref1}: id= id1; class=class1
77
+ {ref2}: class=class2
78
+ {ref3}: style="Style is : important = for all } things"
79
+
80
+ ***
81
+
82
+ # Head # {ref1 ref2 ref3}
83
+
84
+ {ref1}: id=id1 class=class1
85
+ {ref2}: class=class2
86
+ {ref3}: style="Style is : important = for all } things"
87
+
88
+ ***
89
+ # Head # {ref1 ref2 ref3}
90
+
91
+ {ref1}: id:id1 class:class1
92
+ {ref2}: class : class2
93
+ {ref3}: style = "Style is : important = for all } things"
94
+
95
+ ***
96
+ # Head # {ref1 ref2 ref3}
97
+
98
+ {ref1}: id:id1 class:class1
99
+ {ref2}: class : class2
100
+ {ref3}: style = "Style is : important = for all } things"
101
+
102
+ ***
103
+
104
+ # Head # {#id1 .class1 ref2 ref3}
105
+
106
+ {ref2}: class : class2
107
+ {ref3}: style = "Style is : important = for all } things"
108
+
109
+ ***
110
+
111
+ # Head # { #id1 .class1 ref2 ref3 }
112
+
113
+ {ref2}: class : class2
114
+ {ref3}: style = "Style is : important = for all } things"
115
+
116
+ ***
117
+
118
+ # Head # { id=id1 class=class1 ref2 ref3 }
119
+
120
+ {ref2}: class : class2
121
+ {ref3}: style = "Style is : important = for all } things"
122
+
123
+ ***
124
+
125
+ # Head # { id:id1 class="class1" class:"class2" style="Style is : important = for all } things"}
126
+
127
+ EOF
128
+
129
+ end
130
+
131
+ if File.basename($0) == 'tests.rb'
132
+ Maruku.metaTests
133
+
134
+ end
135
+
136
+
@@ -0,0 +1 @@
1
+ require 'maruku/input_textile2/t2_parser'
@@ -0,0 +1,199 @@
1
+ #--
2
+ # Copyright (C) 2006 Andrea Censi <andrea (at) rubyforge.org>
3
+ #
4
+ # This file is part of Maruku.
5
+ #
6
+ # Maruku is free software; you can redistribute it and/or modify
7
+ # it under the terms of the GNU General Public License as published by
8
+ # the Free Software Foundation; either version 2 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # Maruku is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with Maruku; if not, write to the Free Software
18
+ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
+ #++
20
+
21
+
22
+ module MaRuKu
23
+
24
+ class MDDocument
25
+ # an instance of Section (see below)
26
+ attr_accessor :toc
27
+ end
28
+
29
+ # This represents a section in the TOC.
30
+ class Section
31
+ # a Fixnum, is == header_element.level
32
+ attr_accessor :section_level
33
+
34
+ # An array of fixnum, like [1,2,5] for Section 1.2.5
35
+ attr_accessor :section_number
36
+
37
+ # reference to header (header has h.meta[:section] to self)
38
+ attr_accessor :header_element
39
+
40
+ # Array of immediate children of this element
41
+ attr_accessor :immediate_children
42
+
43
+ # Array of Section inside this section
44
+ attr_accessor :section_children
45
+
46
+ def initialize
47
+ @immediate_children = []
48
+ @section_children = []
49
+ end
50
+ end
51
+
52
+ class Section
53
+ def inspect(indent=1)
54
+ s = ""
55
+ if @header_element
56
+ s += "\_"*indent + "(#{@section_level})>\t #{@section_number.join('.')} : "
57
+ s += @header_element.children_to_s +
58
+ " (id: '#{@header_element.attributes[:id]}')\n"
59
+ else
60
+ s += "Master\n"
61
+ end
62
+
63
+ @section_children.each do |c|
64
+ s+=c.inspect(indent+1)
65
+ end
66
+ s
67
+ end
68
+
69
+ # Numerate this section and its children
70
+ def numerate(a=[])
71
+ self.section_number = a
72
+ section_children.each_with_index do |c,i|
73
+ c.numerate(a.clone.push(i+1))
74
+ end
75
+ if h = self.header_element
76
+ h.attributes[:section_number] = self.section_number
77
+ end
78
+ end
79
+
80
+ include REXML
81
+ # Creates an HTML toc.
82
+ # Call this on the root
83
+ def to_html
84
+ div = Element.new 'div'
85
+ div.attributes['class'] = 'maruku_toc'
86
+ div << create_toc
87
+ div
88
+ end
89
+
90
+ def create_toc
91
+ ul = Element.new 'ul'
92
+ # let's remove the bullets
93
+ ul.attributes['style'] = 'list-style: none;'
94
+ @section_children.each do |c|
95
+ li = Element.new 'li'
96
+ if span = c.header_element.render_section_number
97
+ li << span
98
+ end
99
+ a = c.header_element.wrap_as_element('a')
100
+ a.delete_attribute 'id'
101
+ a.attributes['href'] = "##{c.header_element.attributes[:id]}"
102
+ li << a
103
+ li << c.create_toc if c.section_children.size>0
104
+ ul << li
105
+ end
106
+ ul
107
+ end
108
+
109
+ # Creates a latex toc.
110
+ # Call this on the root
111
+ def to_latex
112
+ to_latex_rec + "\n\n"
113
+ end
114
+
115
+ def to_latex_rec
116
+ s = ""
117
+ @section_children.each do |c|
118
+ s += "\\noindent"
119
+ number = c.header_element.section_number
120
+ s += number if number
121
+ text = c.header_element.children_to_latex
122
+ id = c.header_element.attributes[:id]
123
+ s += "\\hyperlink{#{id}}{#{text}}"
124
+ s += "\\dotfill \\pageref*{#{id}} \\linebreak\n"
125
+ s += c.to_latex_rec if c.section_children.size>0
126
+
127
+ end
128
+ s
129
+ end
130
+
131
+ end
132
+
133
+ class MDDocument
134
+
135
+ def create_toc
136
+ each_element(:header) do |h|
137
+ h.attributes[:id] ||= h.generate_id
138
+ end
139
+
140
+ stack = []
141
+
142
+ # the ancestor section
143
+ s = Section.new
144
+ s.section_level = 0
145
+
146
+ stack.push s
147
+
148
+ i = 0;
149
+ while i < @children.size
150
+ while i < @children.size
151
+ if @children[i].node_type == :header
152
+ level = @children[i].level
153
+ break if level <= stack.last.section_level+1
154
+ end
155
+
156
+ stack.last.immediate_children.push @children[i]
157
+ i += 1
158
+ end
159
+
160
+ break if i>=@children.size
161
+
162
+ header = @children[i]
163
+ level = header.level
164
+
165
+ if level > stack.last.section_level
166
+ # this level is inside
167
+
168
+ s2 = Section.new
169
+ s2.section_level = level
170
+ s2.header_element = header
171
+ header.instance_variable_set :@section, s2
172
+
173
+ stack.last.section_children.push s2
174
+ stack.push s2
175
+
176
+ i+=1
177
+ elsif level == stack.last.section_level
178
+ # this level is a sibling
179
+ stack.pop
180
+ else
181
+ # this level is a parent
182
+ stack.pop
183
+ end
184
+
185
+ end
186
+
187
+ # If there is only one big header, then assume
188
+ # it is the master
189
+ if s.section_children.size == 1
190
+ s = s.section_children.first
191
+ end
192
+
193
+ # Assign section numbers
194
+ s.numerate
195
+
196
+ s
197
+ end
198
+ end
199
+ end
@@ -0,0 +1,33 @@
1
+ require 'maruku'
2
+
3
+ text = <<EOF
4
+ Chapter 1
5
+ =========
6
+
7
+ It was a stormy and rainy night.
8
+
9
+ EOF
10
+
11
+ invalid = <<EOF
12
+
13
+ This is a [bad link.
14
+
15
+ EOF
16
+
17
+ Maruku.new(text).to_html
18
+
19
+ s = ""
20
+
21
+ begin
22
+ Maruku.new(invalid, {:on_error => :raise, :error_stream => s})
23
+ puts "Error! It should have thrown an exception."
24
+ rescue
25
+ # puts "ok, got error"
26
+ end
27
+
28
+ begin
29
+ Maruku.new(invalid, {:on_error => :warning, :error_stream => s})
30
+ rescue
31
+ puts "Error! It should not have thrown an exception."
32
+ end
33
+
@@ -0,0 +1,40 @@
1
+ #--
2
+ # Copyright (C) 2006 Andrea Censi <andrea (at) rubyforge.org>
3
+ #
4
+ # This file is part of Maruku.
5
+ #
6
+ # Maruku is free software; you can redistribute it and/or modify
7
+ # it under the terms of the GNU General Public License as published by
8
+ # the Free Software Foundation; either version 2 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # Maruku is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with Maruku; if not, write to the Free Software
18
+ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
+ #++
20
+
21
+ module MaRuKu
22
+ Version = '0.5.9'
23
+
24
+ MarukuURL = 'http://maruku.rubyforge.org/'
25
+
26
+ # If true, use also PHP Markdown extra syntax
27
+ #
28
+ # Note: it is not guaranteed that if it's false
29
+ # then no special features will be used.
30
+ #
31
+ # So please, ignore it for now.
32
+ def markdown_extra?
33
+ true
34
+ end
35
+
36
+ def new_meta_data?
37
+ true
38
+ end
39
+
40
+ end
@@ -0,0 +1,16 @@
1
+ **This bug is now solved**
2
+
3
+ Previously, a bug would not let you use `code` inside links text.
4
+
5
+ So this:
6
+ Use the [`syntax`][syntax]
7
+ produces:
8
+ > Use the [`syntax`][syntax]
9
+
10
+ And this:
11
+ Use the `[syntax][syntax]`
12
+ produces:
13
+ > Use the `[syntax][syntax]`
14
+
15
+ [syntax]: http://gogole.com
16
+
@@ -0,0 +1,4 @@
1
+
2
+
3
+ What do you see here? `\\` it should be two backslashes.
4
+
@@ -0,0 +1,46 @@
1
+ LaTeX preamble: preamble.tex
2
+ CSS: math.css
3
+
4
+ Here are some formulas:
5
+
6
+ * $\alpha$
7
+ * $x^{n}+y^{n} \neq z^{n}$
8
+
9
+ Some inline maths: $\sum_{n=1}^\infty \frac{(-1)^n}{n} = \ln 2$.
10
+
11
+ Some display maths:
12
+
13
+ \[ \sum_{n=1}^\infty \frac{1}{n} \]
14
+ \[ \sum_{n=1}^\infty \frac{1}{n} \text{ is divergent, but } \lim_{n \to \infty} \sum_{i=1}^n \frac{1}{i} - \ln n \text{ exists.} \] (a)
15
+
16
+ Some random AMSTeX symbols - thanks to Robin Snader for adding these:
17
+
18
+ $$ \beth \Subset \bigtriangleup \smallsmile \bumpeq \ggg \pitchfork $$
19
+
20
+ Note that $\hat g$ , $J$, and $\gamma_1\gamma_2$ all restrict to
21
+
22
+ $x_1 \overline{x_2} \oplus x_2 \overline{x_1}$ and that this module
23
+ is linear in $x_1$ and $x_2$.
24
+
25
+ See label \eqref{a}.
26
+
27
+ $$ \href{#hello}{\alpha+\beta} $$
28
+
29
+ ## Cross references ##
30
+
31
+ The following are 4 equations, labeled A,B,C,D:
32
+
33
+ $$ \alpha $$ (A)
34
+
35
+ \[
36
+ \beta
37
+ \] (B)
38
+
39
+ $$ \gamma \label{C} $$
40
+
41
+ \[
42
+ \delta \label{D}
43
+ \]
44
+
45
+ You can now refer to (eq:A), (eq:B), \eqref{C}, \eqref{D}.
46
+