Skip to content
This repository has been archived by the owner on Sep 28, 2023. It is now read-only.

Commit

Permalink
Added beamer usage example.
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel-Diaz committed Dec 1, 2012
1 parent 6f39fb3 commit 9f914ae
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
38 changes: 38 additions & 0 deletions 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!"
1 change: 1 addition & 0 deletions HaTeX.cabal
Expand Up @@ -30,6 +30,7 @@ Extra-source-files:
Examples/comments.hs Examples/comments.hs
Examples/simple.hs Examples/simple.hs
Examples/tree.hs Examples/tree.hs
Examples/beamer.hs


Source-repository head Source-repository head
type: git type: git
Expand Down
6 changes: 5 additions & 1 deletion Text/LaTeX/Packages/Beamer.hs
@@ -1,5 +1,6 @@
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}


-- | Beamer is a LaTeX package for the creation of slides.
module Text.LaTeX.Packages.Beamer module Text.LaTeX.Packages.Beamer
( -- * Beamer package ( -- * Beamer package
beamer beamer
Expand Down Expand Up @@ -44,7 +45,7 @@ frametitle = liftL $ \l -> TeXComm "frametitle" [FixArg l]
framesubtitle :: LaTeXC l => l -> l framesubtitle :: LaTeXC l => l -> l
framesubtitle = liftL $ \l -> TeXComm "framesubtitle" [FixArg 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. -- the text will be highlighted.
alert :: LaTeXC l => [OverlaySpec] -> l -> l alert :: LaTeXC l => [OverlaySpec] -> l -> l
alert os = liftL $ \l -> TeXComm "alert" [ MSymArg $ fmap (TeXRaw . render) os, FixArg l] alert os = liftL $ \l -> TeXComm "alert" [ MSymArg $ fmap (TeXRaw . render) os, FixArg l]
Expand All @@ -62,10 +63,13 @@ beameritem os = fromLaTeX $ TeXComm "item" [ MSymArg $ fmap (TeXRaw . render) os
uncover :: LaTeXC l => [OverlaySpec] -> l -> l uncover :: LaTeXC l => [OverlaySpec] -> l -> l
uncover os = liftL $ \l -> TeXComm "uncover" [ MSymArg $ fmap (TeXRaw . render) os , FixArg 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'. -- | Similar to 'uncover'.
only :: LaTeXC l => [OverlaySpec] -> l -> l only :: LaTeXC l => [OverlaySpec] -> l -> l
only os = liftL $ \l -> TeXComm "only" [ MSymArg $ fmap (TeXRaw . render) os , FixArg l ] only os = liftL $ \l -> TeXComm "only" [ MSymArg $ fmap (TeXRaw . render) os , FixArg l ]


-- | Specifications for beamer functions.
data OverlaySpec = data OverlaySpec =
OneSlide Int OneSlide Int
| FromSlide Int | FromSlide Int
Expand Down

0 comments on commit 9f914ae

Please sign in to comment.