@@ -1725,6 +1725,7 @@ blockCommands = M.fromList
1725 , ("signature", mempty <$ (skipopts *> authors))
1725 , ("signature", mempty <$ (skipopts *> authors))
1726 , ("date", mempty <$ (skipopts *> tok >>= addMeta "date"))
1726 , ("date", mempty <$ (skipopts *> tok >>= addMeta "date"))
1727 , ("newtheorem", newtheorem)
1727 , ("newtheorem", newtheorem)
1728+ , ("theoremstyle", theoremstyle)
1728 -- KOMA-Script metadata commands
1729 -- KOMA-Script metadata commands
1729 , ("extratitle", mempty <$ (skipopts *> tok >>= addMeta "extratitle"))
1730 , ("extratitle", mempty <$ (skipopts *> tok >>= addMeta "extratitle"))
1730 , ("frontispiece", mempty <$ (skipopts *> tok >>= addMeta "frontispiece"))
1731 , ("frontispiece", mempty <$ (skipopts *> tok >>= addMeta "frontispiece"))
@@ -1857,6 +1858,19 @@ environments = M.fromList
1857 , ("iftoggle", try $ ifToggle >> block)
1858 , ("iftoggle", try $ ifToggle >> block)
1861+theoremstyle :: PandocMonad m => LP m Blocks
1863+ stylename <- untokenize <$> braced
1864+ let mbstyle = case stylename of
1865+ "plain" -> Just PlainStyle
1866+ "definition" -> Just DefinitionStyle
1867+ "remark" -> Just RemarkStyle
1870+ Nothing -> return ()
1871+ Just sty -> updateState $ \s -> s{ sLastTheoremStyle = sty }
1860newtheorem :: PandocMonad m => LP m Blocks
1874newtheorem :: PandocMonad m => LP m Blocks
1861newtheorem = do
1875newtheorem = do
1862 number <- option True (False <$ symbol '*' <* sp)
1876 number <- option True (False <$ symbol '*' <* sp)
@@ -1867,7 +1881,9 @@ newtheorem = do
1867 showName <- untokenize <$> braced
1881 showName <- untokenize <$> braced
1869 syncTo <- option Nothing $ Just . untokenize <$> bracketedToks
1883 syncTo <- option Nothing $ Just . untokenize <$> bracketedToks
1884+ sty <- sLastTheoremStyle <$> getState
1870 let spec = TheoremSpec { theoremName = showName
1885 let spec = TheoremSpec { theoremName = showName
1886+ , theoremStyle = sty
1871 , theoremSeries = series
1887 , theoremSeries = series
1872 , theoremSyncTo = syncTo
1888 , theoremSyncTo = syncTo
1873 , theoremNumber = number
1889 , theoremNumber = number
@@ -1906,14 +1922,14 @@ environment = try $ do
1906 controlSeq "begin"
1922 controlSeq "begin"
1907 name <- untokenize <$> braced
1923 name <- untokenize <$> braced
1908 M.findWithDefault mzero name environments <|>
1924 M.findWithDefault mzero name environments <|>
1909− lookupTheoremEnvironment name <|>
1925+ theoremEnvironment name <|>
1910 if M.member name (inlineEnvironments
1926 if M.member name (inlineEnvironments
1911 :: M.Map Text (LP PandocPure Inlines))
1927 :: M.Map Text (LP PandocPure Inlines))
1912 then mzero
1928 then mzero
1913 else try (rawEnv name) <|> rawVerbEnv name
1929 else try (rawEnv name) <|> rawVerbEnv name
1915−lookupTheoremEnvironment :: PandocMonad m => Text -> LP m Blocks
1931+theoremEnvironment :: PandocMonad m => Text -> LP m Blocks
1916−lookupTheoremEnvironment name = do
1932+theoremEnvironment name = do
1917 tmap <- sTheoremMap <$> getState
1933 tmap <- sTheoremMap <$> getState
1918 case M.lookup name tmap of
1934 case M.lookup name tmap of
1919 Nothing -> mzero
1935 Nothing -> mzero
@@ -1947,10 +1963,16 @@ lookupTheoremEnvironment name = do
1947 Nothing -> return ()
1963 Nothing -> return ()
1948 return $ space <> B.text (renderDottedNum num)
1964 return $ space <> B.text (renderDottedNum num)
1949 else return mempty
1965 else return mempty
1966+ let titleEmph = case theoremStyle tspec of
1967+ PlainStyle -> B.strong
1968+ DefinitionStyle -> B.strong
1969+ RemarkStyle -> B.emph
1950− let title = B.strong (B.text (theoremName tspec) <> number)
1970+ let title = titleEmph (B.text (theoremName tspec) <> number)
1951 <> optTitle <> space
1971 <> optTitle <> space
1952− return $ divWith ("", [name], []) $ addTitle title $
1972+ return $ divWith ("", [name], []) $ addTitle title
1973+ $ case theoremStyle tspec of
1953− walk italicize bs
1974+ PlainStyle -> walk italicize bs
1955italicize :: Block -> Block
1977italicize :: Block -> Block
1956italicize (Para ils) = Para [Emph ils]
1978italicize (Para ils) = Para [Emph ils]