Have handleIncludes look for local .sty files from \usepackage.

This commit is contained in:
John MacFarlane
2012-02-04 13:01:00 -08:00
parent 1e772aa59c
commit 253a9e32aa
+7 -3
View File
@@ -536,7 +536,7 @@ handleIncludes :: String -> IO String
handleIncludes [] = return []
handleIncludes ('\\':xs) =
case runParser include defaultParserState "input" ('\\':xs) of
Right (f, rest) -> do ys <- catch (readFile (replaceExtension f ".tex"))
Right (f, rest) -> do ys <- catch (readFile f)
(\e -> warn
("could not open included file `" ++
f ++ "': " ++ show e) >> return "")
@@ -548,10 +548,14 @@ handleIncludes (x:xs) = (x:) `fmap` handleIncludes xs
include :: LP (FilePath, String)
include = do
controlSeq "include"
name <- controlSeq "include" <|> controlSeq "usepackage"
optional opt
f <- braced
rest <- getInput
return (f, rest)
let f' = if name == "include"
then replaceExtension f ".tex"
else replaceExtension f ".sty"
return (f', rest)
verbatimEnv :: LP (String, String)
verbatimEnv = do