title: LaTeX: how to use a required arg as the default for an optional one?
body: <p>I'm trying to create a LaTeX command with two arguments, one of them optional. Normally I'd do this as</p>
  
  <pre><code>\newcommand{\whatever}[2][default]{first #1 second #2}
  </code></pre>
  
  <p>where <code>default</code> is the default value for the first argument. But for this command I want the value of the second argument to be used as the default value for the first argument - that is, I want</p>
  
  <pre><code>\whatever{blah}
  \whatever{foo}
  \whatever[lol]{rofl}
  </code></pre>
  
  <p>to be equivalent to</p>
  
  <pre><code>\whatever[blah]{blah}
  \whatever[foo]{foo}
  \whatever[lol]{rofl}
  </code></pre>
  
  <p>Does anyone know how to do this? I can drop down to plain TeX if necessary.</p>