title: Select only some items from a list in LaTeX
body: <p>I have a LaTeX document which is basically one big <code>enumerate</code> environment, with a few hundreds of items. I want to be able to issue a command like</p>
  
  <pre><code>\printitems{2,5,12,45-48}
  </code></pre>
  
  <p>which will output only the requested items.</p>
  
  <p>A similar command <code>\onlyslides</code> is a part of <code>slides.cls</code>, but I cannot figure out what goes on there and adapt it to my needs. </p>
  
  <p>I can replace the list of <code>item</code>'s with a list of environments, like</p>
  
  <pre><code>\begin{myitem}
  ...
  \end{myitem}
  
  \begin{myitem}
  ...
  \end{myitem}
  </code></pre>
  
  <p>with a <code>\newcounter</code> etc. if it helps to achieve my purpose &mdash; being able to print only some items with given numbers without cut-and-pasting. I can have the items in one file, and the <code>\printitems</code> command in another, if needed.</p>
  
  <p>I can not put the numbers in the file &mdash; the file is constantly changing, and I need the automatic enumeration.</p>