diff --git a/pandoc-crossref.cabal b/pandoc-crossref.cabal
--- a/pandoc-crossref.cabal
+++ b/pandoc-crossref.cabal
@@ -2,7 +2,7 @@
 -- documentation, see http://haskell.org/cabal/users-guide/
 
 name:                pandoc-crossref
-version:             0.1.2.3
+version:             0.1.2.4
 synopsis:            Pandoc filter for cross-references
 description:         pandoc-crossref is a pandoc filter for numbering figures, equations, tables and cross-references to them.
 license:             GPL-2
@@ -23,7 +23,7 @@
 source-repository this
   type: git
   location: https://github.com/lierdakil/pandoc-crossref
-  tag: v0.1.2.3
+  tag: v0.1.2.4
 
 executable pandoc-crossref
   main-is:             pandoc-crossref.hs
diff --git a/src/References/List.hs b/src/References/List.hs
--- a/src/References/List.hs
+++ b/src/References/List.hs
@@ -2,6 +2,7 @@
 
 import Text.Pandoc.Definition
 import Control.Monad.State
+import Control.Arrow
 import Data.List
 import qualified Data.Map as M
 
@@ -12,21 +13,29 @@
 listOf :: Options -> [Block] -> WS [Block]
 listOf Options{outFormat=f} x | isFormat "latex" f = return x
 listOf opts (Para [RawInline (Format "tex") "\\listoffigures"]:xs)
-  = gets imgRefs >>= makeList (lofTitle opts) xs
+  = gets imgRefs >>= makeList opts lofTitle xs
 listOf opts (Para [RawInline (Format "tex") "\\listoftables"]:xs)
-  = gets tblRefs >>= makeList (lotTitle opts) xs
+  = gets tblRefs >>= makeList opts lotTitle xs
 listOf opts (Para [RawInline (Format "tex") "\\listoflistings"]:xs)
-  = gets lstRefs >>= makeList (lolTitle opts) xs
+  = gets lstRefs >>= makeList opts lolTitle xs
 listOf _ x = return x
 
-makeList :: [Block] -> [Block] -> M.Map String RefRec -> WS [Block]
-makeList title xs refs
+makeList :: Options -> (Options -> [Block]) -> [Block] -> M.Map String RefRec -> WS [Block]
+makeList opts titlef xs refs
   = return $
-      title ++
-      OrderedList style (item `map` refsSorted)
+      titlef opts ++
+      (if sepChapters opts
+        then Div ("", ["list"], []) (itemChap `map` refsSorted)
+        else OrderedList style (item `map` refsSorted))
       : xs
   where
     refsSorted = sortBy compare' $ M.toList refs
     compare' (_,RefRec{refIndex=i}) (_,RefRec{refIndex=j}) = compare i j
     item = (:[]) . Plain . refTitle . snd
+    itemChap = Para . uncurry ((. (Space :)) . (++)) . (numWithChap . refIndex &&& refTitle) . snd
+    numWithChap (c,i)
+      | c > 0 = s c : chapDelim opts ++ [s i]
+      | otherwise = [s i]
+      where
+        s = Str . show
     style = (1,DefaultStyle,DefaultDelim)
diff --git a/src/Util/ModifyMeta.hs b/src/Util/ModifyMeta.hs
--- a/src/Util/ModifyMeta.hs
+++ b/src/Util/ModifyMeta.hs
@@ -45,7 +45,9 @@
         codelisting = [
             "\\usepackage{float}"
           , "\\floatstyle{ruled}"
-          , "\\newfloat{codelisting}{h}{lop}"
+          , "\\makeatletter"
+          , "\\@ifundefined{c@chapter}{\\newfloat{codelisting}{h}{lop}}{\\newfloat{codelisting}{h}{lop}[chapter]}"
+          , "\\makeatother"
           , "\\floatname{codelisting}{"++metaString "listingTitle"++"}"
           ]
         lolcommand
