diff --git a/HaTeX.cabal b/HaTeX.cabal
new file mode 100644
--- /dev/null
+++ b/HaTeX.cabal
@@ -0,0 +1,33 @@
+﻿Name:           HaTeX
+Version:        1.0.0
+Author:         Daniel Díaz
+License:        BSD3
+License-file:   license
+Maintainer:     lazy.ddiaz@gmail.com
+Category:       Text
+Synopsis:       Library for generate LaTeX code.
+Description:    
+         You can write LaTeX files using this package.
+         See Text.LaTeX for a brief introduction.
+         .
+         It's a first version,
+         and documentation is in process,
+         but you can test the library and report me any bug or suggestion at:
+         .
+         lazy.ddiaz\@gmail.com
+         .
+         Also, if you have an example where you use HaTeX, you could send it to my email. Thank you.
+Extensions:     OverloadedStrings , FlexibleInstances , TypeSynonymInstances
+Build-type:     Simple
+Build-depends:  base >= 4 && < 5 , mtl , dstring , to-string-class , filepath
+Cabal-version:  >= 1.2.3
+Tested-with:    GHC == 6.12.1
+Exposed-modules: Text.LaTeX
+               , Text.LaTeX.Macro
+               , Text.LaTeX.IO
+               , Text.LaTeX.Commands
+               , Text.LaTeX.Packages
+               , Text.LaTeX.Arguments
+               , Text.LaTeX.Define
+               , Text.LaTeX.Monad
+               , Text.LaTeX.Result
diff --git a/Setup.hs b/Setup.hs
new file mode 100644
--- /dev/null
+++ b/Setup.hs
@@ -0,0 +1,4 @@
+
+import Distribution.Simple
+
+main = defaultMain
diff --git a/Text/LaTeX.hs b/Text/LaTeX.hs
new file mode 100644
--- /dev/null
+++ b/Text/LaTeX.hs
@@ -0,0 +1,173 @@
+
+module Text.LaTeX 
+     ( -- * How to use HaTeX
+       -- ** Introduction
+       -- $guide1
+
+       -- ** LaTeX file structure
+       -- $guide2
+
+       -- ** A simple example
+       -- $guide3
+
+       -- ** Enriching your text
+       -- $guide4
+
+       -- ** Performing IO actions
+       -- $guide5
+
+       -- * HaTeX related functions
+       hatex
+     , hatexVersion
+       -- * Exporting to /.tex/
+     , export
+       -- * Re-exports
+     , module Text.LaTeX.Result
+     , module Text.LaTeX.Monad
+     , module Text.LaTeX.Define
+     , module Text.LaTeX.Arguments
+     , module Text.LaTeX.Packages
+     , module Text.LaTeX.Commands
+     , module Text.LaTeX.IO
+     , module Text.LaTeX.Macro
+     ) where
+
+import Text.LaTeX.Monad
+import Text.LaTeX.Commands
+import Text.LaTeX.Arguments
+import Text.LaTeX.Define
+import Text.LaTeX.Packages
+import Text.LaTeX.IO
+import Text.LaTeX.Result
+import Text.LaTeX.Macro
+--
+import System.FilePath (takeExtension)
+
+-- | HaTeX nice word.
+hatex :: LaTeX
+hatex = makebox [] [] $ do "H"
+                           raisebox (ex (-0.55)) [] [] $
+                             makebox [0.5 >> width] [] "A"
+                           tex
+
+-- | Your HaTeX version.
+hatexVersion :: LaTeX
+hatexVersion = do textbf "1" ; ".0.0"
+
+-- | Export the 'Result' of a 'LaTeX' sequence in a /.tex/ file.
+export ::
+     LaTeX    -- ^ 'LaTeX' to export.
+  -> FilePath -- ^ Path of export.
+  -> IO ()
+export x fp = do y <- nlx x
+                 let z = fromResult y
+                 if takeExtension fp == ".tex" then writeFile fp z
+                                               else writeFile (fp ++ ".tex") z
+
+-----------------------------------------------------------------------------------------------------------
+
+-- Introduction
+
+{- $guide1
+If you know how to use LaTeX, you will easily understand how to use HaTeX.
+Otherwise, you will need to read well the documentation.
+
+A first step may be to know the LaTeX file structure.
+-}
+
+-- LaTeX file structure
+
+{- $guide2
+A LaTeX file has two parts:
+
+- A header where you define general settings (document class, page style, use of extern packages, ...) of your document.
+
+- The document's content.
+-}
+
+-- A simple example
+
+{- $guide3
+We're going to write an example, the best for understanding.
+
+* Function 'documentclass' is used for determining if our document is an 'article', a 'book', a 'report', etc.
+
+* Function 'author' is used for specify document's authory.
+
+* Function 'title' for document's title.
+
+Then, with this three functions, we will define a header in the 'LaTeX' monad.
+'LaTeX' is a writer monad that concatenates the text generated by the programmer.
+Usually, the text is generated simply writing it, or by functions.
+
+> example = do documentclass [] article
+>              author "Daniel Diaz"
+>              title "Example"
+
+The first argument of 'documentclass' is used for change certain settings of the class.
+For example, you can set the document's main font size to 12pt, writing:
+
+> documentclass [pt 12] article
+
+Or set paper size to A4:
+
+> documentclass [pt 12,a4paper] article
+
+Now, I will write a content:
+
+> hello = "Hello, world!"
+
+To insert the content into the document, we have the function 'document'. Completing our first example:
+
+> example = do documentclass [] article
+>              author "Daniel Diaz"
+>              title "Example"
+>              document hello
+
+At first glance, it seems that 'author', 'title' or 'document' receive a @String@ as argument.
+Really, they require a 'LaTeX' argument. 'LaTeX' is the type that represents texts in HaTeX.
+So, I recommend to use /Overloaded Strings/
+(See <http://www.haskell.org/ghc/docs/6.12.2/html/users_guide/type-class-extensions.html#overloaded-strings>).
+-}
+
+-- Enriching your text
+
+{- $guide4
+There are numerous functions to enrich your document.
+One feature is change your font format with the functions shown here: "Text.LaTeX.Commands#Fonts".
+
+For example, in:
+
+> texttt "Hello!"
+
+'texttt' sets as monospaced font his content. Or composing:
+
+> texttt $ textbf "Hello!"
+
+'textbf' sets as bold font the monospaced font of @\"Hello!\"@.
+
+If you only want @\"ll\"@ with bold format:
+
+> texttt $ do "He"
+>             textbf "ll"
+>             "o!"
+
+Applying the function to only part of the text, we achieve modify just that part.
+-}
+
+{- $guide5
+To includes an 'IO' computation in 'LaTeX' monad, use 'iolx'.
+
+> gtime = do t <- iolx getClockTime
+>            ...
+
+Some 'IO' computations are predefined in "Text.LaTeX.IO".
+-}
+
+
+
+
+
+
+
+
diff --git a/Text/LaTeX/Arguments.hs b/Text/LaTeX/Arguments.hs
new file mode 100644
--- /dev/null
+++ b/Text/LaTeX/Arguments.hs
@@ -0,0 +1,227 @@
+
+module Text.LaTeX.Arguments (
+    -- * Renaming @LaTeX@
+    Language
+  , Encoding
+  , URL
+  , Color
+  , Name , Title , Date
+  , Word
+  , Marker, Text
+  , ItemOption
+  , PlacementSpecifier
+    -- * Classes
+  , Class
+  , article
+  , proc
+  , minimal
+  , report
+  , book
+  , slides
+    -- * Class Options
+  , ClassOption
+    -- ** Paper related
+  , letterpaper
+  , a4paper
+  , a5paper
+  , b5paper
+  , executivepaper
+  , legalpaper
+    -- ** @fleqn@,@leqno@
+  , fleqn , leqno
+    -- ** Title related
+  , titlepage
+  , notitlepage
+    -- ** Column related
+  , onecolumn
+  , twocolumn
+    -- ** Sides Related
+  , twoside , oneside
+    -- ** Landscape
+  , landscape
+    -- ** @Open@
+  , openright , openany
+    -- * Styles
+  , Style
+  , plain
+  , headings
+  , empty
+    -- * Meters
+  , Width, Lift, Extend
+  , width, height, depth
+  , totalheight
+  , mm , cm , inch
+  , pt , em , ex
+  ) where
+
+import Text.LaTeX.Monad
+import Text.LaTeX.Define
+
+import Data.List
+
+type Language = LaTeX
+
+type Encoding = LaTeX
+
+type URL = LaTeX
+
+type Color = LaTeX
+
+type Name = LaTeX
+
+type Title = LaTeX
+
+type Date = LaTeX
+
+type Word = String
+
+type Marker = LaTeX
+
+type Text = LaTeX
+
+type ItemOption = LaTeX
+
+type PlacementSpecifier = LaTeX
+
+--
+
+type ClassOption = LaTeX
+
+letterpaper :: ClassOption
+letterpaper = "letterpaper"
+
+a4paper :: ClassOption
+a4paper = "a4paper"
+
+a5paper :: ClassOption
+a5paper = "a5paper"
+
+b5paper :: ClassOption
+b5paper = "b5paper"
+
+executivepaper :: ClassOption
+executivepaper = "executivepaper"
+
+legalpaper :: ClassOption
+legalpaper = "legalpaper"
+
+--
+
+fleqn :: ClassOption
+fleqn = "fleqn"
+
+leqno :: ClassOption
+leqno = "leqno"
+
+--
+
+titlepage :: ClassOption
+titlepage = "titlepage"
+
+notitlepage :: ClassOption
+notitlepage = "notitlepage"
+
+--
+
+onecolumn :: ClassOption
+onecolumn = "onecolumn"
+
+twocolumn :: ClassOption
+twocolumn = "twocolumn"
+
+--
+
+twoside :: ClassOption
+twoside = "twoside"
+
+oneside :: ClassOption
+oneside = "oneside"
+
+--
+
+landscape :: ClassOption
+landscape = "landscape"
+
+--
+
+openright :: ClassOption
+openright = "openright"
+
+openany :: ClassOption
+openany = "openany"
+
+--
+
+type Class = LaTeX
+
+article :: Class
+article = "article"
+
+proc :: Class
+proc = "proc"
+
+minimal :: Class
+minimal = "minimal"
+
+report :: Class
+report = "report"
+
+book :: Class
+book = "book"
+
+slides :: Class
+slides = "slides"
+
+--
+
+
+type Style = LaTeX
+
+plain :: Style
+plain = "plain"
+
+headings :: Style
+headings = "headings"
+
+empty :: Style
+empty = "empty"
+
+-- Meters
+
+type Width = LaTeX
+
+type Lift = LaTeX
+
+type Extend = LaTeX
+
+width :: LaTeX
+width = comm0_ "width"
+
+height :: LaTeX
+height = comm0_ "height"
+
+depth :: LaTeX
+depth = comm0_ "depth"
+
+totalheight :: LaTeX
+totalheight = comm0_ "totalheight"
+
+mm :: Float -> LaTeX
+mm = (>>"mm") . lxany
+
+cm :: Float -> LaTeX
+cm = (>>"cm") . lxany
+
+inch :: Float -> LaTeX
+inch = (>>"in") . lxany
+
+pt :: Int -> LaTeX
+pt = (>>"pt") . lxany
+
+em :: Float -> LaTeX
+em = (>>"em") . lxany
+
+ex :: Float -> LaTeX
+ex = (>>"ex") . lxany
+
+
diff --git a/Text/LaTeX/Commands.hs b/Text/LaTeX/Commands.hs
new file mode 100644
--- /dev/null
+++ b/Text/LaTeX/Commands.hs
@@ -0,0 +1,636 @@
+
+-- | Here, principal LaTeX /commands/ and /environments/.
+module Text.LaTeX.Commands (
+    -- * Document's Properties
+    documentclass
+  , usepackage
+  , pagestyle
+  , thispagestyle
+  , author
+  , title
+    -- * Document Environment
+  , document
+    -- * Text order
+  , pfbk
+  , lnbk , lnbk_
+  , newpage
+  , linebreak , nolinebreak
+  , pagebreak , nopagebreak
+  , fussy , sloppy
+  , endsen
+  , frenchspacing
+  , par
+    -- * Importing
+  , include , includeonly
+  , input
+    -- * Hyphenation
+  , hyphenation , hyp
+    -- * Pre-made
+  , today
+  , tex , latex , latexe
+    -- * Sections
+  , section , section_ , sectiontab
+  , subsection , subsection_ , subsectiontab
+  , subsubsection , subsubsection_ , subsubsectiontab
+  , paragraph , paragraph_ , paragraphtab
+  , subparagraph , subparagraph_ , subparagraphtab
+  , part , part_ , parttab
+  , chapter , chapter_ , chaptertab
+  , appendix
+  , maketitle , tableofcontents
+  , frontmatter , mainmatter , backmatter
+    -- * Cross references
+  , label , ref , pageref
+    -- * Footnotes
+  , footnote
+    -- * Emphasized
+  , underline , emph
+    -- * Environments
+  , itemize
+  , enumerate
+  , description
+  , item
+  , flushleft
+  , flushright
+  , center
+  , quote , quotation
+  , verse
+  , abstract
+  , verbatim , verbatim_
+  , verb , verb_
+    -- * Floating Bodies
+  , figure
+  , table
+  , caption
+  , listoffigures , listoftables
+  , clearpage , cleardoublepage
+    -- * Customizing
+  , newcommand , renewcommand , providecommand
+  , newenvironment
+  , ignorespaces , ignorespacesafterend
+  , providesPackage
+    -- * Fonts
+    -- $fontslabel
+
+    -- ** Format
+  , textrm , texttt , textmd
+  , textup , textsl , textsf
+  , textbf , textit , textsc
+  , textnormal
+    -- ** Size
+  , tiny , scriptsize
+  , footnotesize , small
+  , normalsize
+  , large , large2 , large3
+  , huge , huge2
+    -- * Spacing
+  , linespread
+  , hspace , hspace_
+  , vspace , vspace_
+  , stretch
+  , skip , bigskip , smallskip
+    -- * Boxes
+  , mbox , mbox_
+  , fbox
+  , parbox
+  , minipage
+  , makebox
+  , framebox
+  , raisebox
+    -- * Tabular
+  , Tabular
+  , cjustified
+  , csep
+  , tabular
+  , (&) , (//)
+  , hline , cline
+  , multicolumn
+  , LxMatrix
+  , matrixTab
+    -- * Others
+  , protect
+  , phantom
+  ) where
+
+import Data.List
+
+import Text.LaTeX.Monad
+import Text.LaTeX.Define
+import Text.LaTeX.Arguments
+import Text.LaTeX.Packages
+import Text.LaTeX.Result
+
+-- Special Characters
+
+char :: Char -> LaTeX
+char = chReplace resCharsStr
+   where
+     chReplace [] c = lx $ toResult [c]
+     chReplace ((x,y):xs) c = if x == c then lx y else chReplace xs c
+
+string :: String -> LaTeX
+string = mapM_ char
+
+qts :: LaTeX -> LaTeX
+qts x = do "``"
+           x
+           "''"
+
+ldots :: LaTeX
+ldots = comm0 "ldots"
+
+--
+
+documentclass :: [ClassOption] -> Class -> LaTeX
+documentclass = comm4 "documentclass"
+
+usepackage :: [PackageOption] -> Package -> LaTeX
+usepackage = comm4 "usepackage"
+
+pagestyle :: Style -> LaTeX
+pagestyle = comm1 "pagestyle"
+
+-- | A local version of 'pagestyle'.
+thispagestyle :: Style -> LaTeX
+thispagestyle = comm1 "thispagestyle"
+
+author :: Name -> LaTeX
+author = comm1 "author"
+
+title :: Title -> LaTeX
+title = comm1 "title"
+
+date :: Date -> LaTeX
+date = comm1 "date"
+
+document :: LaTeX -> LaTeX
+document = env "document"
+
+-- Text Order
+
+pfbk :: LaTeX
+pfbk = "\n\n"
+
+lnbk :: LaTeX
+lnbk = comm0_ "\\"
+
+lnbk_ :: LaTeX
+lnbk_ = comm0_ "\\*"
+
+newpage :: LaTeX
+newpage = comm0 "newpage"
+
+linebreak :: Int -> LaTeX
+linebreak = comm3 "linebreak" . (:[]) . lxany
+
+nolinebreak :: Int -> LaTeX
+nolinebreak = comm3 "nolinebreak" . (:[]) . lxany
+
+pagebreak :: Int -> LaTeX
+pagebreak = comm3 "pagebreak" . (:[]) . lxany
+
+nopagebreak :: Int -> LaTeX
+nopagebreak = comm3 "nopagebreak" . (:[]) . lxany
+
+fussy :: LaTeX
+fussy = comm0 "fussy"
+
+sloppy :: LaTeX
+sloppy = comm0 "sloppy"
+
+endsen :: LaTeX
+endsen = comm0_ "@"
+
+frenchspacing :: LaTeX
+frenchspacing = comm0 "frenchspacing"
+
+-- Importing
+
+include :: FilePath -> LaTeX
+include = comm1 "include" . lx . toResult
+
+includeonly :: [FilePath] -> LaTeX
+includeonly = comm1 "includeonly" . mapM_ (lx . toResult) . intersperse ","
+
+input :: FilePath -> LaTeX
+input = comm1 "input" . lx . toResult
+
+-- Hyphenation
+
+hyphenation :: [Word] -> LaTeX
+hyphenation = comm1 "hyphenation" . lx . toResult . unwords
+
+hyp :: LaTeX
+hyp = comm0 "-"
+
+-- Ready-Made Strings
+
+today :: LaTeX
+today = comm0 "today"
+
+tex :: LaTeX
+tex = comm0 "TeX"
+
+latex :: LaTeX
+latex = comm0 "LaTeX"
+
+latexe :: LaTeX
+latexe = comm0 "LaTeXe"
+
+-- Sections (Article)
+
+section :: Title -> LaTeX
+section = comm1 "section"
+
+section_ :: Title -> LaTeX
+section_ = comm1 "section*"
+
+sectiontab :: Title -> Title -> LaTeX
+sectiontab t1 = comm4 "section" [t1]
+
+subsection :: Title -> LaTeX
+subsection = comm1 "subsection"
+
+subsection_ :: Title -> LaTeX
+subsection_ = comm1 "subsection*"
+
+subsectiontab :: Title -> Title -> LaTeX
+subsectiontab t1 = comm4 "subsection" [t1]
+
+subsubsection :: Title -> LaTeX
+subsubsection = comm1 "subsubsection"
+
+subsubsection_ :: Title -> LaTeX
+subsubsection_ = comm1 "subsubsection*"
+
+subsubsectiontab :: Title -> Title -> LaTeX
+subsubsectiontab t1 = comm4 "subsubsection" [t1]
+
+paragraph :: Title -> LaTeX
+paragraph = comm1 "paragraph"
+
+paragraph_ :: Title -> LaTeX
+paragraph_ = comm1 "paragraph*"
+
+paragraphtab :: Title -> Title -> LaTeX
+paragraphtab t1 = comm4 "paragraph" [t1]
+
+subparagraph :: Title -> LaTeX
+subparagraph = comm1 "subparagraph"
+
+subparagraph_ :: Title -> LaTeX
+subparagraph_ = comm1 "subparagraph*"
+
+subparagraphtab :: Title -> Title -> LaTeX
+subparagraphtab t1 = comm4 "subparagraph" [t1]
+
+part :: Title -> LaTeX
+part = comm1 "part"
+
+part_ :: Title -> LaTeX
+part_ = comm1 "part*"
+
+parttab :: Title -> Title -> LaTeX
+parttab t1 = comm4 "part" [t1]
+
+-- Sections (Report or Book)
+
+chapter :: Title -> LaTeX
+chapter = comm1 "chapter"
+
+chapter_ :: Title -> LaTeX
+chapter_ = comm1 "chapter*"
+
+chaptertab :: Title -> Title -> LaTeX
+chaptertab t1 = comm4 "chapter" [t1]
+
+-- Sections (Others)
+
+appendix :: LaTeX
+appendix = comm0 "appendix"
+
+maketitle :: LaTeX
+maketitle = comm0 "maketitle"
+
+tableofcontents :: LaTeX
+tableofcontents = comm0 "tableofcontents"
+
+-- For Book Class
+
+frontmatter :: LaTeX
+frontmatter = comm0 "frontmatter"
+
+mainmatter :: LaTeX
+mainmatter = comm0 "mainmatter"
+
+backmatter :: LaTeX
+backmatter = comm0 "backmatter"
+
+-- Cross References
+
+label :: Marker -> LaTeX
+label = comm1 "label"
+
+ref :: Marker -> LaTeX
+ref = comm1 "ref"
+
+pageref :: Marker -> LaTeX
+pageref = comm1 "pageref"
+
+-- Footnotes
+
+footnote :: Text -> LaTeX
+footnote = comm1 "footnote"
+
+-- Emphasized
+
+underline :: Text -> LaTeX
+underline = comm1 "underline"
+
+emph :: Text -> LaTeX
+emph = comm1 "emph"
+
+-- Environments
+
+itemize :: LaTeX -> LaTeX
+itemize = env "itemize"
+
+enumerate :: LaTeX -> LaTeX
+enumerate = env "enumerate"
+
+description :: LaTeX -> LaTeX
+description = env "description"
+
+item :: [ItemOption] -> LaTeX
+item = comm3 "item"
+
+flushleft :: LaTeX -> LaTeX
+flushleft = env "flushleft"
+
+flushright :: LaTeX -> LaTeX
+flushright = env "flushright"
+
+center :: LaTeX -> LaTeX
+center = env "center"
+
+quote :: LaTeX -> LaTeX
+quote = env "quote"
+
+quotation :: LaTeX -> LaTeX
+quotation = env "quotation"
+
+verse :: LaTeX -> LaTeX
+verse = env "verse"
+
+abstract :: LaTeX -> LaTeX
+abstract = env "abstract"
+
+verbatim :: LaTeX -> LaTeX
+verbatim = env "verbatim"
+
+verbatim_ :: LaTeX -> LaTeX
+verbatim_ = env "verbatim*"
+
+verb :: LaTeX -> LaTeX
+verb = (comm0_ "verb" >>) . reslx sep
+
+verb_ :: LaTeX -> LaTeX
+verb_ = (comm0_ "verb*" >>) . reslx sep
+
+-- Floating Bodies
+
+figure :: [PlacementSpecifier] -> LaTeX -> LaTeX
+figure = env2 "figure"
+
+table :: [PlacementSpecifier] -> LaTeX -> LaTeX
+table = env2 "table"
+
+caption :: Text -> LaTeX
+caption = comm1 "caption"
+
+listoffigures :: LaTeX
+listoffigures = comm0 "listoffigures"
+
+listoftables :: LaTeX
+listoftables = comm0 "listoftables"
+
+clearpage :: LaTeX
+clearpage = comm0 "clearpage"
+
+cleardoublepage :: LaTeX
+cleardoublepage = "cleardoblepage"
+
+-- Customizing
+
+newcommand :: Name -> [Int] -> LaTeX -> LaTeX
+newcommand n i = comm6 "newcommand" n (map lxany i)
+
+renewcommand :: Name -> [Int] -> LaTeX -> LaTeX
+renewcommand n i = comm6 "renewcommand" n (map lxany i)
+
+providecommand :: Name -> [Int] -> LaTeX -> LaTeX
+providecommand n i = comm6 "providecommand" n (map lxany i)
+
+newenvironment :: Name -> [Int] -> LaTeX -> LaTeX -> LaTeX
+newenvironment n i = comm7 "newenvironment" n (map lxany i)
+
+ignorespaces :: LaTeX
+ignorespaces = comm0 "ignorespaces"
+
+ignorespacesafterend :: LaTeX
+ignorespacesafterend = comm0 "ignorespacesafterend"
+
+providesPackage :: Name -> LaTeX
+providesPackage = comm1 "ProvidesPackage"
+
+-- Fonts
+
+-- $fontslabel
+-- #Fonts#
+
+-- | Roman font
+textrm :: LaTeX -> LaTeX
+textrm = comm1 "textrm"
+
+-- | Monospaced font
+texttt :: LaTeX -> LaTeX
+texttt = comm1 "texttt"
+
+-- | Medium font
+textmd :: LaTeX -> LaTeX
+textmd = comm1 "textmd"
+
+-- | Upright font
+textup :: LaTeX -> LaTeX
+textup = comm1 "textup"
+
+-- | Slanted font
+textsl :: LaTeX -> LaTeX
+textsl = comm1 "textsl"
+
+-- | Sans Serif font
+textsf :: LaTeX -> LaTeX
+textsf = comm1 "textsf"
+
+-- | Bold font
+textbf :: LaTeX -> LaTeX
+textbf = comm1 "textbf"
+
+-- | Italic font
+textit :: LaTeX -> LaTeX
+textit = comm1 "textit"
+
+-- | Small Caps font
+textsc :: LaTeX -> LaTeX
+textsc = comm1 "textsc"
+
+-- | Default font
+textnormal :: LaTeX -> LaTeX
+textnormal = comm1 "textnormal"
+
+-- Font Sizes
+
+tiny :: LaTeX -> LaTeX
+tiny = comm8 "tinty"
+
+scriptsize :: LaTeX -> LaTeX
+scriptsize = comm8 "scriptsize"
+
+footnotesize :: LaTeX -> LaTeX
+footnotesize = comm8 "footnotesize"
+
+small :: LaTeX -> LaTeX
+small = comm8 "small"
+
+normalsize :: LaTeX -> LaTeX
+normalsize = comm8 "normalsize"
+
+large :: LaTeX -> LaTeX
+large = comm8 "large"
+
+large2 :: LaTeX -> LaTeX
+large2 = comm8 "Large"
+
+large3 :: LaTeX -> LaTeX
+large3 = comm8 "LARGE"
+
+huge :: LaTeX -> LaTeX
+huge = comm8 "huge"
+
+huge2 :: LaTeX -> LaTeX
+huge2 = comm8 "Huge"
+
+--
+
+par :: LaTeX
+par = comm0 "par"
+
+-- Spacing
+
+linespread :: Float -> LaTeX
+linespread = comm1 "linespread" . lxany
+
+hspace :: LaTeX -> LaTeX
+hspace = comm1 "hspace"
+
+hspace_ :: LaTeX -> LaTeX
+hspace_ = comm1 "hspace*"
+
+vspace :: LaTeX -> LaTeX
+vspace = comm1 "vspace"
+
+vspace_ :: LaTeX -> LaTeX
+vspace_ = comm1 "vspace*"
+
+stretch :: Int -> LaTeX
+stretch = comm1 "stretch" . lxany
+
+skip :: Float -> LaTeX
+skip x = do lnbk
+            lx . bs . toResult $ show x
+
+bigskip :: LaTeX
+bigskip = comm0 "bigskip"
+
+smallskip :: LaTeX
+smallskip = comm0 "smallskip"
+
+-- Boxes
+
+mbox :: LaTeX -> LaTeX
+mbox = comm1 "mbox"
+
+mbox_ :: LaTeX
+mbox_ = mbox ""
+
+fbox :: LaTeX -> LaTeX
+fbox = comm1 "fbox"
+
+parbox :: [Char] -> Width -> LaTeX -> LaTeX
+parbox c = comm9 "parbox" (if null c then [] else [lx $ toResult c])
+
+minipage :: [Char] -> Width -> LaTeX -> LaTeX
+minipage c = env3 "minipage" (if null c then [] else [lx $ toResult c])
+
+makebox :: [Width] -> [Char] -> LaTeX -> LaTeX
+makebox w c = comm10 "makebox" w (if null c then [] else [lx $ toResult c])
+
+framebox :: [Width] -> [Char] -> LaTeX -> LaTeX
+framebox w c = comm10 "framebox" w (if null c then [] else [lx $ toResult c])
+
+raisebox :: Lift -> [Extend] -> [Extend] -> LaTeX -> LaTeX
+raisebox = comm11 "raisebox"
+
+-- Others
+
+protect :: LaTeX
+protect = comm0_ "protect"
+
+phantom :: LaTeX -> LaTeX
+phantom = comm1 "phantom"
+
+-- Tabular
+
+type Tabular = LaTeX
+
+cjustified :: Width -> LaTeX
+cjustified = ("p">>) . keys
+
+csep :: LaTeX -> LaTeX
+csep = ("@">>) . keys
+
+tabular :: [LaTeX] -> LaTeX -> LaTeX -> Tabular
+tabular = env3 "tabular"
+
+(&) :: LaTeX -> LaTeX -> LaTeX
+x & y = do x ; " & " ; y
+
+(//) :: LaTeX -> LaTeX -> LaTeX
+x // y = do x
+            lnbk ; "\n"
+            y
+
+hline :: LaTeX
+hline = comm0 "hline"
+
+cline :: Int -> Int -> LaTeX
+cline n m = comm1 "cline" $ lxany n - lxany m
+
+multicolumn :: Int -> LaTeX -> LaTeX -> LaTeX
+multicolumn n = comm12 "multicolumn" $ lxany n
+
+type LxMatrix = [[LaTeX]]
+
+matrixTab :: [LaTeX] -> LaTeX -> LxMatrix -> Tabular
+matrixTab p spec = tabular p spec . foldr1 (//) . map (foldr1 (&))
+-- CAUTION: Error with empty matrix!
+
+
+
+
+
+
+
+
+
+
diff --git a/Text/LaTeX/Define.hs b/Text/LaTeX/Define.hs
new file mode 100644
--- /dev/null
+++ b/Text/LaTeX/Define.hs
@@ -0,0 +1,116 @@
+
+module Text.LaTeX.Define (
+    -- * Some @LaTeX@ Utils
+    space
+  , keys
+  , listOpts
+    -- * Defining Commands
+  , comm0_
+  , comm0
+  , comm1
+  , comm2
+  , comm3
+  , comm4
+  , comm5
+  , comm6
+  , comm7
+  , comm8
+  , comm9
+  , comm10
+  , comm11
+  , comm12
+    -- * Defining Environments
+  , env
+  , env2
+  , env3
+  ) where
+
+import Control.Monad.Writer
+import Data.List (intersperse)
+
+import Text.LaTeX.Monad
+import Text.LaTeX.Result
+
+space :: LaTeX
+space = " "
+
+keys :: LaTeX -> LaTeX
+keys = reslx ks
+
+listOpts :: [LaTeX] -> LaTeX
+listOpts [] = ""
+listOpts xs = reslx bs . sequence_ . intersperse "," $ xs
+
+--
+
+comm0_ :: LaTeX -> LaTeX
+comm0_ = reslx comm
+
+comm0 :: LaTeX -> LaTeX
+comm0 n = do comm0_ n
+             "{}"
+
+comm1 :: LaTeX -> LaTeX -> LaTeX
+comm1 n x = do comm0_ n
+               keys x
+
+comm2 :: LaTeX -> LaTeX -> [LaTeX] -> LaTeX
+comm2 n x opts = do comm1 n x
+                    listOpts opts
+
+comm3 :: LaTeX -> [LaTeX] -> LaTeX
+comm3 n opts = do comm0_ n
+                  listOpts opts
+
+comm4 :: LaTeX -> [LaTeX] -> LaTeX -> LaTeX
+comm4 n opts x = do comm3 n opts
+                    keys x
+
+comm5 :: LaTeX -> LaTeX -> LaTeX -> LaTeX
+comm5 n x y = do comm1 n x
+                 keys y
+
+comm6 :: LaTeX -> LaTeX -> [LaTeX] -> LaTeX -> LaTeX
+comm6 n x opts y = do comm2 n x opts
+                      keys y
+
+comm7 :: LaTeX -> LaTeX -> [LaTeX] -> LaTeX -> LaTeX -> LaTeX
+comm7 n x opts y z = do comm6 n x opts y
+                        keys z
+
+comm8 :: LaTeX -> LaTeX -> LaTeX
+comm8 n x = keys $ do comm0 n
+                      x
+
+comm9 :: LaTeX -> [LaTeX] -> LaTeX -> LaTeX -> LaTeX
+comm9 n opts x y = do comm4 n opts x
+                      keys y
+
+comm10 :: LaTeX -> [LaTeX] -> [LaTeX] -> LaTeX -> LaTeX
+comm10 n opts1 opts2 x = do comm3 n opts1
+                            listOpts opts2
+                            keys x
+
+comm11 :: LaTeX -> LaTeX -> [LaTeX] -> [LaTeX] -> LaTeX -> LaTeX
+comm11 n x opts1 opts2 y = do comm2 n x opts1
+                              listOpts opts2
+                              keys y
+
+comm12 :: LaTeX -> LaTeX -> LaTeX -> LaTeX -> LaTeX
+comm12 n x y z = do comm5 n x y
+                    keys z
+
+env :: LaTeX -> LaTeX -> LaTeX 
+env t x = do comm1 "begin" t
+             x
+             comm1 "end" t
+
+env2 :: LaTeX -> [LaTeX] -> LaTeX -> LaTeX
+env2 t opts x = do comm2 "begin" t opts
+                   x
+                   comm1 "end" t
+
+env3 :: LaTeX -> [LaTeX] -> LaTeX -> LaTeX -> LaTeX
+env3 t opts x y = do comm6 "begin" t opts x
+                     y
+                     comm1 "end" t
diff --git a/Text/LaTeX/IO.hs b/Text/LaTeX/IO.hs
new file mode 100644
--- /dev/null
+++ b/Text/LaTeX/IO.hs
@@ -0,0 +1,47 @@
+
+-- | Some 'IO' computations on 'LaTeX' monad.
+module Text.LaTeX.IO where
+
+import System.IO
+
+import Text.LaTeX.Monad
+import Text.LaTeX.Result
+
+readFileLx :: FilePath -> LaTeXM LaTeX
+readFileLx = (>>= return . lx . toResult) . iolx . readFile
+
+writeFileLx :: FilePath -> LaTeXM a -> LaTeX
+writeFileLx fp l = iolx $ do x <- nlx l
+                             writeFile fp $ fromResult x
+
+appendFileLx :: FilePath -> LaTeXM a -> LaTeX
+appendFileLx fp l = iolx $ do x <- nlx l
+                              appendFile fp $ fromResult x
+
+hGetLineLx :: Handle -> LaTeXM LaTeX
+hGetLineLx = (>>= return . lx . toResult) . iolx . hGetLine
+
+hGetContentsLx :: Handle -> LaTeXM LaTeX
+hGetContentsLx = (>>= return . lx . toResult) . iolx . hGetContents
+
+hPutStrLx :: Handle -> LaTeXM a -> LaTeX
+hPutStrLx h l = iolx $ do x <- nlx l
+                          hPutStr h $ fromResult x
+
+hPutStrLnLx :: Handle -> LaTeXM a -> LaTeX
+hPutStrLnLx h l = iolx $ do x <- nlx l
+                            hPutStrLn h $ fromResult x
+
+putStrLx :: LaTeXM a -> LaTeX
+putStrLx x = iolx $ nlx x >>= putStr . fromResult
+
+putStrLnLx :: LaTeXM a -> LaTeX
+putStrLnLx x = iolx $ nlx x >>= putStrLn . fromResult
+
+getLineLx :: LaTeXM LaTeX
+getLineLx = (>>= return . lx . toResult) $ iolx $ getLine
+
+getContentsLx :: LaTeXM LaTeX
+getContentsLx = (>>= return . lx . toResult) $ iolx $ getContents
+
+
diff --git a/Text/LaTeX/Macro.hs b/Text/LaTeX/Macro.hs
new file mode 100644
--- /dev/null
+++ b/Text/LaTeX/Macro.hs
@@ -0,0 +1,70 @@
+
+-- | This module defines some macros to speed up writing documents.
+module Text.LaTeX.Macro (
+       -- * Simple macros
+       m_simple
+     , m_wpkgs
+       -- * Article macros
+     , m_article
+       ) where
+
+import Text.LaTeX.Monad
+import Text.LaTeX.Commands
+import Text.LaTeX.Packages
+import Text.LaTeX.Arguments
+
+-- Simple macros
+
+m_simple :: [ClassOption] -- ^ Class options
+         ->  Class        -- ^ Class
+         ->  Name         -- ^ Author's name
+         ->  Title        -- ^ Document's title
+         ->  LaTeX        -- ^ Document's content
+         ->  LaTeX        -- ^ Output
+m_simple copts c a t cnt =
+   do documentclass copts c
+      author a
+      title t
+      document cnt
+
+m_wpkgs
+  :: [ClassOption]        -- ^ Class options
+     -> Class             -- ^ Class
+     -> Name              -- ^ Author's name
+     -> Title             -- ^ Document's title
+     -> [([PackageOption] 
+        ,  Package)]      -- ^ A list of imported packages
+     -> LaTeX             -- ^ Document's content
+     -> LaTeX             -- ^ Output
+m_wpkgs copts c a t pkgs cnt =
+   do documentclass copts c
+      mapM_ (uncurry usepackage) pkgs
+      author a
+      title t
+      document cnt
+
+-- Various macros
+
+-- | Function 'm_article' generate a LaTeX file with the following properties:
+--
+-- * Article class.
+--
+-- * Font Size: 11pt
+--
+-- * A title in the first page.
+--
+-- * A4 paper.
+m_article
+  :: Name      -- ^ Author's name
+     -> Title  -- ^ Article's title
+     -> LaTeX  -- ^ Article's content
+     -> LaTeX  -- ^ Output
+m_article a t cnt =
+   do documentclass [pt 11, titlepage, a4paper] article
+      author a
+      title t
+      document $ do maketitle
+                    cnt
+
+
+
diff --git a/Text/LaTeX/Monad.hs b/Text/LaTeX/Monad.hs
new file mode 100644
--- /dev/null
+++ b/Text/LaTeX/Monad.hs
@@ -0,0 +1,77 @@
+﻿
+module Text.LaTeX.Monad (
+    -- * @LaTeX@ Monad
+    LaTeXM
+  , LaTeX
+    -- * Basic functions over @LaTeX@ Monad
+  , lx
+  , lxany
+  , lxw
+  , lxanyw
+  , nlx
+  , iolx
+  , reslx
+    -- * Generalizing
+  , genlx , ungenlx
+  ) where
+
+import Control.Monad.Writer
+import Data.Monoid
+import GHC.Exts
+import System.IO.Unsafe
+import Text.LaTeX.Result
+
+----------------------------
+
+type LaTeXM a = WriterT Result IO a
+
+type LaTeX = LaTeXM ()
+
+----------------------------
+-- Running the Monad
+
+nlx :: LaTeXM a -> IO Result
+nlx = execWriterT
+
+----------------------------
+
+lx :: Result -> LaTeX
+lx = tell
+
+lxany :: Show a => a -> LaTeX
+lxany = lx . toResult . show
+
+lxw :: Result -> LaTeXM a
+lxw x = do lx x
+           return undefined
+
+lxanyw :: Show b => b -> LaTeXM a
+lxanyw = lxw . toResult . show
+
+iolx :: IO a -> LaTeXM a
+iolx = liftIO
+
+reslx :: (Result -> Result) -> (LaTeXM a -> LaTeXM a)
+reslx = censor
+
+instance IsString (LaTeXM a) where
+ fromString = lxw . toResult
+
+instance Show (LaTeXM a) where
+ show = fromResult . unsafePerformIO . nlx
+
+instance Eq (LaTeXM a) where
+ x == y = show x == show y
+
+--
+
+genlx :: LaTeX -> LaTeXM a
+genlx = (>> return undefined)
+
+ungenlx :: LaTeXM a -> LaTeX
+ungenlx = (>> return ())
+
+
+
+
+
diff --git a/Text/LaTeX/Packages.hs b/Text/LaTeX/Packages.hs
new file mode 100644
--- /dev/null
+++ b/Text/LaTeX/Packages.hs
@@ -0,0 +1,502 @@
+
+module Text.LaTeX.Packages
+    ( -- * Packages
+      Package
+    , PackageOption
+      -- * List of packages
+      -- ** @doc@
+    , doc
+      -- ** @exscale@
+    , exscale
+      -- ** @ifthen@
+    , ifthen
+      -- ** @latexsym@
+    , latexsym
+      -- ** @makeidx@
+    , makeidx
+      -- ** @fontenc@
+    , fontenc
+    , oT1 , t1
+    , t2A, t2B
+    , t2C, x2
+    , lgr
+      -- ** @syntonly@
+    , syntonly
+    , syntaxonly
+      -- ** @inputenc@
+    , inputenc
+    , applemac
+    , macukr
+    , latin1
+    , koi8_ru
+    , ansinew
+    , cp1251
+    , cp850
+    , cp866nav
+      -- ** @ucs@
+    , ucs
+    , utf8x
+      -- ** @textcomp@
+    , textcomp
+    , textdegree
+    , textcelsius
+    , texteuro
+      -- ** @eurosym@
+    , eurosym
+    , euro
+      -- ** @babel@
+    , babel
+    , selectlanguage
+      -- ** @hyperref@
+    , hyperref
+    , pdftex
+    , href
+      -- ** @color@
+    , colorpkg
+    , monochrome
+    , dvipsnames
+    , nodvipsnames
+    , usenames
+    , rgb
+    , pagecolor
+    , color
+    , normalcolor
+      -- * AMS-LaTeX
+    , MathTerm
+      -- ** @amsmath@
+    , amsmath
+    , math
+    , equation
+    , equation_
+    , smash
+    , lim , (->>)
+    , sums , sums_ , summ
+    , sqroot
+    , cdot , cdots , vdots , ddots
+    , overline
+    , overbrace, underbrace
+      -- *** Operators
+    , (==:) , (/=:)
+    , (<=:) , (>=:)
+    , (===)
+    , (~~) , (~=)
+    , (<@) , (>@) , (<=@) , (>=@)
+    , (-|) , (|-) , (-/)
+    , (/@)
+    , (|.|)
+    , (+-) , (-+)
+    , (<*>)
+    , (*:) , (^:) , (!:)
+      -- *** Math Mode Accents
+    , hat , widehat
+    , tilde , widetilde
+    , grave , bar
+    , acute , mathring
+    , check , dot
+    , vec , breve
+    , ddot
+      -- *** Greek Alphabet
+    , alpha
+    , beta
+    , gamma , gamma_
+    , delta , delta_
+    , epsilon , varepsilon
+    , zeta
+    , eta
+    , theta , vartheta , theta_
+    , iota
+    , kappa
+    , lambda , lambda_
+    , mu
+    , nu
+    , xi , xi_
+    , varpi , pi_
+    , rho , varrho
+    , sigma , varsigma , sigma_
+    , tau
+    , upsilon, upsilon_
+    , phi , varphi, phi_
+    , chi
+    , psi, psi_
+    , omega, omega_
+    -- *** Mathematical Functions
+    -- *** Symbols
+    , dagger , ddagger
+    , forall
+    -- *** Others
+    , binom
+    , proof
+    ) where
+
+import Data.List (intersperse)
+import Data.Monoid
+
+import Text.LaTeX.Monad
+import Text.LaTeX.Define
+import Text.LaTeX.Arguments
+import Text.LaTeX.Result
+
+type Package = LaTeX
+
+type PackageOption = LaTeX
+
+doc :: Package
+doc = "doc"
+
+exscale :: Package
+exscale = "exscale"
+
+ifthen :: Package
+ifthen = "ifthen"
+
+latexsym :: Package
+latexsym = "latexsym"
+
+makeidx :: Package
+makeidx = "makeidx"
+
+fontenc :: Package
+fontenc = "fontenc"
+
+oT1 :: Encoding
+oT1 = "0T1"
+
+t1 :: Encoding
+t1 = "T1"
+
+t2A :: Encoding
+t2A = "T2A"
+
+t2B :: Encoding
+t2B = "T2B"
+
+t2C :: Encoding
+t2C = "T2C"
+
+x2 :: Encoding
+x2 = "X2"
+
+lgr :: Encoding
+lgr = "LGR"
+
+syntonly :: Package
+syntonly = "syntonly"
+
+syntaxonly :: LaTeX
+syntaxonly = comm0 "syntaxonly"
+
+inputenc :: Package
+inputenc = "inputenc"
+
+applemac :: Encoding
+applemac = "applemac"
+
+macukr :: Encoding
+macukr = "macukr"
+
+latin1 :: Encoding
+latin1 = "latin1"
+
+koi8_ru :: Encoding
+koi8_ru = "koi8-ru"
+
+ansinew :: Encoding
+ansinew = "ansinew"
+
+cp1251 :: Encoding
+cp1251 = "cp1251"
+
+cp850 :: Encoding
+cp850 = "cp850"
+
+cp866nav :: Encoding
+cp866nav = "cp866nav"
+
+ucs :: Package
+ucs = "ucs"
+
+utf8x :: Encoding
+utf8x = "utf8x"
+
+textcomp :: Package
+textcomp = "textcomp"
+
+textdegree :: LaTeX
+textdegree = comm0 "textdegree"
+
+textcelsius :: LaTeX
+textcelsius = comm0 "textcelsius"
+
+texteuro :: LaTeX
+texteuro = comm0 "texteuro"
+
+eurosym :: Package
+eurosym = "eurosym"
+
+euro :: LaTeX
+euro = comm0 "euro"
+
+babel :: Package
+babel = "babel"
+
+selectlanguage :: Language -> LaTeX
+selectlanguage = comm1 "selectlanguage"
+
+hyperref :: Package
+hyperref = "hyperref"
+
+pdftex :: PackageOption
+pdftex = "pdftex"
+
+href :: URL -> Text -> LaTeX
+href = comm5 "href"
+
+colorpkg :: Package
+colorpkg = "color"
+
+monochrome :: PackageOption
+monochrome = "monochrome"
+
+dvipsnames :: PackageOption
+dvipsnames = "dvipsnames"
+
+nodvipsnames :: PackageOption
+nodvipsnames = "nodvipsnames"
+
+usenames :: PackageOption
+usenames = "usenames"
+
+rgb :: Float -> Float -> Float -> Color
+rgb r g b = do "[rgb]"
+               lx . ks . mconcat . intersperse (toResult ",") $ map (toResult . show) [r,g,b]
+
+pagecolor :: Color -> LaTeX
+pagecolor = (comm0_ "pagecolor" >>)
+
+color :: Color -> LaTeX
+color = (comm0_ "color" >>)
+
+normalcolor :: LaTeX
+normalcolor = comm0 "normalcolor"
+
+----------------------------------
+---------- AMS-LaTeX -------------
+
+-- LaTeXM numeric instances.
+
+inOp :: LaTeXM a -> (LaTeXM a -> LaTeXM a -> LaTeXM a)
+inOp op x y = do x ; op ; y
+
+inOp_ :: LaTeXM a -> (MathTerm -> MathTerm -> MathTerm)
+inOp_ op x y = do x ; op ; y
+
+inOpCom = inOp_ . comm0
+
+genOp :: (LaTeX -> LaTeX -> LaTeX) -> (LaTeXM a -> LaTeXM a -> LaTeXM a)
+genOp op x y = genlx $ op (ungenlx x) (ungenlx y)
+
+(==:) = inOp_ "="
+(/=:) = inOpCom "neq"
+(<=:) = inOpCom "leq"
+(>=:) = inOpCom "geq"
+(===) = inOpCom "equiv"
+(~~)  = inOpCom "sim"
+(~=)  = inOpCom "simeq"
+
+(<@)  = inOpCom "subset"
+(>@)  = inOpCom "supset"
+(<=@) = inOpCom "subseteq"
+(>=@) = inOpCom "supseteq"
+(-|)  = inOpCom "in"
+(|-)  = inOpCom "ni"
+(-/)  = inOpCom "notin"
+(/@)  = inOpCom "setminus"
+
+(|.|) = inOpCom "parallel"
+
+(+-)  = inOpCom "pm"
+(-+)  = inOpCom "mp"
+
+(<*>) = inOpCom "star"
+
+instance Num (LaTeXM a) where
+ (+) = inOp "+"
+ (-) = inOp "-"
+ (*) = (>>)
+ negate = (comm0 "not" >>)
+ fromInteger = lxanyw
+
+(*:) :: MathTerm -> MathTerm -> MathTerm
+(*:) = inOp cdot
+
+instance Fractional (LaTeXM a) where
+ (/) = genOp $ comm5 "frac"
+ fromRational = lxanyw . (fromRational :: Rational -> Float)
+
+instance Floating (LaTeXM a) where
+ pi = genlx $ comm0 "pi"
+ exp = (comm0 "exp" >>)
+ log = (comm0 "log" >>)
+ sqrt = genlx . sqroot [] . ungenlx
+ (**) = genOp (^:)
+ sin = (comm0 "sin" >>)
+ cos = (comm0 "cos" >>)
+ tan = (comm0 "tan" >>)
+ asin = (comm0 "arcsin" >>)
+ acos = (comm0 "arccos" >>)
+ atan = (comm0 "arctan" >>)
+ sinh = (comm0 "sinh" >>)
+ cosh = (comm0 "cosh" >>)
+ tanh = (comm0 "tanh" >>)
+
+-- AMS-Math
+
+type MathTerm = LaTeX
+
+amsmath :: Package
+amsmath = "amsmath"
+
+math :: MathTerm -> LaTeX
+math = reslx ds
+
+equation :: MathTerm -> LaTeX
+equation = env "equation"
+
+equation_ :: MathTerm -> LaTeX
+equation_ = env "equation*"
+
+smash :: LaTeX -> LaTeX
+smash = comm1 "smash"
+
+text :: LaTeX -> LaTeX
+text = comm1 "text"
+
+(^:) :: MathTerm -> MathTerm -> MathTerm
+x ^: y = do x ; "^" ; keys y
+
+(!:) :: MathTerm -> MathTerm -> MathTerm
+x !: y = do x ; "_" ; keys y
+
+lim :: MathTerm
+lim = comm0 "lim"
+
+(->>) :: MathTerm -> MathTerm -> MathTerm
+x ->> y = do x ; comm0 "to" ; y
+
+sums :: MathTerm
+sums = comm0 "sum"
+
+sums_ :: MathTerm
+sums_ = comm0_ "sum"
+
+summ :: MathTerm -> MathTerm -> MathTerm
+summ x y = sums_ !: x ^: y
+
+sqroot :: [MathTerm] -> MathTerm -> MathTerm
+sqroot = comm4 "sqrt"
+
+cdot :: MathTerm
+cdot = comm0 "cdot"
+
+cdots :: MathTerm
+cdots = comm0 "cdots"
+
+vdots :: MathTerm
+vdots = comm0 "vdots"
+
+ddots :: MathTerm
+ddots = comm0 "ddots"
+
+overline :: MathTerm -> MathTerm
+overline = comm1 "overline"
+
+overbrace :: MathTerm -> MathTerm
+overbrace = comm1 "overbrace"
+
+underbrace :: MathTerm -> MathTerm
+underbrace = comm1 "underbrace"
+
+-- Math Mode Accents
+
+hat       = comm1 "hat"
+grave     = comm1 "grave"
+bar       = comm1 "bar"
+acute     = comm1 "acute"
+mathring  = comm1 "mathring"
+check     = comm1 "check"
+dot       = comm1 "dot"
+vec       = comm1 "vec"
+breve     = comm1 "breve"
+tilde     = comm1 "tilde"
+ddot      = comm1 "ddot"
+widehat   = comm1 "widehat"
+widetilde = comm1 "widetilde"
+
+-- Greek Alphabet
+
+alpha = comm0 "alpha"
+beta = comm0 "beta"
+gamma = comm0 "gamma"
+gamma_ = comm0 "Gamma"
+delta = comm0 "delta"
+delta_ = comm0 "Delta"
+epsilon = comm0 "epsilon"
+varepsilon = comm0 "varepsilon"
+zeta = comm0 "zeta"
+eta = comm0 "eta"
+theta = comm0 "theta"
+vartheta = comm0 "vartheta"
+theta_ = comm0 "Theta"
+iota = comm0 "iota"
+kappa = comm0 "kappa"
+lambda = comm0 "lambda"
+lambda_ = comm0 "Lambda"
+mu = comm0 "mu"
+nu = comm0 "nu"
+xi = comm0 "xi"
+xi_ = comm0 "Xi"
+pi = comm0 "pi"
+varpi = comm0 "varpi"
+pi_ = comm0 "Pi"
+rho = comm0 "rho"
+varrho = comm0 "varrho"
+sigma = comm0 "sigma"
+varsigma = comm0 "varsigma"
+sigma_ = comm0 "Sigma"
+tau = comm0 "tau"
+upsilon = comm0 "upsilon"
+upsilon_ = comm0 "Upsilon"
+phi = comm0 "phi"
+varphi = comm0 "varphi"
+phi_ = comm0 "Phi"
+chi = comm0 "chi"
+psi = comm0 "psi"
+psi_ = comm0 "Psi"
+omega = comm0 "omega"
+omega_ = comm0 "Omega"
+
+-- Some mathematical functions
+
+-- Symbols
+
+dagger :: LaTeX
+dagger = comm0 "dag"
+
+ddagger :: LaTeX
+ddagger = comm0 "ddag"
+
+forall :: LaTeX
+forall = comm0 "forall"
+
+-- Others
+
+binom :: MathTerm -> MathTerm -> MathTerm
+binom = comm5 "binom"
+
+proof :: LaTeX -> LaTeX
+proof = env "proof"
+
+
+
+
+
diff --git a/Text/LaTeX/Result.hs b/Text/LaTeX/Result.hs
new file mode 100644
--- /dev/null
+++ b/Text/LaTeX/Result.hs
@@ -0,0 +1,84 @@
+
+module Text.LaTeX.Result (
+     -- * Result Type
+     Result
+   , toResult
+   , fromResult
+     -- * Special Characters
+   , resCharsStr
+     -- * Manipulating Results
+   , pfinal 
+   , bfinal
+   , comm
+   , ks
+   , bs
+   , sep
+   , ds
+   ) where
+import Data.Monoid
+
+import Data.DString (DString)
+import Data.String.ToString (toString)
+import GHC.Exts (fromString)
+
+-- Result Type (MUST be a Monoid) --
+
+type Result = DString
+
+toResult :: String -> Result
+toResult = fromString
+
+fromResult :: Result -> String
+fromResult = toString
+
+------------------------------------
+
+inStart :: Result -> (Result -> Result)
+inStart = mappend
+
+inEnd :: Result -> (Result -> Result)
+inEnd = flip mappend
+
+inBoth :: Result -> Result -> (Result -> Result)
+inBoth r0 r1 x = mconcat [r0,x,r1]
+
+--
+
+pfinal :: Result -> Result
+pfinal = inEnd $ toResult "\n\n"
+
+bfinal :: Result -> Result
+bfinal = inEnd $ toResult "{}"
+
+comm :: Result -> Result
+comm = inStart $ toResult "\\"
+
+ks :: Result -> Result
+ks = inBoth (toResult "{") (toResult "}")
+
+bs :: Result -> Result
+bs = inBoth (toResult "[") (toResult "]")
+
+sep :: Result -> Result
+sep = inBoth (toResult "|") (toResult "|")
+
+ds :: Result -> Result
+ds = inBoth (toResult "$") (toResult "$")
+
+resCharsStr_ :: [(Char,String)]
+resCharsStr_ = 
+              [ ('#',"\\#") 
+              , ('$',"\\$")
+              , ('%',"\\%")
+              , ('^',"\\^{}")
+              , ('&',"\\&")
+              , ('_',"\\_")
+              , ('{',"\\{")
+              , ('}',"\\}")
+              , ('~',"\\~{}")
+              , ('\\',"\\textbackslash") ]
+
+resCharsStr :: [(Char,Result)]
+resCharsStr = map (\(x,y) -> (x,toResult y)) resCharsStr_
+
+
diff --git a/license b/license
new file mode 100644
--- /dev/null
+++ b/license
