packages feed

texmath 0.12.0.1 → 0.12.0.2

raw patch · 4 files changed

+61/−47 lines, 4 filesdep ~pandoc-types

Dependency ranges changed: pandoc-types

Files

changelog view
@@ -1,3 +1,10 @@+texmath (0.12.0.2)++  * Allow pandoc-types 1.21.+  * Pandoc output: omit empty Emph for sub/superscript without base (#155).+  * tex writer: Use `\overline{\overline{B}}` instead of unicode+    double line accent (#153).+ texmath (0.12.0.1)    * OMML writer: Fix overline and accent rendering (#152).
src/Text/TeXMath/Writers/Pandoc.hs view
@@ -72,33 +72,34 @@ medspace  = EText TextNormal "\x2005" widespace = EText TextNormal "\x2004" -renderStr :: TextType -> T.Text -> Inline+renderStr :: TextType -> T.Text -> [Inline]+renderStr _ "" = [] renderStr tt s =   case tt of-       TextNormal       -> Str s-       TextBold         -> Strong [Str s]-       TextItalic       -> Emph   [Str s]-       TextMonospace    -> Code nullAttr s-       TextSansSerif    -> Str s-       TextDoubleStruck -> Str $ toUnicode tt s-       TextScript       -> Str $ toUnicode tt s-       TextFraktur      -> Str $ toUnicode tt s-       TextBoldItalic    -> Strong [Emph [Str s]]-       TextSansSerifBold -> Strong [Str s]-       TextBoldScript    -> Strong [Str $ toUnicode tt s]-       TextBoldFraktur   -> Strong [Str $ toUnicode tt s]-       TextSansSerifItalic -> Emph [Str s]-       TextSansSerifBoldItalic -> Strong [Emph [Str s]]+       TextNormal       -> [Str s]+       TextBold         -> [Strong [Str s]]+       TextItalic       -> [Emph   [Str s]]+       TextMonospace    -> [Code nullAttr s]+       TextSansSerif    -> [Str s]+       TextDoubleStruck -> [Str $ toUnicode tt s]+       TextScript       -> [Str $ toUnicode tt s]+       TextFraktur      -> [Str $ toUnicode tt s]+       TextBoldItalic    -> [Strong [Emph [Str s]]]+       TextSansSerifBold -> [Strong [Str s]]+       TextBoldScript    -> [Strong [Str $ toUnicode tt s]]+       TextBoldFraktur   -> [Strong [Str $ toUnicode tt s]]+       TextSansSerifItalic -> [Emph [Str s]]+       TextSansSerifBoldItalic -> [Strong [Emph [Str s]]]  expToInlines :: TextType -> Exp -> Maybe [Inline]-expToInlines tt (ENumber s) = Just [renderStr tt s]-expToInlines TextNormal (EIdentifier s) = Just [renderStr TextItalic s]-expToInlines tt (EIdentifier s) = Just [renderStr tt s]-expToInlines tt (EMathOperator s) = Just [renderStr tt s]-expToInlines tt (ESymbol _ s) = Just [renderStr tt s]+expToInlines tt (ENumber s) = Just $ renderStr tt s+expToInlines TextNormal (EIdentifier s) = Just $ renderStr TextItalic s+expToInlines tt (EIdentifier s) = Just $ renderStr tt s+expToInlines tt (EMathOperator s) = Just $ renderStr tt s+expToInlines tt (ESymbol _ s) = Just $ renderStr tt s expToInlines tt (EDelimited start end xs) = do-  xs' <- mapM (either (return . (:[]) . renderStr tt) (expToInlines tt)) xs-  return $ [renderStr tt start] ++ concat xs' ++ [renderStr tt end]+  xs' <- mapM (either (return . renderStr tt) (expToInlines tt)) xs+  return $ renderStr tt start ++ concat xs' ++ renderStr tt end expToInlines tt (EGrouped xs)    = expsToInlines tt xs expToInlines _ (EStyled tt' xs)  = expsToInlines tt' xs expToInlines _ (ESpace n)        = Just [Str $ getSpaceChars n]@@ -118,30 +119,30 @@   y' <- expToInlines tt y   z' <- expToInlines tt z   return $ x' ++ [Subscript y'] ++ [Superscript z']-expToInlines _ (EText tt' x) = Just [renderStr tt' x]+expToInlines _ (EText tt' x) = Just $ renderStr tt' x expToInlines tt (EOver b (EGrouped [EIdentifier (T.unpack -> [c])]) (ESymbol Accent (T.unpack -> [accent]))) = expToInlines tt (EOver b (EIdentifier $ T.singleton c) (ESymbol Accent $ T.singleton accent)) expToInlines tt (EOver _ (EIdentifier (T.unpack -> [c])) (ESymbol Accent (T.unpack -> [accent]))) =     case accent of-         '\x203E' -> Just [renderStr tt' $ T.pack [c,'\x0304']]  -- bar-         '\x0304' -> Just [renderStr tt' $ T.pack [c,'\x0304']]  -- bar combining-         '\x00B4' -> Just [renderStr tt' $ T.pack [c,'\x0301']]  -- acute-         '\x0301' -> Just [renderStr tt' $ T.pack [c,'\x0301']]  -- acute combining-         '\x0060' -> Just [renderStr tt' $ T.pack [c,'\x0300']]  -- grave-         '\x0300' -> Just [renderStr tt' $ T.pack [c,'\x0300']]  -- grave combining-         '\x02D8' -> Just [renderStr tt' $ T.pack [c,'\x0306']]  -- breve-         '\x0306' -> Just [renderStr tt' $ T.pack [c,'\x0306']]  -- breve combining-         '\x02C7' -> Just [renderStr tt' $ T.pack [c,'\x030C']]  -- check-         '\x030C' -> Just [renderStr tt' $ T.pack [c,'\x030C']]  -- check combining-         '.'      -> Just [renderStr tt' $ T.pack [c,'\x0307']]  -- dot-         '\x0307' -> Just [renderStr tt' $ T.pack [c,'\x0307']]  -- dot combining-         '\x00B0' -> Just [renderStr tt' $ T.pack [c,'\x030A']]  -- ring-         '\x030A' -> Just [renderStr tt' $ T.pack [c,'\x030A']]  -- ring combining-         '\x20D7' -> Just [renderStr tt' $ T.pack [c,'\x20D7']]  -- arrow right-         '\x20D6' -> Just [renderStr tt' $ T.pack [c,'\x20D6']]  -- arrow left-         '\x005E' -> Just [renderStr tt' $ T.pack [c,'\x0302']]  -- hat-         '\x0302' -> Just [renderStr tt' $ T.pack [c,'\x0302']]  -- hat combining-         '~'      -> Just [renderStr tt' $ T.pack [c,'\x0303']]  -- tilde-         '\x0303' -> Just [renderStr tt' $ T.pack [c,'\x0303']]  -- tilde combining+         '\x203E' -> Just $ renderStr tt' $ T.pack [c,'\x0304']  -- bar+         '\x0304' -> Just $ renderStr tt' $ T.pack [c,'\x0304']  -- bar combining+         '\x00B4' -> Just $ renderStr tt' $ T.pack [c,'\x0301']  -- acute+         '\x0301' -> Just $ renderStr tt' $ T.pack [c,'\x0301']  -- acute combining+         '\x0060' -> Just $ renderStr tt' $ T.pack [c,'\x0300']  -- grave+         '\x0300' -> Just $ renderStr tt' $ T.pack [c,'\x0300']  -- grave combining+         '\x02D8' -> Just $ renderStr tt' $ T.pack [c,'\x0306']  -- breve+         '\x0306' -> Just $ renderStr tt' $ T.pack [c,'\x0306']  -- breve combining+         '\x02C7' -> Just $ renderStr tt' $ T.pack [c,'\x030C']  -- check+         '\x030C' -> Just $ renderStr tt' $ T.pack [c,'\x030C']  -- check combining+         '.'      -> Just $ renderStr tt' $ T.pack [c,'\x0307']  -- dot+         '\x0307' -> Just $ renderStr tt' $ T.pack [c,'\x0307']  -- dot combining+         '\x00B0' -> Just $ renderStr tt' $ T.pack [c,'\x030A']  -- ring+         '\x030A' -> Just $ renderStr tt' $ T.pack [c,'\x030A']  -- ring combining+         '\x20D7' -> Just $ renderStr tt' $ T.pack [c,'\x20D7']  -- arrow right+         '\x20D6' -> Just $ renderStr tt' $ T.pack [c,'\x20D6']  -- arrow left+         '\x005E' -> Just $ renderStr tt' $ T.pack [c,'\x0302']  -- hat+         '\x0302' -> Just $ renderStr tt' $ T.pack [c,'\x0302']  -- hat combining+         '~'      -> Just $ renderStr tt' $ T.pack [c,'\x0303']  -- tilde+         '\x0303' -> Just $ renderStr tt' $ T.pack [c,'\x0303']  -- tilde combining          _        -> Nothing       where tt' = if tt == TextNormal then TextItalic else tt expToInlines tt (EScaled _ e) = expToInlines tt e
src/Text/TeXMath/Writers/TeX.hs view
@@ -315,6 +315,12 @@             unless convertible $ tell [ControlSeq "\\limits"]             tell [Token $ case pos of { Over -> '^'; Under -> '_' }]             tellGroup (checkSubstack e1)+         | case pos of {Over -> True; _ -> False}+         , e1 == ESymbol Accent "\831" -> do -- double bar+            tell [ControlSeq "\\overline", Literal "{",+                  ControlSeq "\\overline"]+            tellGroup (writeExp b)+            tell [Literal "}"]          | otherwise -> do              case pos of                   Over   -> tell [ControlSeq "\\overset"]
texmath.cabal view
@@ -1,5 +1,5 @@ Name:                texmath-Version:             0.12.0.1+Version:             0.12.0.2 Cabal-Version:       >= 1.10 Build-type:          Simple Synopsis:            Conversion between formats used to represent mathematics.@@ -87,8 +87,8 @@  Library     Build-depends:       base >= 4.8 && < 5, syb >= 0.4.2 && < 0.8, xml, parsec >= 3, containers,-                         pandoc-types >= 1.20 && < 1.21, mtl, text-    +                         pandoc-types >= 1.20 && < 1.22, mtl, text+     Exposed-modules:     Text.TeXMath,                          Text.TeXMath.Types,                          Text.TeXMath.TeX,@@ -130,7 +130,7 @@     if flag(executable)       Buildable:         True       Build-Depends:     base >= 4.8 && < 5, texmath, xml,-                         pandoc-types >= 1.20 && < 1.21,+                         pandoc-types >= 1.20 && < 1.22,                          aeson, bytestring, text     else       Buildable:         False