@@ -1557,6 +1557,7 @@ newcommand = do
15571557 Tok _ (CtrlSeq mtype) _ <- controlSeq "newcommand" <|>
15581558 controlSeq "renewcommand" <|>
15591559 controlSeq "providecommand" <|>
1560+ controlSeq "DeclareMathOperator" <|>
15601561 controlSeq "DeclareRobustCommand"
15611562 withVerbatimMode $ do
15621563 Tok _ (CtrlSeq name) txt <- do
@@ -1569,7 +1570,16 @@ newcommand = do
15691570 spaces
15701571 optarg <- option Nothing $ Just <$> try bracketedToks
15711572 spaces
1572− contents <- bracedOrToken
1573+ contents' <- bracedOrToken
1574+ let contents =
1575+ case mtype of
1576+ "DeclareMathOperator" ->
1577+ Tok pos (CtrlSeq "mathop") "\\mathop"
1578+ : Tok pos (CtrlSeq "mathrm") "\\mathrm"
1579+ : Tok pos Symbol "{"
1580+ : (contents' ++
1581+ [ Tok pos Symbol "}" ])
1582+ _ -> contents'
15731583 when (mtype == "newcommand") $ do
15741584 macros <- sMacros <$> getState
15751585 case M.lookup name macros of