# GNU Octave, LaTeX, and Notepad++

## Background

We will be focusing on GNU Octave as the default programming language to perform most of the numerical computations for this course. Octave is free and open and is very compatible with its popular (non-free) commercial alternative MATLAB.

We will also be focusing on LaTeX to typeset our mathematical results. Since both Octave and LaTeX take plain text as input, any text editor (e.g., Notepad, Wordpad, etc.) may be used to provide this input. However, Notepad++ is a free and open text editor designed specifically for programming, and it supports syntax highlighting for both Octave/MATLAB and LaTeX.

Octave 3.0.0 – Windows installer for Octave

MiKTeX 2.7.2904 – Windows TeX distribution

SumatraPDF 0.8 – Fast minimalistic PDF viewer

Notepad++ 4.7.3 – Text editor for Octave and LaTeX

## GNU Octave

Octave is a high-level programming language primarily intended for numerical computations. A “complete” installation of Octave includes its core as well as many extra packages. A Windows installer may be obtained at Octave-Forge. This installer contains the core as well as these extra packages.

The default working directory for Octave 3.0.0 for Windows is subordinate to Octave's installation directory. However, most users prefer to start in their "My Documents" directory. One method for getting Octave to start in one's "My Documents" directory is to change the startup shortcut. To do this, right-click on the shortcut and choose "Properties". From there, shortcut tab should look like

In particular, the "Target" command should be something like

`"C:\Program Files\Octave\tools\console\Console.exe"`

To have Octave start in one's "My Documents" directory, simply append

`-d "%HOMEDRIVE%%HOMEPATH%\My Documents"`

to this command. That is, the "Target" command would then be

`"C:\Program Files\Octave\tools\console\Console.exe" -d "%HOMEDRIVE%%HOMEPATH%\My Documents"`

and the shortcut tab should then look like

## MiKTeX

MiKTeX is an up-to-date TeX distribution for Microsoft Windows. One of its best features is its "install on demand" feature for needed packages. MiKTeX contains all of the backend tools (including LaTeX and/or PDFLaTeX) needed to perform TeX based typesetting.

## SumatraPDF

The primary reason (other than speed) for using a PDF viewer such as SumatraPDF is that Adobe's Acrobat Reader takes control of the PDF and will not let another application (even the one that created the PDF) write to it. This is a problem since typesetting with LaTeX is often performed in a manner that uses successive compilations of the source file, and one may wish to see the changes by quickly reloading the PDF in place instead of closing the PDF, reopening, and navigating to the desired position in the document.

One may still wish to view the PDF using Adobe's Acrobat Reader since most users view PDF's with this application. That is, if one wishes to share his/her PDF, it should look the same to the sharer and receiver if they are using the same application to view it. One may also wish to print the PDF using Adobe's Acrobat Reader since its printing facilities may be more reliable.

Notepad++ is nice enough without any additional configuration; however, in order to take better advantage of this power, it should be configured to execute command(s) for typesetting.

In order to setup a Run command in Notepad++, simply press F5 (or select Run → Run...). A box like one below should appear.

In order to configure PDFLaTeX, simply enter the command

cmd /c cd /d "\$(CURRENT_DIRECTORY)" && pdflatex.exe -shell-escape "\$(FILE_NAME)"

and select "Save" (like in the box below).

Then enter PDFLaTeX for the Name, and then select a hotkey (or shortcut) to run PDFLaTeX. The box below illustrates this using ALT+F1 as the hotkey.

After selecting "OK" and "Cancel"ing the previous box, PDFLaTeX can be executed on the opened LaTeX file simply by pressing the ALT+F1 key combination. Below is a table illustrating several suggested commands as well as potential hotkey combinations.

 Program/Command Name Hotkey cmd /c cd /d "\$(CURRENT_DIRECTORY)" && pdflatex.exe -shell-escape "\$(FILE_NAME)" PDFLaTeX ALT+F1 "C:\Program Files\SumatraPDF\SumatraPDF.exe" "\$(CURRENT_DIRECTORY)\\$(NAME_PART).pdf" SumatraPDF ALT+F2 acrord32 "\$(CURRENT_DIRECTORY)\\$(NAME_PART).pdf" Acrobat Reader ALT+F3 "C:\Program Files\Octave\tools\console\console.exe" -d "\$(CURRENT_DIRECTORY)" Octave ALT+F5