title: Using listings, how do I maintain grouping of listing numbers?
body: <p>I'm using the <code>listings</code> package for showing code, as well as algorithms in pseudocode.</p>
  
  <p>This is what I would like happen:</p>
  
  <pre><code>Algorithm 1.1: myFirstAlgorithm()
      ... content ...
  Algorithm 1.2: mySecondAlgorithm()
      ... content ...
  Code 1.1: My First Code Block
      ... content ...
  Algorithm 1.3: myThirdAlgorithm()
      ... content ...
  </code></pre>
  
  <p>While this is what I get:</p>
  
  <pre><code>Algorithm 1.1: myFirstAlgorithm()
      ... content ...
  Algorithm 1.2: mySecondAlgorithm()
      ... content ...
  Code 1.3: My First Code Block
      ... content ...
  Algorithm 1.4: myThirdAlgorithm()
      ... content ...
  </code></pre>
  
  <p>To change the caption name, I'm using <code>\renewcommand*{\lstlistingname}{Code}</code> and <code>\renewcommand*{\lstlistingname}{Algorithm}</code>.</p>
  
  <p>There might be a better way to do this, but in any case I'm still clueless as to how to reset the numbering, or how to keep track of grouping. Any help would be greatly appreciated.</p>