git.iko.soy/typeable/pandoc
on master help sign in
Use texmath's parser in TexMath module.
c243e5bJohn MacFarlane
src/Text/Pandoc/Readers/TeXMath.hs+53−197
@@ -28,208 +28,64 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28Conversion of TeX math to a list of 'Pandoc' inline elements.
28Conversion of TeX math to a list of 'Pandoc' inline elements.
29-}
29-}
30module Text.Pandoc.Readers.TeXMath (
30module Text.Pandoc.Readers.TeXMath (
31− readTeXMath
31+ readTeXMath
32 ) where
32 ) where
33
33
34import Text.ParserCombinators.Parsec
34import Text.ParserCombinators.Parsec
35import Text.Pandoc.Definition
35import Text.Pandoc.Definition
36+import Text.TeXMath.Parser
36
37
37−-- | Converts a string of raw TeX math to a list of 'Pandoc' inlines.
38+-- | Converts a raw TeX math formula to a list of 'Pandoc' inlines.
39+-- Defaults to raw formula between @$@ characters if entire formula
40+-- can't be converted.
38readTeXMath :: String -- ^ String to parse (assumes @'\n'@ line endings)
41readTeXMath :: String -- ^ String to parse (assumes @'\n'@ line endings)
39 -> [Inline]
42 -> [Inline]
40−readTeXMath inp = case parse teXMath ("formula: " ++ inp) inp of
43+readTeXMath inp = case readTeXMath' inp of
41− Left _ -> [Str inp] -- if unparseable, just include original
44+ Nothing -> [Str ("$" ++ inp ++ "$")]
42− Right res -> res
45+ Just res -> res
43−
46+
44−teXMath :: GenParser Char st [Inline]
47+-- | Like 'readTeXMath', but without the default.
45−teXMath = manyTill mathPart eof >>= return . concat
48+readTeXMath' :: String -- ^ String to parse (assumes @'\n'@ line endings)
46−
49+ -> Maybe [Inline]
47−mathPart :: GenParser Char st [Inline]
50+readTeXMath' inp = case parse formula "formula" inp of
48−mathPart = whitespace <|> superscript <|> subscript <|> symbol <|>
51+ Left _ -> Just [Str inp]
49− argument <|> digits <|> letters <|> misc
52+ Right exps -> expsToInlines exps
50−
53+
51−whitespace :: GenParser Char st [Inline]
54+expsToInlines :: [Exp] -> Maybe [Inline]
52−whitespace = many1 space >> return []
55+expsToInlines xs = do
53−
56+ res <- mapM expToInlines xs
54−symbol :: GenParser Char st [Inline]
57+ return (concat res)
55−symbol = try $ do
58+
56− char '\\'
59+expToInlines :: Exp -> Maybe [Inline]
57− res <- many1 letter
60+expToInlines (ENumber s) = Just [Str s]
58− case lookup res teXsymbols of
61+expToInlines (EIdentifier s) = Just [Emph [Str s]]
59− Just m -> return [Str m]
62+expToInlines (EMathOperator s) = Just [Str s]
60− Nothing -> return [Str $ "\\" ++ res]
63+expToInlines (ESymbol t s) = Just $ addSpace t (Str s)
61−
64+ where addSpace Op x = [x, thinspace]
62−argument :: GenParser Char st [Inline]
65+ addSpace Bin x = [medspace, x, medspace]
63−argument = try $ do
66+ addSpace Rel x = [widespace, x, widespace]
64− char '{'
67+ addSpace Pun x = [x, thinspace]
65− res <- many mathPart
68+ addSpace _ x = [x]
66− char '}'
69+ thinspace = Str "\x2006"
67− return $ if null res
70+ medspace = Str "\x2005"
68− then [Str " "]
71+ widespace = Str "\x2004"
69− else [Str "{"] ++ concat res ++ [Str "}"]
72+expToInlines (EStretchy x) = expToInlines x
70−
73+expToInlines (EGrouped xs) = expsToInlines xs
71−digits :: GenParser Char st [Inline]
74+expToInlines (ESpace _) = Just [Str " "] -- variable widths not supported
72−digits = do
75+expToInlines (EBinary _ _ _) = Nothing
73− res <- many1 digit
76+expToInlines (ESub x y) = do
74− return [Str res]
77+ x' <- expToInlines x
75−
78+ y' <- expToInlines y
76−letters :: GenParser Char st [Inline]
79+ return $ x' ++ [Subscript y']
77−letters = do
80+expToInlines (ESuper x y) = do
78− res <- many1 letter
81+ x' <- expToInlines x
79− return [Emph [Str res]]
82+ y' <- expToInlines y
80−
83+ return $ x' ++ [Superscript y']
81−misc :: GenParser Char st [Inline]
84+expToInlines (ESubsup x y z) = do
82−misc = do
85+ x' <- expToInlines x
83− res <- noneOf "}"
86+ y' <- expToInlines y
84− return [Str [res]]
87+ z' <- expToInlines z
85−
88+ return $ x' ++ [Subscript y'] ++ [Superscript z']
86−scriptArg :: GenParser Char st [Inline]
89+expToInlines (EText _ x) = Just [Emph [Str x]]
87−scriptArg = try $ do
90+expToInlines _ = Nothing
88− (try (do{char '{'; r <- many mathPart; char '}'; return $ concat r}))
89− <|> symbol
90− <|> (do{c <- (letter <|> digit); return [Str [c]]})
91−
92−superscript :: GenParser Char st [Inline]
93−superscript = try $ do
94− char '^'
95− arg <- scriptArg
96− return [Superscript arg]
97−
98−subscript :: GenParser Char st [Inline]
99−subscript = try $ do
100− char '_'
101− arg <- scriptArg
102− return [Subscript arg]
103−
104−withThinSpace :: String -> String
105−withThinSpace str = "\x2009" ++ str ++ "\x2009"
106−
107−teXsymbols :: [(String, String)]
108−teXsymbols =
109− [("alpha","\x3B1")
110− ,("beta", "\x3B2")
111− ,("chi", "\x3C7")
112− ,("delta", "\x3B4")
113− ,("Delta", "\x394")
114− ,("epsilon", "\x3B5")
115− ,("varepsilon", "\x25B")
116− ,("eta", "\x3B7")
117− ,("gamma", "\x3B3")
118− ,("Gamma", "\x393")
119− ,("iota", "\x3B9")
120− ,("kappa", "\x3BA")
121− ,("lambda", "\x3BB")
122− ,("Lambda", "\x39B")
123− ,("mu", "\x3BC")
124− ,("nu", "\x3BD")
125− ,("omega", "\x3C9")
126− ,("Omega", "\x3A9")
127− ,("phi", "\x3C6")
128− ,("varphi", "\x3D5")
129− ,("Phi", "\x3A6")
130− ,("pi", "\x3C0")
131− ,("Pi", "\x3A0")
132− ,("psi", "\x3C8")
133− ,("Psi", "\x3A8")
134− ,("rho", "\x3C1")
135− ,("sigma", "\x3C3")
136− ,("Sigma", "\x3A3")
137− ,("tau", "\x3C4")
138− ,("theta", "\x3B8")
139− ,("vartheta", "\x3D1")
140− ,("Theta", "\x398")
141− ,("upsilon", "\x3C5")
142− ,("xi", "\x3BE")
143− ,("Xi", "\x39E")
144− ,("zeta", "\x3B6")
145− ,("ne", "\x2260")
146− ,("lt", withThinSpace "<")
147− ,("le", withThinSpace "\x2264")
148− ,("leq", withThinSpace "\x2264")
149− ,("ge", withThinSpace "\x2265")
150− ,("geq", withThinSpace "\x2265")
151− ,("prec", withThinSpace "\x227A")
152− ,("succ", withThinSpace "\x227B")
153− ,("preceq", withThinSpace "\x2AAF")
154− ,("succeq", withThinSpace "\x2AB0")
155− ,("in", withThinSpace "\x2208")
156− ,("notin", withThinSpace "\x2209")
157− ,("subset", withThinSpace "\x2282")
158− ,("supset", withThinSpace "\x2283")
159− ,("subseteq", withThinSpace "\x2286")
160− ,("supseteq", withThinSpace "\x2287")
161− ,("equiv", withThinSpace "\x2261")
162− ,("cong", withThinSpace "\x2245")
163− ,("approx", withThinSpace "\x2248")
164− ,("propto", withThinSpace "\x221D")
165− ,("cdot", withThinSpace "\x22C5")
166− ,("star", withThinSpace "\x22C6")
167− ,("backslash", "\\")
168− ,("times", withThinSpace "\x00D7")
169− ,("divide", withThinSpace "\x00F7")
170− ,("circ", withThinSpace "\x2218")
171− ,("oplus", withThinSpace "\x2295")
172− ,("otimes", withThinSpace "\x2297")
173− ,("odot", withThinSpace "\x2299")
174− ,("sum", "\x2211")
175− ,("prod", "\x220F")
176− ,("wedge", withThinSpace "\x2227")
177− ,("bigwedge", withThinSpace "\x22C0")
178− ,("vee", withThinSpace "\x2228")
179− ,("bigvee", withThinSpace "\x22C1")
180− ,("cap", withThinSpace "\x2229")
181− ,("bigcap", withThinSpace "\x22C2")
182− ,("cup", withThinSpace "\x222A")
183− ,("bigcup", withThinSpace "\x22C3")
184− ,("neg", "\x00AC")
185− ,("implies", withThinSpace "\x21D2")
186− ,("iff", withThinSpace "\x21D4")
187− ,("forall", "\x2200")
188− ,("exists", "\x2203")
189− ,("bot", "\x22A5")
190− ,("top", "\x22A4")
191− ,("vdash", "\x22A2")
192− ,("models", withThinSpace "\x22A8")
193− ,("uparrow", "\x2191")
194− ,("downarrow", "\x2193")
195− ,("rightarrow", withThinSpace "\x2192")
196− ,("to", withThinSpace "\x2192")
197− ,("rightarrowtail", "\x21A3")
198− ,("twoheadrightarrow", withThinSpace "\x21A0")
199− ,("twoheadrightarrowtail", withThinSpace "\x2916")
200− ,("mapsto", withThinSpace "\x21A6")
201− ,("leftarrow", withThinSpace "\x2190")
202− ,("leftrightarrow", withThinSpace "\x2194")
203− ,("Rightarrow", withThinSpace "\x21D2")
204− ,("Leftarrow", withThinSpace "\x21D0")
205− ,("Leftrightarrow", withThinSpace "\x21D4")
206− ,("partial", "\x2202")
207− ,("nabla", "\x2207")
208− ,("pm", "\x00B1")
209− ,("emptyset", "\x2205")
210− ,("infty", "\x221E")
211− ,("aleph", "\x2135")
212− ,("ldots", "...")
213− ,("therefore", "\x2234")
214− ,("angle", "\x2220")
215− ,("quad", "\x00A0\x00A0")
216− ,("cdots", "\x22EF")
217− ,("vdots", "\x22EE")
218− ,("ddots", "\x22F1")
219− ,("diamond", "\x22C4")
220− ,("Box", "\x25A1")
221− ,("lfloor", "\x230A")
222− ,("rfloor", "\x230B")
223− ,("lceiling", "\x2308")
224− ,("rceiling", "\x2309")
225− ,("langle", "\x2329")
226− ,("rangle", "\x232A")
227− ,("int", "\8747")
228− ,("{", "{")
229− ,("}", "}")
230− ,("[", "[")
231− ,("]", "]")
232− ,("|", "|")
233− ,("||", "||")
234− ]
235
91
tests/s5.basic.html+1−25
@@ -309,31 +309,7 @@
309><ul
309><ul
310><li
310><li
311 ><span class="math"
311 ><span class="math"
312− >\frac{<em
312+ >$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$</span
313− >d</em
314− >}{<em
315− >dx</em
316− >}<em
317− >f</em
318− >(<em
319− >x</em
320− >)=\lim<sub
321− ><em
322− >h</em
323− > → 0</sub
324− >\frac{<em
325− >f</em
326− >(<em
327− >x</em
328− >+<em
329− >h</em
330− >)-<em
331− >f</em
332− >(<em
333− >x</em
334− >)}{<em
335− >h</em
336− >}</span
337 ></li
313 ></li
338 ></ul
314 ></ul
339></div>
315></div>
tests/s5.fragment.html+1−25
@@ -14,31 +14,7 @@
14 ><ul
14 ><ul
15 ><li
15 ><li
16 ><span class="math"
16 ><span class="math"
17− >\frac{<em
17+ >$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$</span
18− >d</em
19− >}{<em
20− >dx</em
21− >}<em
22− >f</em
23− >(<em
24− >x</em
25− >)=\lim<sub
26− ><em
27− >h</em
28− > → 0</sub
29− >\frac{<em
30− >f</em
31− >(<em
32− >x</em
33− >+<em
34− >h</em
35− >)-<em
36− >f</em
37− >(<em
38− >x</em
39− >)}{<em
40− >h</em
41− >}</span
42 ></li
18 ></li
43 ></ul
19 ></ul
44 ></div
20 ></div
tests/s5.inserts.html+1−25
@@ -29,31 +29,7 @@ STUFF INSERTED
29 ><ul
29 ><ul
30 ><li
30 ><li
31 ><span class="math"
31 ><span class="math"
32− >\frac{<em
32+ >$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$</span
33− >d</em
34− >}{<em
35− >dx</em
36− >}<em
37− >f</em
38− >(<em
39− >x</em
40− >)=\lim<sub
41− ><em
42− >h</em
43− > → 0</sub
44− >\frac{<em
45− >f</em
46− >(<em
47− >x</em
48− >+<em
49− >h</em
50− >)-<em
51− >f</em
52− >(<em
53− >x</em
54− >)}{<em
55− >h</em
56− >}</span
57 ></li
33 ></li
58 ></ul
34 ></ul
59 ></div
35 ></div
tests/writer.docbook+5−5
@@ -1077,17 +1077,17 @@ Blah
1077 </listitem>
1077 </listitem>
1078 <listitem>
1078 <listitem>
1079 <para>
1079 <para>
1080− 2+2=4
1080+ 2 + 2 = 4
1081 </para>
1081 </para>
1082 </listitem>
1082 </listitem>
1083 <listitem>
1083 <listitem>
1084 <para>
1084 <para>
1085− <emphasis>x</emphasis> ∈ <emphasis>y</emphasis>
1085+ <emphasis>x</emphasis> ∈ <emphasis>y</emphasis>
1086 </para>
1086 </para>
1087 </listitem>
1087 </listitem>
1088 <listitem>
1088 <listitem>
1089 <para>
1089 <para>
1090− α ∧ ω
1090+ α ∧ ω
1091 </para>
1091 </para>
1092 </listitem>
1092 </listitem>
1093 <listitem>
1093 <listitem>
@@ -1103,13 +1103,13 @@ Blah
1103 <listitem>
1103 <listitem>
1104 <para>
1104 <para>
1105 Here's some display math:
1105 Here's some display math:
1106− \frac{<emphasis>d</emphasis>}{<emphasis>dx</emphasis>}<emphasis>f</emphasis>(<emphasis>x</emphasis>)=\lim<subscript><emphasis>h</emphasis> → 0</subscript>\frac{<emphasis>f</emphasis>(<emphasis>x</emphasis>+<emphasis>h</emphasis>)-<emphasis>f</emphasis>(<emphasis>x</emphasis>)}{<emphasis>h</emphasis>}
1106+ $\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$
1107 </para>
1107 </para>
1108 </listitem>
1108 </listitem>
1109 <listitem>
1109 <listitem>
1110 <para>
1110 <para>
1111 Here's one that has a line break in it:
1111 Here's one that has a line break in it:
1112− α+ω × <emphasis>x</emphasis><superscript>2</superscript>.
1112+ α + ω × <emphasis>x</emphasis><superscript>2</superscript>.
1113 </para>
1113 </para>
1114 </listitem>
1114 </listitem>
1115 </itemizedlist>
1115 </itemizedlist>
tests/writer.html+5−29
@@ -830,19 +830,19 @@ Blah
830 ></li
830 ></li
831 ><li
831 ><li
832 ><span class="math"
832 ><span class="math"
833− >2+2=4</span
833+ >2 + 2 = 4</span
834 ></li
834 ></li
835 ><li
835 ><li
836 ><span class="math"
836 ><span class="math"
837 ><em
837 ><em
838 >x</em
838 >x</em
839− > ∈ <em
839+ > ∈ <em
840 >y</em
840 >y</em
841 ></span
841 ></span
842 ></li
842 ></li
843 ><li
843 ><li
844 ><span class="math"
844 ><span class="math"
845− >α ∧ ω</span
845+ >α ∧ ω</span
846 ></li
846 ></li
847 ><li
847 ><li
848 ><span class="math"
848 ><span class="math"
@@ -856,35 +856,11 @@ Blah
856 >-Tree</li
856 >-Tree</li
857 ><li
857 ><li
858 >Here’s some display math: <span class="math"
858 >Here’s some display math: <span class="math"
859− >\frac{<em
859+ >$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$</span
860− >d</em
861− >}{<em
862− >dx</em
863− >}<em
864− >f</em
865− >(<em
866− >x</em
867− >)=\lim<sub
868− ><em
869− >h</em
870− > → 0</sub
871− >\frac{<em
872− >f</em
873− >(<em
874− >x</em
875− >+<em
876− >h</em
877− >)-<em
878− >f</em
879− >(<em
880− >x</em
881− >)}{<em
882− >h</em
883− >}</span
884 ></li
860 ></li
885 ><li
861 ><li
886 >Here’s one that has a line break in it: <span class="math"
862 >Here’s one that has a line break in it: <span class="math"
887− >α+ω × <em
863+ >α + ω × <em
888 >x</em
864 >x</em
889 ><sup
865 ><sup
890 >2</sup
866 >2</sup
tests/writer.opendocument+12−25
@@ -689,30 +689,17 @@
689 <style:style style:name="T59" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
689 <style:style style:name="T59" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
690 <style:style style:name="T60" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
690 <style:style style:name="T60" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
691 <style:style style:name="T61" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
691 <style:style style:name="T61" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
692− <style:style style:name="T62" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
692+ <style:style style:name="T62" style:family="text"><style:text-properties style:text-position="super 58%" /></style:style>
693 <style:style style:name="T63" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
693 <style:style style:name="T63" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
694 <style:style style:name="T64" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
694 <style:style style:name="T64" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
695− <style:style style:name="T65" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" style:text-position="sub 58%" /></style:style>
695+ <style:style style:name="T65" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
696− <style:style style:name="T66" style:family="text"><style:text-properties style:text-position="sub 58%" /></style:style>
696+ <style:style style:name="T66" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
697− <style:style style:name="T67" style:family="text"><style:text-properties style:text-position="sub 58%" /></style:style>
697+ <style:style style:name="T67" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
698 <style:style style:name="T68" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
698 <style:style style:name="T68" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
699 <style:style style:name="T69" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
699 <style:style style:name="T69" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
700 <style:style style:name="T70" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
700 <style:style style:name="T70" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
701 <style:style style:name="T71" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
701 <style:style style:name="T71" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
702 <style:style style:name="T72" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
702 <style:style style:name="T72" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
703− <style:style style:name="T73" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
704− <style:style style:name="T74" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
705− <style:style style:name="T75" style:family="text"><style:text-properties style:text-position="super 58%" /></style:style>
706− <style:style style:name="T76" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
707− <style:style style:name="T77" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
708− <style:style style:name="T78" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
709− <style:style style:name="T79" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
710− <style:style style:name="T80" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
711− <style:style style:name="T81" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
712− <style:style style:name="T82" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
713− <style:style style:name="T83" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
714− <style:style style:name="T84" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
715− <style:style style:name="T85" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
716 <style:style style:name="P1" style:family="paragraph" style:parent-style-name="Quotations">
703 <style:style style:name="P1" style:family="paragraph" style:parent-style-name="Quotations">
717 <style:paragraph-properties fo:margin-left="0.5in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" />
704 <style:paragraph-properties fo:margin-left="0.5in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" />
718 </style:style>
705 </style:style>
@@ -1317,13 +1304,13 @@
1317 <text:p text:style-name="P51"><text:span text:style-name="Teletype">\cite[22-23]{smith.1899}</text:span></text:p>
1304 <text:p text:style-name="P51"><text:span text:style-name="Teletype">\cite[22-23]{smith.1899}</text:span></text:p>
1318 </text:list-item>
1305 </text:list-item>
1319 <text:list-item>
1306 <text:list-item>
1320− <text:p text:style-name="P51">2+2=4</text:p>
1307+ <text:p text:style-name="P51">2 + 2 = 4</text:p>
1321 </text:list-item>
1308 </text:list-item>
1322 <text:list-item>
1309 <text:list-item>
1323− <text:p text:style-name="P51"><text:span text:style-name="T58">x</text:span> ∈ <text:span text:style-name="T59">y</text:span></text:p>
1310+ <text:p text:style-name="P51"><text:span text:style-name="T58">x</text:span> ∈ <text:span text:style-name="T59">y</text:span></text:p>
1324 </text:list-item>
1311 </text:list-item>
1325 <text:list-item>
1312 <text:list-item>
1326− <text:p text:style-name="P51">α ∧ ω</text:p>
1313+ <text:p text:style-name="P51">α ∧ ω</text:p>
1327 </text:list-item>
1314 </text:list-item>
1328 <text:list-item>
1315 <text:list-item>
1329 <text:p text:style-name="P51">223</text:p>
1316 <text:p text:style-name="P51">223</text:p>
@@ -1332,10 +1319,10 @@
1332 <text:p text:style-name="P51"><text:span text:style-name="T60">p</text:span>-Tree</text:p>
1319 <text:p text:style-name="P51"><text:span text:style-name="T60">p</text:span>-Tree</text:p>
1333 </text:list-item>
1320 </text:list-item>
1334 <text:list-item>
1321 <text:list-item>
1335− <text:p text:style-name="P51">Here&#8217;s some display math: \frac{<text:span text:style-name="T61">d</text:span>}{<text:span text:style-name="T62">dx</text:span>}<text:span text:style-name="T63">f</text:span>(<text:span text:style-name="T64">x</text:span>)=\lim<text:span text:style-name="T65">h</text:span><text:span text:style-name="T66"> → </text:span><text:span text:style-name="T67">0</text:span>\frac{<text:span text:style-name="T68">f</text:span>(<text:span text:style-name="T69">x</text:span>+<text:span text:style-name="T70">h</text:span>)-<text:span text:style-name="T71">f</text:span>(<text:span text:style-name="T72">x</text:span>)}{<text:span text:style-name="T73">h</text:span>}</text:p>
1322+ <text:p text:style-name="P51">Here&#8217;s some display math: $\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$</text:p>
1336 </text:list-item>
1323 </text:list-item>
1337 <text:list-item>
1324 <text:list-item>
1338− <text:p text:style-name="P51">Here&#8217;s one that has a line break in it: α+ω × <text:span text:style-name="T74">x</text:span><text:span text:style-name="T75">2</text:span>.</text:p>
1325+ <text:p text:style-name="P51">Here&#8217;s one that has a line break in it: α + ω × <text:span text:style-name="T61">x</text:span><text:span text:style-name="T62">2</text:span>.</text:p>
1339 </text:list-item>
1326 </text:list-item>
1340</text:list>
1327</text:list>
1341<text:p text:style-name="Text_20_body">These shouldn&#8217;t be math:</text:p>
1328<text:p text:style-name="Text_20_body">These shouldn&#8217;t be math:</text:p>
@@ -1344,13 +1331,13 @@
1344 <text:p text:style-name="P52">To get the famous equation, write <text:span text:style-name="Teletype">$e = mc^2$</text:span>.</text:p>
1331 <text:p text:style-name="P52">To get the famous equation, write <text:span text:style-name="Teletype">$e = mc^2$</text:span>.</text:p>
1345 </text:list-item>
1332 </text:list-item>
1346 <text:list-item>
1333 <text:list-item>
1347− <text:p text:style-name="P52">$22,000 is a <text:span text:style-name="T76">lot</text:span> of money. So is $34,000. (It worked if &#8220;lot&#8221; is emphasized.)</text:p>
1334+ <text:p text:style-name="P52">$22,000 is a <text:span text:style-name="T63">lot</text:span> of money. So is $34,000. (It worked if &#8220;lot&#8221; is emphasized.)</text:p>
1348 </text:list-item>
1335 </text:list-item>
1349 <text:list-item>
1336 <text:list-item>
1350 <text:p text:style-name="P52">Shoes ($20) and socks ($5).</text:p>
1337 <text:p text:style-name="P52">Shoes ($20) and socks ($5).</text:p>
1351 </text:list-item>
1338 </text:list-item>
1352 <text:list-item>
1339 <text:list-item>
1353− <text:p text:style-name="P52">Escaped <text:span text:style-name="Teletype">$</text:span>: $73 <text:span text:style-name="T77">this</text:span><text:span text:style-name="T78"> </text:span><text:span text:style-name="T79">should</text:span><text:span text:style-name="T80"> </text:span><text:span text:style-name="T81">be</text:span><text:span text:style-name="T82"> </text:span><text:span text:style-name="T83">emphasized</text:span> 23$.</text:p>
1340+ <text:p text:style-name="P52">Escaped <text:span text:style-name="Teletype">$</text:span>: $73 <text:span text:style-name="T64">this</text:span><text:span text:style-name="T65"> </text:span><text:span text:style-name="T66">should</text:span><text:span text:style-name="T67"> </text:span><text:span text:style-name="T68">be</text:span><text:span text:style-name="T69"> </text:span><text:span text:style-name="T70">emphasized</text:span> 23$.</text:p>
1354 </text:list-item>
1341 </text:list-item>
1355</text:list>
1342</text:list>
1356<text:p text:style-name="Text_20_body">Here&#8217;s a LaTeX table:</text:p>
1343<text:p text:style-name="Text_20_body">Here&#8217;s a LaTeX table:</text:p>
@@ -1454,7 +1441,7 @@ Cat <text:s text:c="3" />&amp; 1 <text:s text:c="5" />\\ \hline
1454<text:p text:style-name="Text_20_body">Here is a movie <draw:frame><draw:image xlink:href="movie.jpg" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad" /></draw:frame> icon.</text:p>
1441<text:p text:style-name="Text_20_body">Here is a movie <draw:frame><draw:image xlink:href="movie.jpg" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad" /></draw:frame> icon.</text:p>
1455<text:p text:style-name="Horizontal_20_Line" />
1442<text:p text:style-name="Horizontal_20_Line" />
1456<text:h text:style-name="Heading_20_1" text:outline-level="1">Footnotes</text:h>
1443<text:h text:style-name="Heading_20_1" text:outline-level="1">Footnotes</text:h>
1457−<text:p text:style-name="Text_20_body">Here is a footnote reference,<text:note text:id="ftn0" text:note-class="footnote"><text:note-citation>1</text:note-citation><text:note-body><text:p text:style-name="Footnote">Here is the footnote. It can go anywhere after the footnote reference. It need not be placed at the end of the document.</text:p></text:note-body></text:note> and another.<text:note text:id="ftn1" text:note-class="footnote"><text:note-citation>2</text:note-citation><text:note-body><text:p text:style-name="Footnote">Here&#8217;s the long note. This one contains multiple blocks.</text:p><text:p text:style-name="Footnote">Subsequent blocks are indented to show that they belong to the footnote (as with list items).</text:p><text:p text:style-name="P58"><text:s text:c="2" />{ &lt;code&gt; }</text:p><text:p text:style-name="Footnote">If you want, you can indent every line, but you can also be lazy and just indent the first line of each block.</text:p></text:note-body></text:note> This should <text:span text:style-name="T84">not</text:span> be a footnote reference, because it contains a space.[^my note] Here is an inline note.<text:note text:id="ftn2" text:note-class="footnote"><text:note-citation>3</text:note-citation><text:note-body><text:p text:style-name="Footnote">This is <text:span text:style-name="T85">easier</text:span> to type. Inline notes may contain <text:a xlink:type="simple" xlink:href="http://google.com" office:name=""><text:span text:style-name="Definition">links</text:span></text:a> and <text:span text:style-name="Teletype">]</text:span> verbatim characters, as well as [bracketed text].</text:p></text:note-body></text:note></text:p>
1444+<text:p text:style-name="Text_20_body">Here is a footnote reference,<text:note text:id="ftn0" text:note-class="footnote"><text:note-citation>1</text:note-citation><text:note-body><text:p text:style-name="Footnote">Here is the footnote. It can go anywhere after the footnote reference. It need not be placed at the end of the document.</text:p></text:note-body></text:note> and another.<text:note text:id="ftn1" text:note-class="footnote"><text:note-citation>2</text:note-citation><text:note-body><text:p text:style-name="Footnote">Here&#8217;s the long note. This one contains multiple blocks.</text:p><text:p text:style-name="Footnote">Subsequent blocks are indented to show that they belong to the footnote (as with list items).</text:p><text:p text:style-name="P58"><text:s text:c="2" />{ &lt;code&gt; }</text:p><text:p text:style-name="Footnote">If you want, you can indent every line, but you can also be lazy and just indent the first line of each block.</text:p></text:note-body></text:note> This should <text:span text:style-name="T71">not</text:span> be a footnote reference, because it contains a space.[^my note] Here is an inline note.<text:note text:id="ftn2" text:note-class="footnote"><text:note-citation>3</text:note-citation><text:note-body><text:p text:style-name="Footnote">This is <text:span text:style-name="T72">easier</text:span> to type. Inline notes may contain <text:a xlink:type="simple" xlink:href="http://google.com" office:name=""><text:span text:style-name="Definition">links</text:span></text:a> and <text:span text:style-name="Teletype">]</text:span> verbatim characters, as well as [bracketed text].</text:p></text:note-body></text:note></text:p>
1458<text:p text:style-name="P59">Notes can go in quotes.<text:note text:id="ftn3" text:note-class="footnote"><text:note-citation>4</text:note-citation><text:note-body><text:p text:style-name="Footnote">In quote.</text:p></text:note-body></text:note></text:p>
1445<text:p text:style-name="P59">Notes can go in quotes.<text:note text:id="ftn3" text:note-class="footnote"><text:note-citation>4</text:note-citation><text:note-body><text:p text:style-name="Footnote">In quote.</text:p></text:note-body></text:note></text:p>
1459<text:list text:style-name="L30">
1446<text:list text:style-name="L30">
1460 <text:list-item>
1447 <text:list-item>
tests/writer.rtf+5−5
@@ -264,13 +264,13 @@ quoted link
264{\pard \qc \f0 \sa180 \li0 \fi0 \emdash\emdash\emdash\emdash\emdash\par}
264{\pard \qc \f0 \sa180 \li0 \fi0 \emdash\emdash\emdash\emdash\emdash\par}
265{\pard \ql \f0 \sa180 \li0 \fi0 \b \fs36 LaTeX\par}
265{\pard \ql \f0 \sa180 \li0 \fi0 \b \fs36 LaTeX\par}
266{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab \par}
266{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab \par}
267−{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab 2+2=4\par}
267+{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab 2\u8197?+\u8197?2\u8196?=\u8196?4\par}
268−{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab {\i x}\u8201?\u8712?\u8201?{\i y}\par}
268+{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab {\i x}\u8196?\u8712?\u8196?{\i y}\par}
269−{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab \u945?\u8201?\u8743?\u8201?\u969?\par}
269+{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab \u945?\u8197?\u8743?\u8197?\u969?\par}
270{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab 223\par}
270{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab 223\par}
271{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab {\i p}-Tree\par}
271{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab {\i p}-Tree\par}
272−{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab Here\u8217's some display math: \\frac\{{\i d}\}\{{\i dx}\}{\i f}({\i x})=\\lim{\sub {\i h}\u8201?\u8594?\u8201?0}\\frac\{{\i f}({\i x}+{\i h})-{\i f}({\i x})\}\{{\i h}\}\par}
272+{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab Here\u8217's some display math: $\\frac\{d\}\{dx\}f(x)=\\lim_\{h\\to 0\}\\frac\{f(x+h)-f(x)\}\{h\}$\par}
273−{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab Here\u8217's one that has a line break in it: \u945?+\u969?\u8201?\u215?\u8201?{\i x}{\super 2}.\sa180\par}
273+{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab Here\u8217's one that has a line break in it: \u945?\u8197?+\u8197?\u969?\u8197?\u215?\u8197?{\i x}{\super 2}.\sa180\par}
274{\pard \ql \f0 \sa180 \li0 \fi0 These shouldn\u8217't be math:\par}
274{\pard \ql \f0 \sa180 \li0 \fi0 These shouldn\u8217't be math:\par}
275{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab To get the famous equation, write {\f1 $e = mc^2$}.\par}
275{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab To get the famous equation, write {\f1 $e = mc^2$}.\par}
276{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab $22,000 is a {\i lot} of money. So is $34,000. (It worked if \u8220"lot\u8221" is emphasized.)\par}
276{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab $22,000 is a {\i lot} of money. So is $34,000. (It worked if \u8220"lot\u8221" is emphasized.)\par}