diff --git a/AUTHORS b/AUTHORS
--- a/AUTHORS
+++ b/AUTHORS
@@ -3,3 +3,10 @@
 Stefan Wehr (adjust patch)
 Brian Smith (Cabal/Windows patch)
 
+Acknowledgements:
+Neil Mitchell (bug reports)
+Jeremy Gibbons (bug reports)
+
+If you are not listed here, but feel
+that you should be, please let me know.
+
diff --git a/Auxiliaries.lhs b/Auxiliaries.lhs
--- a/Auxiliaries.lhs
+++ b/Auxiliaries.lhs
@@ -9,6 +9,7 @@
 >
 > import Data.Char              (  isSpace  )
 > import Control.Monad          (  MonadPlus(..)  )
+> import Control.Monad.Error
 
 %endif
 
@@ -60,8 +61,8 @@
 >     | p as                    =  ([], as)
 >     | otherwise               =  a <| breaks p as'
 
-> isPrefix                      :: (Eq a) => [a] -> [a] -> Bool
-> p `isPrefix` as               =  p == take (length p) as
+> -- isPrefix                      :: (Eq a) => [a] -> [a] -> Bool
+> -- p `isPrefix` as               =  p == take (length p) as
  
 > withoutSpaces                 :: String -> String
 > withoutSpaces s               =  filter (not . isSpace) s
@@ -109,6 +110,7 @@
 
 |Either| as an exception monad.
 
+> {-
 > instance Functor (Either a) where
 >     fmap f (Left  a)          =  Left  a
 >     fmap f (Right b)          =  Right (f b)
@@ -117,6 +119,8 @@
 >     Left  a >>= k             =  Left a
 >     Right b >>= k             =  k b
 >     return                    =  Right
+> -}
+> instance (Error a, Error b) => Error (a,b) where
 >
 > fromRight                     :: Either a b -> b
 > fromRight (Left _)            =  error "fromRight"
diff --git a/Document.lhs b/Document.lhs
--- a/Document.lhs
+++ b/Document.lhs
@@ -50,6 +50,7 @@
 > sub'varid a                   =  Sub "varid" [a]
 > sub'consym a                  =  Sub "consym" [a]
 > sub'varsym a                  =  Sub "varsym" [a]
+> sub'backquoted a              =  Sub "backquoted" [a]
 > sub'numeral a                 =  Sub "numeral" [a]
 > sub'char a                    =  Sub "char" [a]
 > sub'string a                  =  Sub "string" [a]
diff --git a/Examples/ArrowComment.lhs b/Examples/ArrowComment.lhs
new file mode 100644
--- /dev/null
+++ b/Examples/ArrowComment.lhs
@@ -0,0 +1,10 @@
+\documentclass{article}
+
+%include polycode.fmt
+
+\begin{document}
+%format --> = "\longrightarrow "
+
+> --> ---- > comment
+
+\end{document}
diff --git a/Examples/Backticks.lhs b/Examples/Backticks.lhs
new file mode 100644
--- /dev/null
+++ b/Examples/Backticks.lhs
@@ -0,0 +1,14 @@
+\documentclass{article}
+
+%include polycode.fmt
+
+
+\begin{document}
+
+> a `backticked` b
+
+%subst backquoted a = "\mathbin{\let\Varid\mathbf{" a "}}"
+
+> a `backticked` b
+
+\end{document}
diff --git a/Examples/Catcode.lhs b/Examples/Catcode.lhs
new file mode 100644
--- /dev/null
+++ b/Examples/Catcode.lhs
@@ -0,0 +1,13 @@
+\documentclass{article}
+
+%include lhs2TeX.fmt
+
+\input Catcode2.tex
+
+\newcommand\foo@@bar{foobar}
+
+\begin{document}
+
+\foo@@bar
+
+\end{document}
diff --git a/Examples/Catcode2.lhs b/Examples/Catcode2.lhs
new file mode 100644
--- /dev/null
+++ b/Examples/Catcode2.lhs
@@ -0,0 +1,1 @@
+%include lhs2TeX.fmt
diff --git a/Examples/Eval.lhs b/Examples/Eval.lhs
new file mode 100644
--- /dev/null
+++ b/Examples/Eval.lhs
@@ -0,0 +1,6 @@
+%include polycode.fmt
+%options ghci
+
+\eval{1}
+
+> x = 2
diff --git a/Examples/Forall.lhs b/Examples/Forall.lhs
new file mode 100644
--- /dev/null
+++ b/Examples/Forall.lhs
@@ -0,0 +1,10 @@
+\documentclass{article}
+
+%include polycode.fmt
+%include forall.fmt
+
+\begin{document}
+
+> forall a . a -> a
+
+\end{document}
diff --git a/FileNameUtils.lhs b/FileNameUtils.lhs
--- a/FileNameUtils.lhs
+++ b/FileNameUtils.lhs
@@ -1,11 +1,10 @@
 > module FileNameUtils          ( extension
->                               , filename
->                               , basename
->                               , dirname
 >                               , expandPath
 >                               , chaseFile
 >                               , modifySearchPath
->                               , deep, absPath, relPath, env
+>                               , deep, env
+>                               , absPath
+>                               , module System.FilePath
 >                               ) where
 >
 > import Prelude hiding         (  catch )
@@ -15,86 +14,61 @@
 > import Data.List
 > import Control.Monad (filterM)
 > import Control.Exception      (  try, catch )
-
-> type FileName                 =  String
-
-> directorySeparators           =  "/"
-> directorySeparator            =  '/'
-> environmentSeparators         =  ";:"
+> import System.FilePath
+> import System.Info
 
 A searchpath can be added to the front or to the back of the current path
 by pre- or postfixing it with a path separator. Otherwise the new search
 path replaces the current one.
 
-> modifySearchPath              :: [FileName] -> String -> [FileName]
+> modifySearchPath              :: [FilePath] -> String -> [FilePath]
 > modifySearchPath p np
->   | any (\x -> x == head np) environmentSeparators = p ++ split
->   | any (\x -> x == last np) environmentSeparators = split ++ p
+>   | isSearchPathSeparator (head np)                = p ++ split
+>   | isSearchPathSeparator (last np)                = split ++ p
 >   | otherwise                                      = split
->   where split = splitOn environmentSeparators np
+>   where split = splitOn isSearchPathSeparator np
 
-> relPath                       :: [String] -> FileName
-> relPath ps                    =  concat (intersperse [directorySeparator] ps)
+> -- relPath =  joinpath
 
-> absPath                       :: [String] -> FileName
-> absPath ps                    =  directorySeparator : relPath ps
+> -- absPath ps  =  directorySeparator : relPath ps
 
-> isAbsolute                    :: FileName -> Bool
-> isAbsolute []                 =  False
-> isAbsolute xs                 =  head xs `elem` directorySeparators
+> isWindows = "win" `isPrefixOf` os || "Win" `isPrefixOf` os || "mingw" `isPrefixOf` os
 
-> isRelative                    :: FileName -> Bool
-> isRelative                    =  not . isAbsolute
+> absPath                       :: FilePath -> FilePath
+> absPath                       =  if isWindows then
+>                                    (("C:" ++ [pathSeparator]) ++)
+>                                  else
+>                                    (pathSeparator :)
 
-> deep                          :: FileName -> FileName
-> deep                          =  (++(replicate 2 directorySeparator))
+> deep                          :: FilePath -> FilePath
+> deep                          =  (++(replicate 2 pathSeparator))
 
-> env                           :: String -> FileName
+> env                           :: String -> FilePath
 > env x                         =  "{" ++ x ++ "}"
 
-> extension                     :: FileName -> Maybe String
-> extension fn                  =  f False [] fn 
->   where
->   f found acc [] | found      =  Just (reverse acc)
->                  | not found  =  Nothing 
->   f found acc ('.':cs)        =  f True  []      cs
->   f found acc (c  :cs)        =  f found (c:acc) cs
-
-> dirname                       :: FileName -> String
-> dirname fn                    =  f [] [] fn
->   where
->   f res acc []                =  reverse res
->   f res acc (c:cs) 
->     | c `elem` directorySeparators 
->                               =  f (c : acc ++ res) [] cs
->     | otherwise               =  f res       (c : acc) cs
-
-> filename                      :: FileName -> String
-> filename fn                   =  f [] fn 
->   where
->   f acc []                    =  reverse acc 
->   f acc (c:cs)
->     | c `elem` directorySeparators
->                               =  f []      cs
->     | otherwise               =  f (c:acc) cs
+> extension                     :: FilePath -> Maybe String
+> extension fn                  =  case takeExtension fn of
+>                                    ""       ->  Nothing
+>                                    (_:ext)  ->  Just ext
 
