From 26ee474a29f9f47bdf132185ff9bfb6a4f2821c4 Mon Sep 17 00:00:00 2001 From: Sergiu Ivanov Date: Thu, 14 May 2015 14:45:22 +0200 Subject: [PATCH] Add a build system and configure it work properly with citations. --- _shake/Build.hs | 42 ++++++++++++++++++++++++++++++++++++++++++ candidature.sty | 2 ++ candidature.tex | 9 +++++++++ 3 files changed, 53 insertions(+) create mode 100644 _shake/Build.hs diff --git a/_shake/Build.hs b/_shake/Build.hs new file mode 100644 index 0000000..559ce1f --- /dev/null +++ b/_shake/Build.hs @@ -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" ["//*"] diff --git a/candidature.sty b/candidature.sty index 4f1309e..9f8cdf5 100644 --- a/candidature.sty +++ b/candidature.sty @@ -1,3 +1,5 @@ \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{candidature}[2015/05/14 Style for Sergiu Ivanov's Applications] \typeout{Style for Sergiu Ivanov's Applications} + +\usepackage[backend=biber]{biblatex} diff --git a/candidature.tex b/candidature.tex index 8a40e52..734f03d 100644 --- a/candidature.tex +++ b/candidature.tex @@ -4,6 +4,15 @@ \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} + +\cite{Korec} + Hello World \end{document}