diff options
author | John MacFarlane <jgm@berkeley.edu> | 2017-03-23 12:59:19 +0100 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2017-03-23 12:59:19 +0100 |
commit | d20d3a5dbbb1bb1e6b6de5fc3d9c65bf844dcb56 (patch) | |
tree | ca16d486e3a55a1e7a9a63f19b772d9dfe19430f | |
parent | 1af6faf2d4fce2cfa30cd4ebc15c1613c8f2abd8 (diff) | |
download | pandoc-d20d3a5dbbb1bb1e6b6de5fc3d9c65bf844dcb56.tar.gz |
Ms writer: Super/subscript support.
Also added some macro definitions to default template
to support subscripts + better superscripts.
-rw-r--r-- | data/templates/default.ms | 10 | ||||
-rw-r--r-- | src/Text/Pandoc/Writers/Ms.hs | 4 |
2 files changed, 12 insertions, 2 deletions
diff --git a/data/templates/default.ms b/data/templates/default.ms index 7ca8a8e75..12f82cd55 100644 --- a/data/templates/default.ms +++ b/data/templates/default.ms @@ -11,6 +11,16 @@ $if(has-inline-math)$ delim || .EN $endif$ +\" From https://lists.gnu.org/archive/html/groff/2012-07/msg00046.html +\" Superscripts (ex tmac.e) (current versions without extra line space) +.\" (reinstate commented versions to restore extra line space) +.\" .ds { \v'-0.3m'\x'-0.2m'\\s[\\n[.s]*8u/10u] +.ds { \v'-0.3m'\\s[\\n[.s]*9u/12u] +.ds } \s0\v'0.3m' +.\" Subscripts +.\" .ds < \v'0.3m'\x'0.2m'\s[\\n[.s]*8u/10u] +.ds < \v'0.3m'\s[\\n[.s]*9u/12u] +.ds > \s0\v'-0.3m' $if(title)$ .TL $title$ diff --git a/src/Text/Pandoc/Writers/Ms.hs b/src/Text/Pandoc/Writers/Ms.hs index d228235f1..5994545e5 100644 --- a/src/Text/Pandoc/Writers/Ms.hs +++ b/src/Text/Pandoc/Writers/Ms.hs @@ -397,10 +397,10 @@ inlineToMs opts (Strikeout lst) = do return $ text "[STRIKEOUT:" <> contents <> char ']' inlineToMs opts (Superscript lst) = do contents <- inlineListToMs opts lst - return $ char '^' <> contents <> char '^' + return $ text "\\*{" <> contents <> text "\\*}" inlineToMs opts (Subscript lst) = do contents <- inlineListToMs opts lst - return $ char '~' <> contents <> char '~' + return $ text "\\*<" <> contents <> text "\\*>" inlineToMs opts (SmallCaps lst) = do -- see https://lists.gnu.org/archive/html/groff/2015-01/msg00016.html modify $ \st -> st{ stSmallCaps = not (stSmallCaps st) } |