diff --git a/HaTeX.cabal b/HaTeX.cabal
--- a/HaTeX.cabal
+++ b/HaTeX.cabal
@@ -1,5 +1,5 @@
 Name: HaTeX
-Version: 3.17.0.1
+Version: 3.17.0.2
 Author: Daniel Díaz
 Category: LaTeX
 Build-type: Simple
diff --git a/Text/LaTeX/Base/Writer.hs b/Text/LaTeX/Base/Writer.hs
--- a/Text/LaTeX/Base/Writer.hs
+++ b/Text/LaTeX/Base/Writer.hs
@@ -54,7 +54,7 @@
    ) where
 
 -- base
-import Control.Monad (liftM)
+import Control.Monad (liftM, liftM2)
 import Control.Arrow
 import Data.String
 #if !MIN_VERSION_base(4,8,0)
@@ -121,7 +121,7 @@
  liftListL f xs = mapM extractLaTeX_ xs >>= textell . f
 
 -- | Running a 'LaTeXT' computation returns the final 'LaTeX' value.
-runLaTeXT :: Monad m => LaTeXT m a -> m (a,LaTeX)
+runLaTeXT :: LaTeXT m a -> m (a,LaTeX)
 runLaTeXT = runWriterT . unwrapLaTeXT
 
 -- | This is the usual way to run the 'LaTeXT' monad
@@ -204,7 +204,6 @@
 
 -- Monoids
 
-instance (Monad m, a ~ ()) => Monoid (LaTeXT m a) where
- mempty = return ()
- mappend = (>>)
-
+instance (Monad m, Monoid a) => Monoid (LaTeXT m a) where
+ mempty = return mempty
+ mappend = liftM2 mappend
diff --git a/Text/LaTeX/Packages/AMSMath.hs b/Text/LaTeX/Packages/AMSMath.hs
--- a/Text/LaTeX/Packages/AMSMath.hs
+++ b/Text/LaTeX/Packages/AMSMath.hs
@@ -1017,7 +1017,11 @@
 ---------- Texy instances -----------
 
 -- | Instance defined in "Text.LaTeX.Packages.AMSMath".
+#if MIN_VERSION_base(4,9,0)
+instance Texy a => Texy (Ratio a) where
+#else
 instance (Integral a, Texy a) => Texy (Ratio a) where
+#endif
  texy x = frac (texy $ numerator x) (texy $ denominator x)
 
 -- | Instance defined in "Text.LaTeX.Packages.AMSMath".
