Skip to content
Browse files

Added beamer usage example.

  • Loading branch information...
1 parent 6f39fb3 commit 9f914aefcb3a7e0b4312c0b9688cc014738e35bb @Daniel-Diaz committed Nov 30, 2012
Showing with 44 additions and 1 deletion.
  1. +38 −0 Examples/beamer.hs
  2. +1 −0 HaTeX.cabal
  3. +5 −1 Text/LaTeX/Packages/Beamer.hs
View
38 Examples/beamer.hs
@@ -0,0 +1,38 @@
+
+{-# LANGUAGE OverloadedStrings #-}
+
+import Text.LaTeX
+import Text.LaTeX.Packages.Beamer
+import Text.LaTeX.Packages.Inputenc
+
+main :: IO ()
+main = execLaTeXT beamerExample >>= renderFile "beamer.tex"
+
+beamerExample :: Monad m => LaTeXT_ m
+beamerExample = thePreamble >> document theBody
+
+thePreamble :: Monad m => LaTeXT_ m
+thePreamble = do
+ -- To start using beamer, set the document class to be 'beamer'.
+ documentclass [] beamer
+ usepackage [utf8] inputenc
+ author "Daniel Díaz"
+ title "Beamer example using HaTeX"
+ -- Use a theme to improve the aspect of your slides.
+ usetheme CambridgeUS
+
+theBody :: Monad m => LaTeXT_ m
+theBody = do
+ -- Each slide is a call to the function 'frame' with the content of the slide.
+ frame maketitle
+ frame $ do
+ frametitle "Example with block"
+ "Here comes "
+ alert [FromSlide 2] "the block!"
+ uncover [FromSlide 5] " Ha! I was hiding here!"
+ pause
+ pause
+ block "The block" $ do
+ pause
+ "The content of the block appears after a pause."
+ uncover [FromSlide 6] $ center "And that's it!"
View
1 HaTeX.cabal
@@ -30,6 +30,7 @@ Extra-source-files:
Examples/comments.hs
Examples/simple.hs
Examples/tree.hs
+ Examples/beamer.hs
Source-repository head
type: git
View
6 Text/LaTeX/Packages/Beamer.hs
@@ -1,5 +1,6 @@
{-# LANGUAGE OverloadedStrings #-}
+-- | Beamer is a LaTeX package for the creation of slides.
module Text.LaTeX.Packages.Beamer
( -- * Beamer package
beamer
@@ -44,7 +45,7 @@ frametitle = liftL $ \l -> TeXComm "frametitle" [FixArg l]
framesubtitle :: LaTeXC l => l -> l
framesubtitle = liftL $ \l -> TeXComm "framesubtitle" [FixArg l]
--- | Highlight in red a piece text. With the 'OverlaySpec's, you can specify the slides where
+-- | Highlight in red a piece of text. With the 'OverlaySpec's, you can specify the slides where
-- the text will be highlighted.
alert :: LaTeXC l => [OverlaySpec] -> l -> l
alert os = liftL $ \l -> TeXComm "alert" [ MSymArg $ fmap (TeXRaw . render) os, FixArg l]
@@ -62,10 +63,13 @@ beameritem os = fromLaTeX $ TeXComm "item" [ MSymArg $ fmap (TeXRaw . render) os
uncover :: LaTeXC l => [OverlaySpec] -> l -> l
uncover os = liftL $ \l -> TeXComm "uncover" [ MSymArg $ fmap (TeXRaw . render) os , FixArg l ]
+-- TODO: What is the difference between 'uncover' and 'only'??
+
-- | Similar to 'uncover'.
only :: LaTeXC l => [OverlaySpec] -> l -> l
only os = liftL $ \l -> TeXComm "only" [ MSymArg $ fmap (TeXRaw . render) os , FixArg l ]
+-- | Specifications for beamer functions.
data OverlaySpec =
OneSlide Int
| FromSlide Int

0 comments on commit 9f914ae

Please sign in to comment.
Something went wrong with that request. Please try again.