Add a build system and configure it work properly with citations.

This commit is contained in:
Sergiu Ivanov 2015-05-14 14:45:22 +02:00
parent d2c0985dd3
commit 26ee474a29
3 changed files with 53 additions and 0 deletions

42
_shake/Build.hs Normal file
View file

@ -0,0 +1,42 @@
import Development.Shake
import Development.Shake.FilePath
target :: FilePath
target = "candidature"
buildDir :: FilePath
buildDir = "_build"
fullTarget :: FilePath
fullTarget = buildDir </> target <.> "pdf"
pdflatexCmd :: [String]
pdflatexCmd = ["pdflatex", "-halt-on-error", "-output-directory=" ++ buildDir, target]
-- | Filters out the files which contain '#'.
noEmacsFiles :: [FilePath] -> [FilePath]
noEmacsFiles = filter ('#' `notElem`)
main :: IO ()
main = shakeArgs shakeOptions { shakeFiles = buildDir } $ do
want [ fullTarget ]
fullTarget %> \out -> do
src <- getDirectoryFiles "" ["*.tex", "*.sty"]
need $ (out -<.> "bbl") : noEmacsFiles src
cmd pdflatexCmd
fullTarget -<.> "bbl" %> \out -> do
bibs <- getDirectoryFiles "bib" ["*.bib"]
need $ map ("bib" </>) $ noEmacsFiles bibs
exists <- doesFileExist $ fullTarget -<.> "aux"
if not exists
then cmd pdflatexCmd
else return ()
cmd ["biber", dropExtension out]
phony "clean" $ do
removeFilesAfter "_build" ["//*"]

View file

@ -1,3 +1,5 @@
\NeedsTeXFormat{LaTeX2e} \NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{candidature}[2015/05/14 Style for Sergiu Ivanov's Applications] \ProvidesPackage{candidature}[2015/05/14 Style for Sergiu Ivanov's Applications]
\typeout{Style for Sergiu Ivanov's Applications} \typeout{Style for Sergiu Ivanov's Applications}
\usepackage[backend=biber]{biblatex}

View file

@ -4,6 +4,15 @@
\usepackage[french]{babel} \usepackage[french]{babel}
\addbibresource{bib/hdr_noverlan.bib}
\addbibresource{bib/hdr_verlan.bib}
\addbibresource{bib/insdel.bib}
\addbibresource{bib/pn.bib}
\addbibresource{bib/psystems.bib}
\begin{document} \begin{document}
\cite{Korec}
Hello World Hello World
\end{document} \end{document}