Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
35 lines (28 sloc) 798 Bytes
{-# LANGUAGE OverloadedStrings #-}
import Text.LaTeX
main :: IO ()
main = execLaTeXT example >>= renderFile "Fibs.tex"
example :: Monad m => LaTeXT_ m
example = do
documentclass [] article
document exampleBody
exampleBody :: Monad m => LaTeXT_ m
exampleBody = do
"This is an example of how "
hatex3
" works, printing a table of "
"the thirteen first elements of the "
"Fibonacci sequence."
bigskip
center $ underline $ textbf "Fibonacci table"
center $ tabular Nothing [RightColumn,VerticalLine,LeftColumn] $ do
textbf "Fibonacci number" & textbf "Value"
lnbk
hline
foldr (\n l -> do texy n & texy (fib n)
lnbk
l ) (return ()) [0 .. 12]
fibs :: [Int]
fibs = 1 : 1 : zipWith (+) fibs (tail fibs)
fib :: Int -> Int
fib = (fibs!!)
Something went wrong with that request. Please try again.