mirror of
https://github.com/jgm/pandoc.git
synced 2026-09-24 00:15:44 +00:00
LaTeX writer: Use fixltx2e package to provide '\textsubscript'.
This commit is contained in:
@@ -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
|
||||
|
||||
+1
-1
Submodule templates updated: bf0b37d7ea...c819cf2149
@@ -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}
|
||||
|
||||
@@ -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}
|
||||
|
||||
+3
-2
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user