diff options
author | John MacFarlane <fiddlosopher@gmail.com> | 2012-04-21 09:59:36 -0700 |
---|---|---|
committer | John MacFarlane <fiddlosopher@gmail.com> | 2012-04-21 09:59:36 -0700 |
commit | 869ff4344202e29ae852067c8caebb8bc2abb3ae (patch) | |
tree | 13c351d838842a79c3a720cde9daeadbd3b0368b | |
parent | 9a347c37ad0f5a6f892816e0d213ba5caa5c24cc (diff) | |
download | pandoc-869ff4344202e29ae852067c8caebb8bc2abb3ae.tar.gz |
LaTeX writer: Use fixltx2e package to provide '\textsubscript'.
-rw-r--r-- | src/Text/Pandoc/Writers/LaTeX.hs | 10 | ||||
m--------- | templates | 12 | ||||
-rw-r--r-- | tests/lhs-test.latex | 1 | ||||
-rw-r--r-- | tests/lhs-test.latex+lhs | 1 | ||||
-rw-r--r-- | tests/writer.latex | 5 |
5 files changed, 12 insertions, 17 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index c4ded57c5..923d8361b 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -56,7 +56,6 @@ data WriterState = , stEnumerate :: Bool -- true if document needs fancy enumerated lists , stTable :: Bool -- true if document has a table , stStrikeout :: Bool -- true if document has strikeout - , stSubscript :: Bool -- true if document has subscript , stUrl :: Bool -- true if document has visible URL link , stGraphics :: Bool -- true if document contains images , stLHS :: Bool -- true if document has literate haskell code @@ -75,7 +74,7 @@ writeLaTeX options document = WriterState { stInNote = False, stInTable = False, stTableNotes = [], stOLLevel = 1, stOptions = options, stVerbInNote = False, stEnumerate = False, - stTable = False, stStrikeout = False, stSubscript = False, + stTable = False, stStrikeout = False, stUrl = False, stGraphics = False, stLHS = False, stBook = writerChapters options, stCsquotes = False, stHighlighting = False, @@ -148,7 +147,6 @@ pandocToLaTeX options (Pandoc (Meta title authors date) blocks) = do [ ("fancy-enums", "yes") | stEnumerate st ] ++ [ ("tables", "yes") | stTable st ] ++ [ ("strikeout", "yes") | stStrikeout st ] ++ - [ ("subscript", "yes") | stSubscript st ] ++ [ ("url", "yes") | stUrl st ] ++ [ ("numbersections", "yes") | writerNumberSections options ] ++ [ ("lhs", "yes") | stLHS st ] ++ @@ -503,11 +501,7 @@ inlineToLaTeX (Strikeout lst) = do inlineToLaTeX (Superscript lst) = inlineListToLaTeX lst >>= return . inCmd "textsuperscript" inlineToLaTeX (Subscript lst) = do - modify $ \s -> s{ stSubscript = True } - contents <- inlineListToLaTeX lst - -- oddly, latex includes \textsuperscript but not \textsubscript - -- so we have to define it (using a different name so as not to conflict with memoir class): - return $ inCmd "textsubscr" contents + inlineListToLaTeX lst >>= return . inCmd "textsubscript" inlineToLaTeX (SmallCaps lst) = inlineListToLaTeX lst >>= return . inCmd "textsc" inlineToLaTeX (Cite cits lst) = do diff --git a/templates b/templates -Subproject bf0b37d7eac0df9ba39fe07df18b3e37be36e3d +Subproject c819cf2149b8e0248a133ac5e40c8d4eaca7fc7 diff --git a/tests/lhs-test.latex b/tests/lhs-test.latex index 307139499..2dd93ae25 100644 --- a/tests/lhs-test.latex +++ b/tests/lhs-test.latex @@ -1,6 +1,7 @@ \documentclass[]{article} \usepackage{amssymb,amsmath} \usepackage{ifxetex,ifluatex} +\usepackage{fixltx2e} % provides \textsubscript \ifxetex \usepackage{fontspec,xltxtra,xunicode} \defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase} diff --git a/tests/lhs-test.latex+lhs b/tests/lhs-test.latex+lhs index cda150107..7c3c75cd3 100644 --- a/tests/lhs-test.latex+lhs +++ b/tests/lhs-test.latex+lhs @@ -1,6 +1,7 @@ \documentclass[]{article} \usepackage{amssymb,amsmath} \usepackage{ifxetex,ifluatex} +\usepackage{fixltx2e} % provides \textsubscript \ifxetex \usepackage{fontspec,xltxtra,xunicode} \defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase} diff --git a/tests/writer.latex b/tests/writer.latex index 0600efa1e..a3f2cfddd 100644 --- a/tests/writer.latex +++ b/tests/writer.latex @@ -1,6 +1,7 @@ \documentclass[]{article} \usepackage{amssymb,amsmath} \usepackage{ifxetex,ifluatex} +\usepackage{fixltx2e} % provides \textsubscript \ifxetex \usepackage{fontspec,xltxtra,xunicode} \defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase} @@ -54,7 +55,6 @@ \usepackage[normalem]{ulem} % avoid problems with \sout in headers with hyperref: \pdfstringdefDisableCommands{\renewcommand{\sout}{}} -\newcommand{\textsubscr}[1]{\ensuremath{_{\scriptsize\textrm{#1}}}} \setlength{\parindent}{0pt} \setlength{\parskip}{6pt plus 2pt minus 1pt} \setlength{\emergencystretch}{3em} % prevent overfull lines @@ -596,7 +596,8 @@ This is code: \texttt{\textgreater{}}, \texttt{\$}, \texttt{\textbackslash{}}, Superscripts: a\textsuperscript{bc}d a\textsuperscript{\emph{hello}} a\textsuperscript{hello~there}. -Subscripts: H\textsubscr{2}O, H\textsubscr{23}O, H\textsubscr{many~of~them}O. +Subscripts: H\textsubscript{2}O, H\textsubscript{23}O, +H\textsubscript{many~of~them}O. These should not be superscripts or subscripts, because of the unescaped spaces: a\^{}b c\^{}d, a\textasciitilde{}b c\textasciitilde{}d. |