Description
Automatically inline Haskell snippets into LaTeX documents.
Description
Please see the README on GitHub at https://github.com/isovector/latex-live-snippets#readme
README.md
latex-live-snippets
Install with stack install
, and then in latex via:
% set this to where your code is
\newcommand{\srcdir}{.}
\newcommand{\snip}[2]{\immediate\write18{latex-live-snippets \srcdir/#1.hs #2}\input{.latex-live-snippets/#1.#2.tex}}
Now, given a file Test.hs
:
zoo :: Int
zoo = 5
test :: Bool -> Bool
test True = id $ True
test _ = True -- ! 1
we can call
\snip{Test}{test}
which will result in:
\begin{code}
test :: Bool -> Bool
test True = id \$ True
test \_ = True \ann{1}
\end{code}
It will also find type families, data definitions. Custom snippet areas can be defined via comments of the form -- # name
.