-> basename                      :: FileName -> String
-> basename fn                   =  takeWhile (/= '.') (filename fn)  
+> -- dirname = takeDirectory
+> -- filename = takeFilePath
+> -- basename = takeBaseName
 
 |expandPath| does two things: it replaces curly braced strings with
 environment entries, if present; furthermore, if the path ends with
 more than one directory separator, all subpaths are added ...
 
 > expandPath                    :: [String] -> IO [String]
-> expandPath s                  =  do let s' = concatMap (splitOn environmentSeparators) s
->                                     s'' <- mapM expandEnvironment s'
+> expandPath s                  =  do let s' = concatMap splitSearchPath s
+>                                     s''  <- mapM expandEnvironment s'
 >                                     s''' <- mapM findSubPaths (concat s'')
 >                                     return (nub $ concat s''')
 
 > findSubPaths                  :: String -> IO [String]
 > findSubPaths ""               =  return []
 > findSubPaths s                =  let rs = reverse s
->                                      (sep,rs') = span (`elem` directorySeparators) rs
+>                                      (sep,rs') = span isPathSeparator rs
 >                                      s'   = reverse rs'
 >                                      sep' = reverse sep
 >                                  in  if   null s' 
@@ -106,7 +80,7 @@
 > descendFrom                   :: String -> IO [String]
 > descendFrom s                 =  catch (do  d <- getDirectoryContents s
 >                                             {- no hidden files, no parents -}
->                                             let d' = map (\x -> s ++ [directorySeparator] ++ x)
+>                                             let d' = map (\x -> s </> x)
 >                                                    . filter ((/='.') . head) . filter (not . null) $ d
 >                                             d'' <- filterM doesDirectoryExist d'
 >                                             d''' <- mapM descendFrom d''
@@ -123,24 +97,24 @@
 >   where findEnvironment       :: String -> String -> String -> IO [String]
 >         findEnvironment e a o =  do er <- try (getEnv e)
 >                                     return $ either (const [])
->                                                     (map (\x -> a ++ x ++ o) . splitOn environmentSeparators)
+>                                                     (map (\x -> a ++ x ++ o) . splitOn isSearchPathSeparator)
 >                                                     er
 
-> splitOn                       :: String -> String -> [String]
-> splitOn b s                   =  case dropWhile (`elem` b) s of
+> splitOn                       :: (Char -> Bool) -> String -> [String]
+> splitOn p s                   =  case dropWhile p s of
 >                                    "" -> []
->                                    s' -> w : splitOn b s''
->                                            where (w,s'') = break (`elem` b) s'
+>                                    s' -> w : splitOn p s''
+>                                            where (w,s'') = break p s'
 
 > chaseFile                     :: [String]    {- search path -}
->                               -> FileName -> IO (String,FileName)
+>                               -> FilePath -> IO (String,FilePath)
 > chaseFile p fn | isAbsolute fn=  t fn
 >                | p == []      =  chaseFile ["."] fn
 >                | otherwise    =  s $ map (\d -> t (md d ++ fn)) p
 >   where
->   md cs | last cs `elem` directorySeparators
+>   md cs | isPathSeparator (last cs)
 >                               =  cs
->         | otherwise           =  cs ++ [directorySeparator]
+>         | otherwise           =  addTrailingPathSeparator cs
 >   t f                         =  catch (readFile f >>= \x -> return (x,f))
 >                                        (\_ -> ioError $ userError $ "File `" ++ fn ++ "' not found.\n")
 >   s []                        =  ioError 
diff --git a/HsLexer.lhs b/HsLexer.lhs
--- a/HsLexer.lhs
+++ b/HsLexer.lhs
@@ -8,6 +8,7 @@
 > where
 > import Data.Char 	(  isSpace, isUpper, isLower, isDigit, isAlphaNum  )
 > import Control.Monad
+> import Control.Monad.Error ()
 > import Document
 > import Auxiliaries
 
@@ -95,8 +96,13 @@
 > lex' ('"' : s)                =  do let (t, u) = lexLitStr s
 >                                     v <- match "\"" u
 >                                     return (String ("\"" ++ t ++ "\""), v)
-> lex' ('-' : '-' : s)          =  let (t, u) = break (== '\n') s
->                                  in  return (Comment t, u)
+> lex' ('-' : '-' : s)
+>   | not (null s') && isSymbol (head s')
+>                               =  case s' of
+>                                    (c : s'') -> return (Varsym ("--" ++ d ++ [c]), s'')
+>   | otherwise                 =  return (Comment t, u)
+>   where (d, s') = span (== '-') s
+>         (t, u)  = break (== '\n') s'
 > lex' ('{' : '-' : '"' : s)    =  do let (t, u) = inlineTeX s
 >                                     v <- match "\"-}" u
 >                                     return (TeX (Text t), v)
diff --git a/INSTALL b/INSTALL
--- a/INSTALL
+++ b/INSTALL
@@ -7,7 +7,7 @@
 
 (A) Using Cabal to install lhs2TeX:
 
-This requires Cabal 1.1.6 or later. The process is then as usual:
+This requires Cabal 1.2 or later. The process is then as usual:
 
 runghc Setup configure
 runghc Setup build
@@ -28,7 +28,7 @@
 Unpack the archive. Assume that it has been unpacked into directory
 "/somewhere". Then say
 
-cd /somewhere/lhs2TeX-1.12
+cd /somewhere/lhs2TeX-1.13
 ./configure
 make
 make install
@@ -44,24 +44,22 @@
 lhs2TeX binary. The default search path is as follows:
 
 .
-{HOME}/lhs2tex-1.12//
+{HOME}/lhs2tex-1.13//
 {HOME}/lhs2tex//
 {HOME}/lhs2TeX//
-{HOME}/.lhs2tex-1.12//
+{HOME}/.lhs2tex-1.13//
 {HOME}/.lhs2tex//
 {HOME}/.lhs2TeX//
 {LHS2TEX}//
-/usr/local/share/lhs2tex-1.12//
-/usr/local/share/lhs2tex-1.12//
-/usr/local/lib/lhs2tex-1.12//
-/usr/share/lhs2tex-1.12//
-/usr/lib/lhs2tex-1.12//
-/usr/local/share/lhs2tex//
+/usr/local/share/lhs2tex-1.13//
+/usr/local/share/lhs2tex-1.13//
+/usr/local/lib/lhs2tex-1.13//
+/usr/share/lhs2tex-1.13//
+/usr/lib/lhs2tex-1.13//
 /usr/local/share/lhs2tex//
 /usr/local/lib/lhs2tex//
 /usr/share/lhs2tex//
 /usr/lib/lhs2tex//
-/usr/local/share/lhs2TeX//
 /usr/local/share/lhs2TeX//
 /usr/local/lib/lhs2TeX//
 /usr/share/lhs2TeX//
diff --git a/Library/colorcode.fmt b/Library/colorcode.fmt
--- a/Library/colorcode.fmt
+++ b/Library/colorcode.fmt
@@ -2,16 +2,13 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 % colorcode.fmt
 %
-% code in a colored box for poly style in lhs2TeX;
-% very experimental
+% colored code for poly style in lhs2TeX
 %
 % Permission is granted to include this file (or parts of this file) 
 % literally into other documents, regardless of the conditions or 
 % license applying to these documents.
 %
-% Andres Loeh, November 2005, ver 1.6
-%
-% TODO: fix spacing behaviour for other environments
+% Andres Loeh, January 2008, ver 1.7
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %endif
 %if not lhs2tex_colorcode_fmt_read
@@ -24,20 +21,28 @@
 \RequirePackage{colortbl}
 \RequirePackage{calc}
 
-% The color environment displays each code block in a colored box.
-
 \makeatletter
 \newenvironment{colorhscode}%
-  {{\parskip=0pt\parindent=0pt\par\vskip\abovedisplayskip\noindent}%
+  {\hsnewpar\abovedisplayskip
    \hscodestyle
    \tabular{@@{}>{\columncolor{codecolor}}p{\linewidth}@@{}}%
    \let\\=\@@normalcr
    \(\pboxed}%
   {\endpboxed\)%
    \endtabular
-   {\parskip=0pt\parindent=0pt\par\vskip\belowdisplayskip\noindent}%
+   \hsnewpar\belowdisplayskip
    \ignorespacesafterend}
 
+\newenvironment{tightcolorhscode}%
+  {\hsnewpar\abovedisplayskip
+   \hscodestyle
+   \tabular{@@{}>{\columncolor{codecolor}\(}l<{\)}@@{}}%
+   \pmboxed}%
+  {\endpmboxed%
+   \endtabular
+   \hsnewpar\belowdisplayskip
+   \ignorespacesafterend}
+
 \newenvironment{barhscode}%
   {\hsnewpar\abovedisplayskip
    \hscodestyle
@@ -58,6 +63,7 @@
 \setlength{\coderulewidth}{3pt}
 
 \newcommand{\colorhs}{\sethscode{colorhscode}}
+\newcommand{\tightcolorhs}{\sethscode{tightcolorhscode}}
 \newcommand{\barhs}{\sethscode{barhscode}}
 
 \EndFmtInput
diff --git a/Library/polycode.fmt b/Library/polycode.fmt
--- a/Library/polycode.fmt
+++ b/Library/polycode.fmt
@@ -8,7 +8,7 @@
 % literally into other documents, regardless of the conditions or 
 % license applying to these documents.
 %
-% Andres Loeh, February 2006, ver 1.9
+% Andres Loeh, January 2008, ver 1.10
 %
 % TODO: use \[ \] in arrayhs (fleqn problem)
 %       think about penalties and better pagebreaks
@@ -75,11 +75,24 @@
 \newcommand{\compaths}{\sethscode{compathscode}}
 
 % "plain" mode is the proposed default.
+% It should now work with \centering.
+% This required some changes. The old version
+% is still available for reference as oldplainhscode.
 
 \newenvironment{plainhscode}%
   {\hsnewpar\abovedisplayskip
    \advance\leftskip\mathindent
    \hscodestyle
+   \let\hspre\(\let\hspost\)%
+   \pboxed}%
+  {\endpboxed%
+   \hsnewpar\belowdisplayskip
+   \ignorespacesafterend}
+
+\newenvironment{oldplainhscode}%
+  {\hsnewpar\abovedisplayskip
+   \advance\leftskip\mathindent
+   \hscodestyle
    \let\\=\@@normalcr
    \(\pboxed}%
   {\endpboxed\)%
@@ -89,6 +102,7 @@
 % Here, we make plainhscode the default environment.
 
 \newcommand{\plainhs}{\sethscode{plainhscode}}
+\newcommand{\oldplainhs}{\sethscode{oldplainhscode}}
 \plainhs
 
 % The arrayhscode is like plain, but makes use of polytable's
diff --git a/Main.lhs b/Main.lhs
--- a/Main.lhs
+++ b/Main.lhs
@@ -8,6 +8,7 @@
 > where
 >
 > import Data.Char ( isSpace )
+> import Data.List ( isPrefixOf )
 > import System.IO ( hClose, hPutStr, hPutStrLn, hFlush, hGetLine, stderr, stdout, openFile, IOMode(..), Handle(..) )
 > import System.Directory ( copyFile )
 > import System.Console.GetOpt
@@ -90,6 +91,7 @@
 >                                          olineno    :: LineNo,
 >                                          atnewline  :: Bool,
 >                                          fldir      :: Bool,          -- file/linenumber directives
+>                                          pragmas    :: Bool,          -- generate LINE pragmas?
 >                                          output     :: Handle,
 >                                          opts       :: String,        -- options for `hugs'
 >                                          files      :: [(FilePath, LineNo)], -- includees (?)
@@ -116,6 +118,7 @@
 >                                          olineno    = 0,
 >                                          atnewline  = True,
 >                                          fldir      = False,
+>                                          pragmas    = True,
 >                                          output     = stdout,
 >                                          opts       = "",
 >                                          files      = [],
@@ -212,6 +215,8 @@
 >                                                       return $ s { output = h }, id, [])) "file") "specify output file"
 >   , Option []    ["file-directives"]
 >                              (NoArg (\s -> return $ s { fldir = True }, id, []))          "generate %file directives"
+>   , Option []    ["no-pragmas"]
+>                              (NoArg (\s -> return $ s { pragmas = False }, id, []))       "no LINE pragmas"
 >   , Option ['A'] ["align"]   (ReqArg (\c -> (return, (Directive Align c:), [])) "col")    "align at <col>"
 >   , Option ['i'] ["include"] (ReqArg (\f -> (return, (Directive Include f:), [])) "file") "include <file>"
 >   , Option ['l'] ["let"]     (ReqArg (\s -> (return, (Directive Let s:), [])) "equation") "assume <equation>"
@@ -455,8 +460,8 @@
 >         select Poly st        =  do (d, pstack') <- Poly.display (fmts st) (isTrue (toggles st) auto) (separation st) (latency st) (pstack st) s
 >                                     return (d, st{pstack = pstack'})
 >         select NewCode st     =  do d <- NewCode.display (fmts st) s
->                                     let p = sub'pragma $ Text ("LINE " ++ show (lineno st + 1) ++ " " ++ show (filename $ file st))
->                                     return (p <> sub'nl <> d, st)
+>                                     let p = sub'pragma $ Text ("LINE " ++ show (lineno st + 1) ++ " " ++ show (takeFileName $ file st))
+>                                     return ((if pragmas st then ((p <> sub'nl) <>) else id) d, st)
 >         select CodeOnly st    =  return (Text (trim s), st)
 
 > auto                          =  "autoSpacing"
@@ -545,7 +550,7 @@
 >                                     let os  =  opts st
 >                                         f   =  file st
 >                                         ex  =  externals st
->                                         ghcimode       =  "ghci" `isPrefix` os
+>                                         ghcimode       =  "ghci" `isPrefixOf` os
 >                                         cmd
 >                                           | ghcimode   =  os ++ " -v0 -ignore-dot-ghci " ++ f
 >                                           | otherwise  =  (if null os then "hugs " else os ++ " ") ++ f
@@ -562,6 +567,7 @@
 >                                     store (st {externals = FM.add (f,pi) ex})
 >                                     let (pin,pout,_,_) = pi
 >                                     fromIO $ do
+>                                       -- hPutStrLn stderr ("sending: " ++ script)
 >                                       hPutStr pin script
 >                                       hFlush pin
 >                                       extract' pout
@@ -596,13 +602,14 @@
 >     where readMagic           :: Int -> IO [String]
 >           readMagic 0         =  return []
 >           readMagic n         =  do  l <- hGetLine h
->                                      let n'  |  (null . snd . breaks (isPrefix magic)) l  =  n
->                                              |  otherwise                                 =  n - 1
+>                                      -- hPutStrLn stderr ("received: " ++ l)
+>                                      let n'  |  (null . snd . breaks (isPrefixOf magic)) l  =  n
+>                                              |  otherwise                                   =  n - 1
 >                                      fmap (l:) (readMagic n')
 
 > extract                       :: String -> String
 > extract s                     =  v
->     where (t, u)              =  breaks (isPrefix magic) s
+>     where (t, u)              =  breaks (isPrefixOf magic) s
 >           -- t contains everything up to magic, u starts with magic
 >           -- |u'                      =  tail (dropWhile (/='\n') u)|
 >           pre                 =  reverse . takeWhile (/='\n') . reverse $ t
@@ -610,7 +617,7 @@
 >           -- pre contains the prefix of magic on the same line
 >           u'                  =  drop (length magic + prelength) u
 >           -- we drop the magic string, plus the newline, plus the prefix
->           (v, _)              =  breaks (isPrefix (pre ++ magic)) u'
+>           (v, _)              =  breaks (isPrefixOf (pre ++ magic)) u'
 >           -- we look for the next occurrence of prefix plus magic
 
 % - - - - - - - - - - - - - - - = - - - - - - - - - - - - - - - - - - - - - - -
@@ -631,7 +638,7 @@
 
 > programInfo                   :: String
 > programInfo                   =
->     "lhs2TeX " ++ version ++ ", Copyright (C) 1997-2006 Ralf Hinze, Andres Loeh\n\n\
+>     "lhs2TeX " ++ version ++ ", Copyright (C) 1997-2008 Ralf Hinze, Andres Loeh\n\n\
 >     \lhs2TeX comes with ABSOLUTELY NO WARRANTY;\n\
 >     \for details type `lhs2TeX --warranty'.\n\
 >     \This is free software, and you are welcome to redistribute it\n\
diff --git a/NewCode.lhs b/NewCode.lhs
--- a/NewCode.lhs
+++ b/NewCode.lhs
@@ -79,7 +79,7 @@
 >     tex _ (Keyword s)         =  replace Empty s (sub'keyword (convert s))
 >     tex _ (TeX d)             =  d
 >     tex _ t@(Qual ms t')      =  replace Empty (string t) (tex (catenate (map (\m -> tex Empty (Conid m) <> Text ".") ms)) t')
->     tex _ t@(Op t')           =  replace Empty (string t) (cmd (conv '`' <> tex Empty t' <> conv '`'))
+>     tex _ t@(Op t')           =  replace Empty (string t) (sub'backquoted (tex Empty t'))
 >         where cmd | isConid t'=  sub'consym
 >                   | otherwise =  sub'varsym
 >
diff --git a/RELEASE b/RELEASE
--- a/RELEASE
+++ b/RELEASE
@@ -1,5 +1,5 @@
 
-                     lhs2TeX version 1.12
+                     lhs2TeX version 1.13
                      ====================
 
 We are pleased to announce a new release of lhs2TeX, 
@@ -20,28 +20,34 @@
 
 * A manual explaining all the important aspects of lhs2TeX.
 
-Changes (w.r.t. lhs2TeX 1.11)
+Changes (w.r.t. lhs2TeX 1.12)
 -----------------------------
 
-* Compatible with ghc-6.6.
+* Compatible with ghc-6.8.{1,2}.
 
-* Compatible with cabal-1.1.6; traditional configure/make
-  installation should still work. Thanks to Brian Smith
-  for submitting a patch to improve the Cabal experience
-  on Windows.
+* Compatible with cabal-1.2; traditional configure/make
+  installation should still work.
 
+* Uses filepath.
+
+* LINE pragmas can be disabled with --no-pragmas.
+
+* Fixed comment lexing bugs (--> was considered a Haskell comment,
+  \% was considered a TeX comment)
+
+* Added a %subst directive for backquoted operators.
+
 Requirements and Download
 -------------------------
 
 A source distribution is available from
 
-  http://www.iai.uni-bonn.de/~loeh/lhs2tex/
+  http://www.cs.uu.nl/~andres/lhs2tex/
 
-It has been verified to build on Linux and MacOSX, but
-should also work on Windows. Binaries will be made available
-on request.
+Should work on all major platforms, but has mainly been
+tested on Linux. Binaries will be made available on request.
 
-You need a recent version of GHC (6.4.2 is tested, older versions
+You need a recent version of GHC (6.8.2 is tested, older versions
 might work) to build lhs2TeX, and, of course, you need a TeX
 distribution to make use of lhs2TeX's output. The program includes
 a configuration that is suitable for use with LaTeX. In theory, 
diff --git a/Setup.hs b/Setup.hs
--- a/Setup.hs
+++ b/Setup.hs
@@ -1,14 +1,20 @@
-import Distribution.Setup (CopyDest(..),ConfigFlags(..),BuildFlags(..),
-                           CopyFlags(..),RegisterFlags(..),InstallFlags(..))
+import Distribution.Simple.Setup (CopyDest(..),ConfigFlags(..),BuildFlags(..),
+                                  CopyFlags(..),RegisterFlags(..),InstallFlags(..),
+                                  emptyRegisterFlags)
 import Distribution.Simple
 import Distribution.Simple.Utils (die,rawSystemExit,maybeExit,copyFileVerbose)
-import Distribution.Simple.LocalBuildInfo (LocalBuildInfo(..),mkDataDir,substDir,absolutePath)
+import Distribution.Simple.LocalBuildInfo
+                            (LocalBuildInfo(..),mkDataDir,absoluteInstallDirs)
 import Distribution.Simple.Configure (configCompilerAux)
 import Distribution.PackageDescription (PackageDescription(..),setupMessage)
-import Distribution.Program (Program(..),ProgramConfiguration(..),
+import Distribution.Simple.InstallDirs
+                            (InstallDirs(..))
+import Distribution.Simple.Program 
+                            (Program(..),ConfiguredProgram(..),ProgramConfiguration(..),
                              ProgramLocation(..),simpleProgram,lookupProgram,
                              rawSystemProgramConf)
--- import Distribution.Compat.ReadP (readP_to_S)
+import Distribution.Simple.Utils
+import Distribution.Verbosity
 import Data.Char (isSpace, showLitChar)
 import Data.List (isSuffixOf,isPrefixOf)
 import Data.Maybe (listToMaybe,isJust)
@@ -27,12 +33,14 @@
 minPolytableVersion = [0,8,2]
 shortversion = show (numversion `div` 100) ++ "." ++ show (numversion `mod` 100)
 version = shortversion ++ if ispre then "pre" ++ show pre else ""
-numversion = 112
+numversion = 113
 ispre = False
-pre = 3
+pre = 4
 
 main = defaultMainWithHooks lhs2texHooks
 
+sep =  if isWindows then ";" else ":"
+
 lhs2texBuildInfoFile :: FilePath
 lhs2texBuildInfoFile = "." `joinFileName` ".setup-lhs2tex-config"
 
@@ -50,7 +58,6 @@
                                      simpleProgram "kpsewhich",
                                      simpleProgram "pdflatex",
                                      simpleProgram "mktexlsr"],
-                   confHook       = lhs2texConfHook,
                    postConf       = lhs2texPostConf,
                    postBuild      = lhs2texPostBuild,
                    postCopy       = lhs2texPostCopy,
@@ -59,23 +66,9 @@
                    cleanHook      = lhs2texCleanHook
                  }
 
-lhs2texConfHook pd cf =
-    do  -- give status message
-        setupMessage "Pre-Configuring" pd
-        comp <- configCompilerAux (cf { configVerbose = 0 })
-        let flavor = compilerFlavor comp
-        let ver = compilerVersion comp
-        pd <- if flavor == GHC && 
-                 withinRange ver (EarlierVersion (Version [6,5] []))
-              then do
-                     when (configVerbose cf > 0) $ putStrLn "configure: adapting for ghc < 6.5"
-                     return (pd { buildDepends =
-                                  filter (\ (Dependency d _) -> d /= "regex-compat") (buildDepends pd) })
-              else return pd
-        confHook defaultUserHooks pd cf
-
 lhs2texPostConf a cf pd lbi =
-    do  -- check polytable
+    do  let v = configVerbose cf
+        -- check polytable
         (_,b,_) <- runKpseWhichVar "TEXMFLOCAL"
         b       <- return . stripQuotes . stripNewlines $ b
         ex      <- return (not . all isSpace $ b) -- or check if directory exists?
@@ -87,34 +80,34 @@
                    do  (_,p,_) <- runKpseWhich "polytable.sty"
                        p       <- return . stripNewlines $ p
                        ex      <- doesFileExist p
-                       nec     <- if ex then do  message $ "Found polytable package at: " ++ p
+                       nec     <- if ex then do  info v $ "Found polytable package at: " ++ p
                                                  x  <- readFile p
                                                  let vp = do  vs <- matchRegex (mkRegexWithOpts " v(.*) .polytable. package" True True) x
                                                               listToMaybe [ r | v <- vs, (r,"") <- readP_to_S parseVersion v ]
                                                  let (sv,nec) = case vp of
                                                                   Just n  -> (showVersion n,versionBranch n < minPolytableVersion)
                                                                   Nothing -> ("unknown",True)
-                                                 message $ "Package polytable version: " ++ sv
+                                                 info v $ "Package polytable version: " ++ sv
                                                  return nec
                                         else return True
-                       message $ "Package polytable installation necessary: " ++ showYesNo nec
-                       when nec $ message $ "Using texmf tree at: " ++ b
+                       info v $ "Package polytable installation necessary: " ++ showYesNo nec
+                       when nec $ info v $ "Using texmf tree at: " ++ b
                        return (if nec then Just b else Nothing)
                    else
-                   do  message "No texmf tree found, polytable package cannot be installed"
+                   do  warn v "No texmf tree found, polytable package cannot be installed"
                        return Nothing
         -- check documentation
         ex      <- doesFileExist $ "doc" `joinFileName` "Guide2.dontbuild"
-        r       <- if ex then do message "Documentation will not be rebuilt unless you remove the file \"doc/Guide2.dontbuild\""
+        r       <- if ex then do info v "Documentation will not be rebuilt unless you remove the file \"doc/Guide2.dontbuild\""
                                  return False
-                         else do mProg <- lookupProgram "pdflatex" (withPrograms lbi)
+                         else do let mProg = lookupProgram (simpleProgram "pdflatex") (withPrograms lbi)
                                  case mProg of
-                                   Nothing  -> message "Documentation cannot be rebuilt without pdflatex" >> return False
+                                   Nothing  -> info v "Documentation cannot be rebuilt without pdflatex" >> return False
                                    Just _   -> return True
-        unless r $ message $ "Using pre-built documentation"
+        unless r $ info v $ "Using pre-built documentation"
         writePersistLhs2texBuildConfig (Lhs2texBuildInfo { installPolyTable = i, rebuildDocumentation = r })
-        mapM_ (\f -> do message $ "Creating " ++ f
-                        hugsExists <- lookupProgram "hugs" (withPrograms lbi)
+        mapM_ (\f -> do info v $ "Creating " ++ f
+                        let hugsExists = lookupProgram (simpleProgram "hugs") (withPrograms lbi)
                         hugs <- case hugsExists of
                                   Nothing -> return ""
                                   Just _  -> fmap fst (getProgram "hugs" (withPrograms lbi))
@@ -123,8 +116,8 @@
                         readFile (f ++ ".in") >>= return .
                                                   -- these paths could contain backslashes, so we
                                                   -- need to escape them.
-                                                  replace "@prefix@"  (escapeChars $ prefix lbi) .
-                                                  replace "@datadir@" (escapeChars $ absolutePath pd lbi NoCopyDest (datadir lbi)) .
+                                                  replace "@prefix@"  (escapeChars $ prefix (absoluteInstallDirs pd lbi NoCopyDest)) .
+                                                  replace "@stydir@" (escapeChars $ datadir (absoluteInstallDirs pd lbi NoCopyDest)) .
                                                   replace "@LHS2TEX@" lhs2texBin .
                                                   replace "@HUGS@" hugs .
                                                   replace "@VERSION@" version .
@@ -132,8 +125,7 @@
                                                   replace "@NUMVERSION@" (show numversion) .
                                                   replace "@PRE@" (show pre) >>= writeFile f)
               generatedFiles
-        return ExitSuccess
-  where runKpseWhich v = runCommandProgramConf 0 "kpsewhich" (withPrograms lbi) [v]
+  where runKpseWhich v = runCommandProgramConf silent "kpsewhich" (withPrograms lbi) [v]
         runKpseWhichVar v = runKpseWhich $ "-expand-var='$" ++ v ++ "'"
 
 lhs2texPostBuild a bf@(BuildFlags { buildVerbose = v }) pd lbi =
@@ -146,7 +138,6 @@
         createDirectoryIfMissing True lhs2texDocDir
         if rebuildDocumentation ebi then lhs2texBuildDocumentation a bf pd lbi
                                     else copyFileVerbose v ("doc" `joinFileName` "Guide2.pdf") (lhs2texDocDir `joinFileName` "Guide2.pdf")
-        return ExitSuccess
 
 lhs2texBuildDocumentation a (BuildFlags { buildVerbose = v }) pd lbi =
     do  let lhs2texDir = buildDir lbi `joinFileName` lhs2tex
@@ -163,7 +154,7 @@
                                    ( -- replace "^%options ghc"        "%options ghc" .
                                      -- replace "^%options hugs"       "%options hugs" .
                                      -- TODO: replace or replaceEscaped
-                                     replace "-pgmF \\.\\./lhs2TeX" ("-pgmF " ++ lhs2texBin ++ " -optF-Pdoc:") $ c )
+                                     replace "-pgmF \\.\\./lhs2TeX" ("-pgmF " ++ lhs2texBin ++ " -optF-Pdoc" ++ sep) $ c )
                          let incToStyle ["verbatim"]   = "verb"
                              incToStyle ["stupid"]     = "math"
                              incToStyle ["tex"]        = "poly"
@@ -171,17 +162,17 @@
                              incToStyle ["typewriter"] = "tt"
                              incToStyle [x]            = x
                              incToStyle []             = "poly"
-                         callLhs2tex v lbi ["--" ++ incToStyle inc , "-Pdoc:", lhs2texDir `joinFileName` snippet]
+                         callLhs2tex v lbi ["--" ++ incToStyle inc , "-Pdoc" ++ sep, lhs2texDir `joinFileName` snippet]
                                            (lhs2texDocDir `joinFileName` s ++ ".tex")
                 ) snippets
-        callLhs2tex v lbi ["--poly" , "-Pdoc:", "doc" `joinFileName` "Guide2.lhs"]
+        callLhs2tex v lbi ["--poly" , "-Pdoc" ++ sep, "doc" `joinFileName` "Guide2.lhs"]
                           (lhs2texDocDir `joinFileName` "Guide2.tex")
         copyFileVerbose v ("polytable" `joinFileName` "polytable.sty") (lhs2texDocDir `joinFileName` "polytable.sty")
         copyFileVerbose v ("polytable" `joinFileName` "lazylist.sty")  (lhs2texDocDir `joinFileName` "lazylist.sty")
         d <- getCurrentDirectory
         setCurrentDirectory lhs2texDocDir
         -- call pdflatex as long as necessary
-        let loop = do rawSystemProgramConf v "pdflatex" (withPrograms lbi) ["Guide2.tex"]
+        let loop = do rawSystemProgramConf v (simpleProgram "pdflatex") (withPrograms lbi) ["Guide2.tex"]
                       x <- readFile "Guide2.log"
                       case matchRegex (mkRegexWithOpts "Warning.*Rerun" True True) x of
                         Just _  -> loop
@@ -191,7 +182,7 @@
 
 lhs2texPostCopy a (CopyFlags { copyDest = cd, copyVerbose = v }) pd lbi =
     do  ebi <- getPersistLhs2texBuildConfig
-        let dataPref = mkDataDir pd lbi cd
+        let dataPref = datadir (absoluteInstallDirs pd lbi cd)
         createDirectoryIfMissing True dataPref
         let lhs2texDir = buildDir lbi `joinFileName` lhs2tex
         -- lhs2TeX.{fmt,sty}
@@ -205,10 +196,10 @@
         let lhs2texDocDir = lhs2texDir `joinFileName` "doc"
         let docDir = if isWindows
                        then dataPref `joinFileName` "Documentation"
-                       else absolutePath pd lbi cd (datadir lbi `joinFileName` "doc" `joinFileName` datasubdir lbi)
+                       else docdir (absoluteInstallDirs pd lbi cd) `joinFileName` "doc"
         let manDir = if isWindows
                        then dataPref `joinFileName` "Documentation"
-                       else absolutePath pd lbi cd (datadir lbi `joinFileName` "man" `joinFileName` "man1")
+                       else datadir (absoluteInstallDirs pd lbi cd) `joinFileName` ".." `joinFileName` "man" `joinFileName` "man1"
         createDirectoryIfMissing True docDir
         copyFileVerbose v (lhs2texDocDir `joinFileName` "Guide2.pdf") (docDir `joinFileName` "Guide2.pdf")
         when (not isWindows) $
@@ -216,7 +207,7 @@
              copyFileVerbose v ("lhs2TeX.1") (manDir `joinFileName` "lhs2TeX.1")
         -- polytable
         case (installPolyTable ebi) of
-          Just texmf -> do  let texmfDir = absolutePath pd lbi cd texmf
+          Just texmf -> do  let texmfDir = texmf
                                 ptDir = texmfDir `joinFileName` "tex" `joinFileName` "latex"
                                                  `joinFileName` "polytable"
                             createDirectoryIfMissing True ptDir
@@ -226,17 +217,15 @@
                                                            (ptDir `joinFileName` f))
                                   stys
           Nothing    -> return ()
-        return ExitSuccess
 
-lhs2texPostInst a (InstallFlags { installUserFlags = u, installVerbose = v }) pd lbi =
+lhs2texPostInst a (InstallFlags { installPackageDB = db, installVerbose = v }) pd lbi =
     do  lhs2texPostCopy a (CopyFlags { copyDest = NoCopyDest, copyVerbose = v }) pd lbi
-        lhs2texRegHook pd lbi Nothing (RegisterFlags { regUser = u, regInPlace = False, regWithHcPkg = Nothing, regGenScript = False, regVerbose = v })
-        return ExitSuccess
+        lhs2texRegHook pd lbi Nothing (emptyRegisterFlags { regPackageDB = db, regVerbose = v })
 
 lhs2texRegHook pd lbi _ (RegisterFlags { regVerbose = v }) =
     do  ebi <- getPersistLhs2texBuildConfig
         when (isJust . installPolyTable $ ebi) $
-          do  rawSystemProgramConf v "mktexlsr" (withPrograms lbi) []
+          do  rawSystemProgramConf v (simpleProgram "mktexlsr") (withPrograms lbi) []
               return ()
 
 lhs2texCleanHook pd lbi v pshs =
@@ -264,9 +253,6 @@
 showYesNo p | p          =  "yes"
             | otherwise  =  "no"
 
-message :: String -> IO ()
-message s = putStrLn $ "configure: " ++ s
-
 stripNewlines :: String -> String
 stripNewlines = filter (/='\n')
 
@@ -277,23 +263,15 @@
 callLhs2tex v lbi params outf =
     do  let lhs2texDir = buildDir lbi `joinFileName` lhs2tex
         let lhs2texBin = lhs2texDir `joinFileName` lhs2tex
-        let args    =  [ "-P" ++ lhs2texDir ++ ":" ]
-                     ++ (if v > 4 then ["-v"] else [])
+        let args    =  [ "-P" ++ lhs2texDir ++ sep ]
+                     ++ [ "-o" ++ outf ]
+                     ++ (if v == deafening then ["-v"] else [])
                      ++ params
-        maybeExit $ runCommandRedirect v lhs2texBin args outf 
-
-runCommandRedirect  ::  Int                       -- ^ verbosity
-                    ->  String                    -- ^ the command
-                    ->  [String]                  -- ^ args
-                    ->  FilePath                  -- ^ output file
-                    ->  IO ExitCode
-runCommandRedirect v cmd args f =
-    do  (ex,out,err) <- runCommand v cmd args
-        writeFile f out
-        hPutStr stderr (unlines . lines $ err)
-        return ex
+	(ex,_,err) <- runCommand v lhs2texBin args
+	hPutStr stderr (unlines . lines $ err)
+	maybeExit (return ex)
 
-runCommandProgramConf  ::  Int                    -- ^ verbosity
+runCommandProgramConf  ::  Verbosity              -- ^ verbosity
                        ->  String                 -- ^ program name
                        ->  ProgramConfiguration   -- ^ lookup up the program here
                        ->  [String]               -- ^ args
@@ -304,22 +282,22 @@
 
 getProgram :: String -> ProgramConfiguration -> IO (String, [String])
 getProgram progName programConf = 
-             do  mProg <- lookupProgram progName programConf
+             do  let mProg = lookupProgram (simpleProgram progName) programConf
                  case mProg of
-                   Just (Program { programLocation = UserSpecified p,
-                                   programArgs = args })  -> return (p,args)
-                   Just (Program { programLocation = FoundOnSystem p,
-                                   programArgs = args })  -> return (p,args)
+                   Just (ConfiguredProgram { programLocation = UserSpecified p,
+                                             programArgs = args })  -> return (p,args)
+                   Just (ConfiguredProgram { programLocation = FoundOnSystem p,
+                                             programArgs = args })  -> return (p,args)
                    _ -> (die (progName ++ " command not found"))
 
 -- | Run a command in a specific environment and return the output and errors.
-runCommandInEnv  ::  Int                   -- ^ verbosity
+runCommandInEnv  ::  Verbosity             -- ^ verbosity
                  ->  String                -- ^ the command
                  ->  [String]              -- ^ args
                  ->  [(String,String)]     -- ^ the environment
                  ->  IO (ExitCode,String,String)
 runCommandInEnv v cmd args env = 
-                 do  when (v > 0) $ putStrLn (cmd ++ concatMap (' ':) args)
+                 do  when (v >= verbose) $ putStrLn (cmd ++ concatMap (' ':) args)
                      let env' = if null env then Nothing else Just env
                      (cin,cout,cerr,pid) <- runInteractiveProcess cmd args Nothing env'
                      hClose cin
@@ -331,7 +309,7 @@
                      return (exit,out,err)
 
 -- | Run a command and return the output and errors.
-runCommand  ::  Int                    -- ^ verbosity
+runCommand  ::  Verbosity              -- ^ verbosity
             ->  String                 -- ^ the command
             ->  [String]               -- ^ args
             ->  IO (ExitCode,String,String)
diff --git a/TeXParser.lhs b/TeXParser.lhs
--- a/TeXParser.lhs
+++ b/TeXParser.lhs
@@ -8,6 +8,7 @@
 > where
 > import Data.Char              (  isSpace, isAlpha  )
 > import TeXCommands
+> import Data.List              (  isPrefixOf  )
 > import Auxiliaries hiding     (  breaks  )
 
 %endif
@@ -75,7 +76,7 @@
 >                 | otherwise   -> notFound end str :  cont
 >                 where
 >                 end           =  "\\end{" ++ env ++ "}"
->                 pred          =  isPrefix end
+>                 pred          =  isPrefixOf end
 >                 (arg, v)      =  breaks maxLine pred u
 >                 (w, x)        =  blank (drop (length end) v)
 >         _                     -> cont
@@ -94,6 +95,7 @@
 >         Just cmd              -> case nested maxChar 0 t of
 >             (a, '}' : u)      -> Command cmd a : classify u
 >             _                 -> notFound "matching `}'" str : cont
+>     ([], '%' : t)             -> Many "\\%" : classify t
 >     _                         -> cont
 >     where
 >     cont                      =  One '\\' : classify s
diff --git a/Typewriter.lhs b/Typewriter.lhs
--- a/Typewriter.lhs
+++ b/Typewriter.lhs
@@ -57,7 +57,7 @@
 >     tex _ (Keyword s)         =  replace Empty s (sub'keyword (convert s))
 >     tex _ (TeX d)             =  d
 >     tex _ t@(Qual ms t')      =  replace Empty (string t) (tex (catenate (map (\m -> tex Empty (Conid m) <> Text ".") ms)) t')
->     tex _ t@(Op t')           =  replace Empty (string t) (cmd (conv '`' <> tex Empty t' <> conv '`'))
+>     tex _ t@(Op t')           =  replace Empty (string t) (sub'backquoted (tex Empty t'))
 >         where cmd | isConid t'=  sub'consym
 >                   | otherwise =  sub'varsym
 >
diff --git a/Version.lhs.in b/Version.lhs.in
--- a/Version.lhs.in
+++ b/Version.lhs.in
@@ -9,6 +9,7 @@
 >
 > import FileNameUtils
 > import Data.List
+> import System.Info
 >
 > version                       :: String
 > version                       =  "@VERSION@"
@@ -20,34 +21,38 @@
 > pre                           :: Int
 > pre                           =  @PRE@
 
+> isWindows = "win" `isPrefixOf` os || "Win" `isPrefixOf` os
+
 % - - - - - - - - - - - - - - - = - - - - - - - - - - - - - - - - - - - - - - -
 \subsubsection{Search path}
 % - - - - - - - - - - - - - - - = - - - - - - - - - - - - - - - - - - - - - - -
 
-> searchPath                    =  relPath ["."] :
->                                  [  deep (relPath (env "HOME":[p ++ x]))
+> searchPath                    =  "." :
+>                                  [  deep (joinPath (env "HOME" : [p ++ x]))
 >                                  |  p <- ["","."]
 >                                  ,  x <- lhs2TeXNames
 >                                  ] ++
->                                  [deep (relPath [env "LHS2TEX"])] ++
+>                                  [deep (joinPath [env "LHS2TEX"])] ++
+>                                  [deep stydir] ++
 >                                  [  deep (path [dir])
 >                                  |  dir  <-  lhs2TeXNames
->                                  ,  path <-  [\x -> relPath ([datadir] ++ x)
->                                              ,\x -> absPath (["usr","local","share"] ++ x)
->                                              ,\x -> absPath (["usr","local","lib"] ++ x)
->                                              ,\x -> absPath (["usr","share"] ++ x)
->                                              ,\x -> absPath (["usr","lib"] ++ x)
+>                                  ,  path <-  if isWindows then [] else
+>                                              [\x -> absPath (joinPath $ ["usr","local","share"] ++ x)
+>                                              ,\x -> absPath (joinPath $ ["usr","local","lib"] ++ x)
+>                                              ,\x -> absPath (joinPath $ ["usr","share"] ++ x)
+>                                              ,\x -> absPath (joinPath $ ["usr","lib"] ++ x)
 >                                              ]
 >                                  ]
 >
+> lhs2TeXNames                  :: [FilePath]
 > lhs2TeXNames                  =  ["lhs2tex-@SHORTVERSION@"
 >                                  ,"lhs2tex"
 >                                  ,"lhs2TeX"
 >                                  ]
 >
-> datadir                       =  replace "@datadir@" "@prefix@"
->   where replace x y  |  "$prefix" `isPrefixOf` x = y ++ drop 7 x
->                      |  "${prefix}" `isPrefixOf` x = y ++ drop 9 x
->                      |  otherwise = x
+> stydir                        =  replace (replace "@stydir@" "datarootdir" "@datarootdir@") "prefix" "@prefix@"
+>   where replace x w y  |  ("$" ++ w) `isPrefixOf` x = y ++ drop (length w + 1) x
+>                        |  ("${" ++ w ++ "}") `isPrefixOf` x = y ++ drop (length w + 3) x
+>                        |  otherwise = x
 
 %endif
diff --git a/config.mk.in b/config.mk.in
--- a/config.mk.in
+++ b/config.mk.in
@@ -4,8 +4,9 @@
 DISTDIR         := $(PACKAGE_TARNAME)-$(PACKAGE_VERSION)
 
 bindir          = @bindir@
+datarootdir     = @datarootdir@
 datadir         = @datadir@
-stydir          = @datadir@/@PACKAGE_TARNAME@
+stydir          = @stydir@
 docdir          = @docdir@
 mandir          = @mandir@
 prefix          = @prefix@
diff --git a/configure b/configure
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.61 for lhs2tex 1.12.
+# Generated by GNU Autoconf 2.61 for lhs2tex 1.13.
 #
 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
 # 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
@@ -572,8 +572,8 @@
 # Identity of this package.
 PACKAGE_NAME='lhs2tex'
 PACKAGE_TARNAME='lhs2tex'
-PACKAGE_VERSION='1.12'
-PACKAGE_STRING='lhs2tex 1.12'
+PACKAGE_VERSION='1.13'
+PACKAGE_STRING='lhs2tex 1.13'
 PACKAGE_BUGREPORT=''
 
 ac_subst_vars='SHELL
@@ -643,6 +643,7 @@
 texmf
 POLYTABLE_INSTALL
 MKTEXLSR
+stydir
 LHS2TEX
 LIBOBJS
 LTLIBOBJS'
@@ -1152,7 +1153,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures lhs2tex 1.12 to adapt to many kinds of systems.
+\`configure' configures lhs2tex 1.13 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1213,7 +1214,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of lhs2tex 1.12:";;
+     short | recursive ) echo "Configuration of lhs2tex 1.13:";;
    esac
   cat <<\_ACEOF
 
@@ -1287,7 +1288,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-lhs2tex configure 1.12
+lhs2tex configure 1.13
 generated by GNU Autoconf 2.61
 
 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1301,7 +1302,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by lhs2tex $as_me 1.12, which was
+It was created by lhs2tex $as_me 1.13, which was
 generated by GNU Autoconf 2.61.  Invocation command line was
 
   $ $0 $@
@@ -1655,10 +1656,10 @@
 
 
 
-VERSION="1.12"
-SHORTVERSION="1.12"
-NUMVERSION=112
-PRE=3
+VERSION="1.13"
+SHORTVERSION="1.13"
+NUMVERSION=113
+PRE=4
 
 
 
@@ -2728,7 +2729,9 @@
 # docdir and expansion
 docdir="$datadir/doc/$PACKAGE_TARNAME-$PACKAGE_VERSION"
 
+stydir="$datadir/$PACKAGE_TARNAME-$PACKAGE_VERSION"
 
+
 # lhs2TeX binary path relative to docdir
 LHS2TEX="../lhs2TeX"
 
@@ -3161,7 +3164,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by lhs2tex $as_me 1.12, which was
+This file was extended by lhs2tex $as_me 1.13, which was
 generated by GNU Autoconf 2.61.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -3204,7 +3207,7 @@
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF
 ac_cs_version="\\
-lhs2tex config.status 1.12
+lhs2tex config.status 1.13
 configured by $0, generated by GNU Autoconf 2.61,
   with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
 
@@ -3435,12 +3438,13 @@
 texmf!$texmf$ac_delim
 POLYTABLE_INSTALL!$POLYTABLE_INSTALL$ac_delim
 MKTEXLSR!$MKTEXLSR$ac_delim
+stydir!$stydir$ac_delim
 LHS2TEX!$LHS2TEX$ac_delim
 LIBOBJS!$LIBOBJS$ac_delim
 LTLIBOBJS!$LTLIBOBJS$ac_delim
 _ACEOF
 
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 70; then
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 71; then
     break
   elif $ac_last_try; then
     { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
diff --git a/doc/Guide2.lhs b/doc/Guide2.lhs
--- a/doc/Guide2.lhs
+++ b/doc/Guide2.lhs
@@ -247,11 +247,19 @@
 
 \title{@Guide2lhs2TeX@\\
   \smaller (for version \ProgramVersion)}
-\author{{Ralf Hinze and Andres L\"oh}\\
+\author{{Ralf Hinze}\\
   \smaller \tabular{c}
            Institut f\"ur Informatik III, Universit\"at Bonn\\
            R\"omerstra\ss e 164, 53117 Bonn, Germany\\
-           \verb|{ralf,loeh}@informatik.uni-bonn.de|
+           \verb|ralf@informatik.uni-bonn.de|
+           \endtabular
+  \and
+  {Andres L\"oh}\\
+  \smaller \tabular{c}
+           Institute of Information and Computing Sciences\\
+           Utrecht University, P.O.~Box 80.089\\
+           3508 TB Utrecht, The Netherlands\\
+           \verb|andres@cs.uu.nl|
            \endtabular}%
 \date{\today}
 \maketitle
@@ -316,7 +324,7 @@
 
 \subsection{Using Cabal to install @lhs2TeX@}
 
-This requires Cabal 1.1.6 or later. The process is then as usual:
+This requires Cabal 1.2 or later. The process is then as usual:
 \input{CabalInstallation}%
 The third step requires write access to the installation location
 and the \LaTeX\ filename database.
@@ -1581,6 +1589,7 @@
                 character |a| \\
 @consym@ |a|  & how to format a constructor symbol |a| \\
 @varsym@ |a|  & how to format a variable symbol |a| \\
+@backquoted@ |a| & how to format a backquoted operator |a| \\
 @numeral@ |a| & how to format a numeral |a| \\
 @char@ |a|    & how to format a character literal |a| \\
 @string@ |a|  & how to format a literal string |a| \\
diff --git a/doc/Guide2.pdf b/doc/Guide2.pdf
Binary files a/doc/Guide2.pdf and b/doc/Guide2.pdf differ
diff --git a/doc/RawSearchPath.lhs b/doc/RawSearchPath.lhs
--- a/doc/RawSearchPath.lhs
+++ b/doc/RawSearchPath.lhs
@@ -1,23 +1,21 @@
 \begin{code}
 .
-{HOME}/lhs2tex-1.12//
+{HOME}/lhs2tex-1.13//
 {HOME}/lhs2tex//
 {HOME}/lhs2TeX//
-{HOME}/.lhs2tex-1.12//
+{HOME}/.lhs2tex-1.13//
 {HOME}/.lhs2tex//
 {HOME}/.lhs2TeX//
 {LHS2TEX}//
-/usr/local/share/lhs2tex-1.12//
-/usr/local/share/lhs2tex-1.12//
-/usr/local/lib/lhs2tex-1.12//
-/usr/share/lhs2tex-1.12//
-/usr/lib/lhs2tex-1.12//
-/usr/local/share/lhs2tex//
+/usr/local/share/lhs2tex-1.13//
+/usr/local/share/lhs2tex-1.13//
+/usr/local/lib/lhs2tex-1.13//
+/usr/share/lhs2tex-1.13//
+/usr/lib/lhs2tex-1.13//
 /usr/local/share/lhs2tex//
 /usr/local/lib/lhs2tex//
 /usr/share/lhs2tex//
 /usr/lib/lhs2tex//
-/usr/local/share/lhs2TeX//
 /usr/local/share/lhs2TeX//
 /usr/local/lib/lhs2TeX//
 /usr/share/lhs2TeX//
diff --git a/lhs2TeX.1.in b/lhs2TeX.1.in
--- a/lhs2TeX.1.in
+++ b/lhs2TeX.1.in
@@ -1,4 +1,4 @@
-.TH LHS2TEX "1" "January 2006" "lhs2TeX" "User Commands"
+.TH LHS2TEX "1" "February 2008" "lhs2TeX" "User Commands"
 .SH NAME
 lhs2TeX \- a literate Haskell to (La)TeX code translator
 
@@ -219,7 +219,7 @@
 .BR lhs2TeX .
 
 .SH SEE ALSO
-.IR http://www.informatik.uni-bonn.de/~loeh/lhs2tex ,
+.IR http://www.cs.uu.nl/~andres/lhs2tex ,
 the 
 .B lhs2TeX 
 homepage
diff --git a/lhs2TeX.fmt.lit b/lhs2TeX.fmt.lit
--- a/lhs2TeX.fmt.lit
+++ b/lhs2TeX.fmt.lit
@@ -47,6 +47,7 @@
 %subst varid a   = a
 %subst consym a  = a
 %subst varsym a  = a
+%subst backquoted a = "`" a "`"
 %subst numeral a = a
 %subst char a    = "''" a "''"
 %subst string a  = "\char34 " a "\char34 "
@@ -221,6 +222,7 @@
 %subst varid a          = a
 %subst consym a         = a
 %subst varsym a         = a
+%subst backquoted a     = "`" a "`"
 %subst char a           = "''" a "''"
 %subst string a         = "'d" a "'d"
 \end{code}
@@ -249,7 +251,7 @@
 %subst column1 a	= "${" a "}$"
 %endif
 %subst newline   	= "\\'n"
-%subst blankline 	= "\\[1mm]'n"
+%subst blankline 	= "\\[1mm]%'n"
 %let anyMath            = True
 %elif style == poly
 %subst comment a	= "\mbox{\onelinecomment " a "}"
@@ -259,13 +261,13 @@
 %else
 %subst code a    	= "\begingroup\par\noindent\advance\leftskip\mathindent\('n\begin{pboxed}\SaveRestoreHook'n" a "\ColumnHook'n\end{pboxed}'n\)\par\noindent\endgroup\resethooks'n"
 %endif
-%subst column c a       = "\column{" c "}{" a "}'n"
-%subst fromto b e t     = "\>[" b "]{}" t "{}\<[" e "]'n"
-%subst left             = "@{}l@{}"
-%subst centered         = "@{}c@{}"
+%subst column c a       = "\column{" c "}{" a "}%'n"
+%subst fromto b e t     = "\>[" b "]{}" t "{}\<[" e "]%'n"
+%subst left             = "@{}>{\hspre}l<{\hspost}@{}"
+%subst centered         = "@{}>{\hspre}c<{\hspost}@{}"
 %subst dummycol         = "@{}l@{}"
 %subst newline   	= "\\'n"
-%subst blankline        = "\\[\blanklineskip]'n"
+%subst blankline        = "\\[\blanklineskip]%'n"
 %subst indent n         = "\hsindent{" n "}"
 %let anyMath            = True
 %endif
@@ -289,6 +291,7 @@
 %subst varid a   	= "\Varid{" a "}"
 %subst consym a  	= "\mathbin{" a "}"
 %subst varsym a  	= "\mathbin{" a "}"
+%subst backquoted a     = "\mathbin{`" a "`}"
 %subst char a    	= "\text{\tt ''" a "''}"
 %subst string a  	= "\text{\tt \char34 " a "\char34}"
 %format _          = "\anonymous "
@@ -331,6 +334,7 @@
 %format ||         = "\mathrel{\vee}"
 %format >>         = "\sequ "
 %format >>=        = "\bind "
+%format =<<        = "\rbind "
 %format $          = "\mathbin{\$}"
 %format `seq`      = "\mathbin{\Varid{`seq`}}"
 %format !          = "\mathbin{!}"
diff --git a/lhs2TeX.sty.lit b/lhs2TeX.sty.lit
--- a/lhs2TeX.sty.lit
+++ b/lhs2TeX.sty.lit
@@ -118,6 +118,7 @@
 %endif
 \newcommand{\plus}{\mathbin{+\!\!\!+}}
 \newcommand{\bind}{\mathbin{>\!\!\!>\mkern-6.7mu=}}
+\newcommand{\rbind}{\mathbin{=\mkern-6.7mu<\!\!\!<}}% suggested by Neil Mitchell
 \newcommand{\sequ}{\mathbin{>\!\!\!>}}
 %if not standardsymbols
 \renewcommand{\leq}{\leqslant}
@@ -175,6 +176,8 @@
 \setlength{\blanklineskip}{1mm}
 
 \newcommand{\hsindent}[1]{\quad}% default is fixed indentation
+\let\hspre\empty
+\let\hspost\empty
 %endif
 \end{code}
 
@@ -186,8 +189,8 @@
 \newcommand{\NB}{\textbf{NB}}
 \newcommand{\Todo}[1]{$\langle$\textbf{To do:}~#1$\rangle$}
 
-\makeatother
 \EndFmtInput
+\makeatother
 \end{code}
 
 \begin{code}
diff --git a/lhs2tex.cabal b/lhs2tex.cabal
--- a/lhs2tex.cabal
+++ b/lhs2tex.cabal
@@ -1,6 +1,6 @@
-cabal-version:  >=1.1.6
+cabal-version:  >=1.2
 name:		lhs2tex
-version:	1.12
+version:	1.13
 license:	GPL
 license-file:	LICENSE
 author:		Ralf Hinze <ralf@informatik.uni-bonn.de>, Andres Loeh <lhs2tex@andres-loeh.de>
@@ -9,7 +9,17 @@
 homepage:	http://www.andres-loeh.de/lhs2tex/
 package-url:	http://www.andres-loeh.de/lhs2tex/lhs2tex-1.11.tar.gz
 synopsis:	Preprocessor for typesetting Haskell sources with LaTeX
-build-depends:	base, regex-compat
+description:	Preprocessor for typesetting Haskell sources with LaTeX
+category:       Development, Language
+build-type:     Custom
 
-executable:	lhs2TeX
-main-is:	Main.lhs
+flag splitBase
+  description:	Choose the new smaller, split-up base package.
+
+executable lhs2TeX
+  main-is:	Main.lhs
+  if flag(splitBase)
+    build-depends:	base >= 3, regex-compat, mtl, filepath, directory, process
+  else
+    build-depends:	base < 3, regex-compat, mtl, filepath
+
