@@ -1725,6 +1725,7 @@ blockCommands = M.fromList
17251725 , ("signature", mempty <$ (skipopts *> authors))
17261726 , ("date", mempty <$ (skipopts *> tok >>= addMeta "date"))
17271727 , ("newtheorem", newtheorem)
1728+ , ("theoremstyle", theoremstyle)
17281729 -- KOMA-Script metadata commands
17291730 , ("extratitle", mempty <$ (skipopts *> tok >>= addMeta "extratitle"))
17301731 , ("frontispiece", mempty <$ (skipopts *> tok >>= addMeta "frontispiece"))
@@ -1857,6 +1858,19 @@ environments = M.fromList
18571858 , ("iftoggle", try $ ifToggle >> block)
18581859 ]
18591860
1861+theoremstyle :: PandocMonad m => LP m Blocks
1862+theoremstyle = do
1863+ stylename <- untokenize <$> braced
1864+ let mbstyle = case stylename of
1865+ "plain" -> Just PlainStyle
1866+ "definition" -> Just DefinitionStyle
1867+ "remark" -> Just RemarkStyle
1868+ _ -> Nothing
1869+ case mbstyle of
1870+ Nothing -> return ()
1871+ Just sty -> updateState $ \s -> s{ sLastTheoremStyle = sty }
1872+ return mempty
1873+
18601874newtheorem :: PandocMonad m => LP m Blocks
18611875newtheorem = do
18621876 number <- option True (False <$ symbol '*' <* sp)
@@ -1867,7 +1881,9 @@ newtheorem = do
18671881 showName <- untokenize <$> braced
18681882 sp
18691883 syncTo <- option Nothing $ Just . untokenize <$> bracketedToks
1884+ sty <- sLastTheoremStyle <$> getState
18701885 let spec = TheoremSpec { theoremName = showName
1886+ , theoremStyle = sty
18711887 , theoremSeries = series
18721888 , theoremSyncTo = syncTo
18731889 , theoremNumber = number
@@ -1906,14 +1922,14 @@ environment = try $ do
19061922 controlSeq "begin"
19071923 name <- untokenize <$> braced
19081924 M.findWithDefault mzero name environments <|>
1909− lookupTheoremEnvironment name <|>
1925+ theoremEnvironment name <|>
19101926 if M.member name (inlineEnvironments
19111927 :: M.Map Text (LP PandocPure Inlines))
19121928 then mzero
19131929 else try (rawEnv name) <|> rawVerbEnv name
19141930
1915−lookupTheoremEnvironment :: PandocMonad m => Text -> LP m Blocks
1916−lookupTheoremEnvironment name = do
1931+theoremEnvironment :: PandocMonad m => Text -> LP m Blocks
1932+theoremEnvironment name = do
19171933 tmap <- sTheoremMap <$> getState
19181934 case M.lookup name tmap of
19191935 Nothing -> mzero
@@ -1947,10 +1963,16 @@ lookupTheoremEnvironment name = do
19471963 Nothing -> return ()
19481964 return $ space <> B.text (renderDottedNum num)
19491965 else return mempty
1950− let title = B.strong (B.text (theoremName tspec) <> number)
1966+ let titleEmph = case theoremStyle tspec of
1967+ PlainStyle -> B.strong
1968+ DefinitionStyle -> B.strong
1969+ RemarkStyle -> B.emph
1970+ let title = titleEmph (B.text (theoremName tspec) <> number)
19511971 <> optTitle <> space
1952− return $ divWith ("", [name], []) $ addTitle title $
1953− walk italicize bs
1972+ return $ divWith ("", [name], []) $ addTitle title
1973+ $ case theoremStyle tspec of
1974+ PlainStyle -> walk italicize bs
1975+ _ -> bs
19541976
19551977italicize :: Block -> Block
19561978italicize (Para ils) = Para [Emph ils]