title: Set path to miktex for pdflatex in R
body: <p>I have been trying to get pdflatex to use the correct version of miktex and have not been successful.</p>
  
  <p>I have set the R Path  to have the correct location of Miktex 2.9, and verified that it worked with: </p>
  
  <pre><code>Sys.getenv("PATH")
  "C:\\Program Files\\MiKTeX 2.9\\miktex\\bin\\x64\\pdflatex;..." 
  </code></pre>
  
  <p>However when i look at the version of miktex that pdflatex is using: </p>
  
  <pre><code>Sys.which("pdflatex")
  "C:\\PROGRA~1\\MIKTEX~1.9\\miktex\\bin\\x64\\pdflatex.exe"
  </code></pre>
  
  <p>This 1.9 path is to an old version of miktex that no longer even exists. </p>
  
  <p>Running in the command prompt which pdflatex returns the correct path, so the problem is just in R. How can I get R to use the correct path to pdflatex?</p>