Dealing with TeXnicCenter and PDF’s (in short: use sumatra)

TeXnicCenter logoSo, I have just spend a while struggling with understanding why my present TeXnicCenter installation won’t open files in Adobe Acrobat Reader X – it has, for years, worked on and off, with no apparent reason for being in either state. Once upon a time, a simple reboot would allow me to once again access the pdf-output directly.

 However, those days are gone and I decided to actively try to understand the issue.
 After having googled far and wide, I discovered a very interesting discussion at adobe’s website:
the short version is that when we get the well-known message 
“Cannot execute the command: [DocOpen(“%bm.pdf”)][FileOpen(“%bm.pdf”)]”
we should press alt+f7, go to the latex->pdf profile, under viewer, and change “server” from 
“acroview” to “acroviewR10”. At least if we are using Reader 10 (as I am, at present). The forum discussion also informs us that in the future this name will change with the version, so a Reader XI will require acroviewR11 and so forth. 
 Interesting… The nice people at the  TeXnicCenter project have informed me that the next version will feature a wizard which figures this out by itself.
However, I find that even when this, very important, detail is sorted out, I still do not have access to “Forward Search”, meaning that the pdf-file is opened in the place that I am presently editing. Looking a bit deeper into the issue, I get the impression that this will never work, because the DDE-command that Acrobat Reader will accept (DocGoto, as detailed here) expects as page-number, while it seems TeXnicCenter will only supply a line-number (but I am by no means learned in the ways of DDE, so it may just be me doing it wrong).
 Even if that was solved, we would still not have reached the end of the matter, though, since even if it did work, we would still be missing out on “Inverse Search”, meaning that the viewer can point me back to the place in tex-file that a specific word is written (or, rather, a paragraph). Both of these feature are incredibly handy, especially if you have ever done a large project in pdf and have had to repeatedly scroll down 20+ pages to see if the figure you just added looks right. 
It will do all of the above, and how to make it happen is explained here: Because I’m a relatively cautious one, and I have no idea if that blog will be up forever (or as long as this one, anyway), I’ll just copy-paste the important bits: 
To configure TeXnicCenter to view document output using Sumatra PDF:
The Sumatra PDF viewer integrates nicely with TeXnicCenter supporting both forward-search and inverse-search. 

  1. Run TeXnicCenter.
  2. Select Build | Define Output Profiles | (La)Tex Tab
    1. Select Add to add a new profile.
      Enter the profile name:  Latex => PDF (Sumatra)
  3. Under the (La)TeX Tab
    1. Select the checkbox:  Run (La)TeX compiler
      1. Path to the latex compiler:
        C:\software\MiKTeX 2.8\miktex\bin\pdflatex.exe
        Note: The path references may be different on your computer.
      2. Command line arguments to pass to the compiler:
        -interaction=nonstopmode “%pm” -synctex=-1
    2. Unselect the checkbox:  Do not use BibTeX in this profile
      1. Path to BibTeX executable:
        C:\software\MiKTeX 2.8\miktex\bin\bibtex.exe
      2. Command lne arguments to pass to BibTeX:
    3. Unselect the checkbox:  MakeIndex
      1. Path to MakeIndex executable:
        C:\software\MiKTeX 2.8\miktex
        Note: The path should be on one line, I split the path here to ensure it displays clearly.There should be no space  at the line break between miktex and \bin.
      2. Command line arguments to pass to MakeIndex:
  4. The Postprocessor tab may be left blank.
  5. Under the Viewer Tab:
    1. Path to executable:
      -inverse-search “\”C:\software\TeXnicCenter\TEXCNTR.EXE\”
      /ddecmd \”[goto(‘%f’,’%l’)]\””
      Note: The path should be on one line, I split the path here to ensure it displays clearly.  There should be a space inserted at the position of the line breaks:
      • one space after SumatraPDF.EXE
      • another space after TEXCNTR.EXE\
    2. For View project’s output:
      1. Enable Command line argument
      2. Command: “%bm.pdf”
    3. For Forward Search: 
      1. Enable DDE command:
      2. Command:[ForwardSearch(“%bm.pdf”,”%Wc”,%l,0)]
      3. Server: sumatra
      4. Topic: control
    4. For Close document before running (La)Tex
      1. Enable Do not close.
I hope this was of some help =)