## [033f9d]: Sumatra / EN / How_to_Sumatra_EN.tex Maximize Restore History

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 \documentclass[parskip=half-]{scrartcl} \usepackage[UKenglish]{babel} %\usepackage{libertine} \usepackage{mathptmx} \usepackage[T1]{fontenc} \usepackage[latin1]{inputenc} \usepackage{tikz} \usepackage{hyperref} \title{TeXnicCenter with Sumatra PDF} \author{Based on a tutorial by\\ Martin Hehn\thanks{martin.hehn@manchester.ac.uk}\\ Updated and corrected by\\ Benjamin Danowski\thanks{benjamin.danowski@web.de}} \begin{document} \maketitle \tableofcontents \section{Short Introduction} This tutorial describes the use of Sumatra PDF viewer (v 1.2) in combination with TeXnicCenter (v 1.0). After successful setup Sumatra PDF recognizes changes in the PDF file which results from repeated compilation in TeXnicCenter (TC) and updates its document view automatically. You do not have to close and restart the program by hand every time. By pressing the F5 button in TC Sumatra PDF shows the page and the section the cursor resides in. Sumatra comes to the front by doing this.\\ \textbf{Please note:} Currently forward search only works if the file name and its whole path do not contain spaces! A double click in Sumatra PDF should place TCs cursor to the corresponding section. TC comes to the front by doing this. \section{Software} \begin{description} \item[Sumatra] Download Sumatra PDF 1.2 at \url{http://blog.kowalczyk.info/software/sumatrapdf/index.html} \item[TeXnicCenter] Download the latest release (v 1.0). The alpha releases are also working fine. (\url{http://www.texniccenter.org/}) \item[Distribution] It is assumed that you have a \LaTeX\ distribution already installed, e.g. MiKTeX 2.9 (\url{http://miktex.org/}).\\ TeX Live 2008 (\url{http://www.tug.org/texlive/}) also does the job. However, TeX Live 2008 is distributed with a buggy version of the \texttt{SyncTeX} parser, therefore you have to update the following files: \begin{itemize} \item \texttt{pdftex.dll}, \item \texttt{pdftex.exe} und \item \texttt{kpathseaxxx.dll} \end{itemize} They can be downloaded at \url{http://www.tug.org/svn/texlive/trunk/Master/bin/win32/}. \texttt{xxx} stands for a 3-digit number. If you have downloaded a wrong version, you will notice it. After this you want to update the format files by using the TeX Live manager.\\ If you have information about TeX Live 2010 please do not hesitate to tell me your findings. \end{description} \section{Settings in Sumatra PDF} Since version 0.9.4 no changes are neccessary. The command line is delivered by TC. If you made a mistake it could be neccessary to delete the configuration file in the Sumatra PDF folder and the \texttt{.synctex} file corresponding to your source file. %Open up Sumatra and go to: %\begin{tikzpicture} %\node (a) at (0,0) {\texttt{File}}; %\node (b) at (5,-1) {\texttt{Set inverse search command-line}}; %\node (c) at (0,-1) {}; %\draw [-] (a.south) -- (c.center) -- (b.west); %\end{tikzpicture} %Insert the following code (Path names may vary):\\ %\verb+"C:\Programme\TeXnicCenter\TEXCNTR.EXE" /ddecmd "[goto('%f','%l')]'"+ \section{Settings in TeXnicCenter} It is useful to define an extra output profile for Sumatra: \begin{tikzpicture} \node (a) at (0,0) {\texttt{Build}}; \node (b) at (5,-1) {\texttt{Define output profiles}}; \node (c) at (0,-1) {}; \draw [-] (a.south) -- (c.center) -- (b.west); \end{tikzpicture} \begin{enumerate} \item Click in the existing profile \texttt{LaTeX$=>$PDF} \item Click \texttt{Copy} \item Name the new profile, e.g. \texttt{LaTeX$=>$PDF (Sumatra)} \end{enumerate} Check that the new profile is highlighted. There are three tabs: \texttt{(La)Tex}, \texttt{Postprocessor} and \texttt{Viewer}. \textbf{(La)Tex}\\ Quickly check if the compiler path is correct (path names may vary)\\ \verb+"C:\Program Files\MiKTeX 2.7\miktex\bin\pdflatex.exe"+ At \texttt{Command line arguments to pass to the compiler} insert the following\\ \verb+-synctex=-1 -interaction=nonstopmode "%Wm"+ \textbf{Postprocessor}\\ No settings required. \textbf{Viewer}\\ At \texttt{Path of executable} insert the following line (path names may vary):\\ \verb+"C:\Program Files\SumatraPDF\SumatraPDF.exe" -inverse-search+\\ \verb+"\"C:\Program Files\TeXnicCenter\TEXCNTR.EXE\" /ddecmd \"[goto('%f','%l')]\""+ \textbf{NOTE:} There is a space after \texttt{search}, the command was just split into two lines to fit on the page. Furthermore, please do not forget to include the quotation marks if you have spaces in the pathname (e. g. Program Files'' on English systems). At \texttt{View project's output} set the radiobutton to \texttt{Command line argument} For \texttt{Command:} enter:\\ \verb+[Open("%bm.pdf",0,1,1)]+ At \texttt{Forward search} set the radiobutton to \texttt{DDE Command} At \texttt{Command:} insert\newline \verb+[ForwardSearch("%bm.pdf","%Wc",%l,0,0,1)]+\\ \texttt{Server:} \texttt{SUMATRA}\\ \texttt{Topic:} \texttt{Control} At \texttt{Close document before running (La)TeX} set the radiobutton to \texttt{Do not close}.\\ \\ If you like to read about the Sumatra PDF DDE commands:\\ \\ \url{http://code.google.com/p/sumatrapdf/wiki/DDEcommands} \section{Important advice} \begin{itemize} \item \textbf{Again:} Currently forward search only works if the file name and its whole path do not contain spaces! \item \textbf{Beware:} If you copy the command lines and paths from e.g. Adobe Reader an apostrophe (right) gets an accent (wrong). This breaks functionality. Therefore you have to replace the accents with apostrophes (the key above the Enter''-key).\\ However, after some feedback from users it seems to depend on the configuration of the system the viewer runs on. \item User advice also showed that a re-start of TC may be neccessary to activate the changes. So you have to find out yourself. \item Furthermore you should use \verb\include\ for embedding other \TeX files. If you use \verb\input\ you have to append the file ending (e.g. myfile.tex). \item If there is a undefined font during compilation no PDF is created with a warning that the Forward Search command could not be executed. Solution: Use another font or solve the problem. \end{itemize} \rule{40pt}{2pt}\\ Enjoy \section{Version history} 11.08.2009: First version\\ \\ 23.09.2009: Included user advice from C. Wiethoff concerning re-start and copy\&paste behaviour of existing PDF viewers. Included advice on spaces in path names.\\ \\ 01.10.2009: Got a hint from C. A. Vallejo Pinto how to change configuration so that Sumatra PDF comes to the front by pressing F5''. Added link to Sumatra PDF DDE commands. 03.03.2010: PDF viewer behaviour, minor changes, changed advise concerning \verb\include\, quotation marks in the pathname, MiKTeX 2.8, TeX Live 2009.\\ \\ 02.01.2010: New command for View project's output''. Some minor changes. Advice for unsuccessful compilation due to undefined font. Thanks for feedback! \end{document}