How to Install a Full MiKTeX LaTeX Installation and configure TeXnicCenter on Windows XP, Windows Vista and Windows 7

TeXnicCenter LogoThe purpose of this article is to outline in concise form the steps required to install and configure a full LaTeX distribution from scratch up to the point of editing documents in LaTeX on a Windows PC.  Furthermore, I will show you how to integrate the LaTeX editor with the PDF viewer to enable you to switch seamlessly between them while creating your documents.

The LaTeX editor employed here is the free open source TeXnicCenter editor which provides all the functionality you need to create, write, build, view and print your LaTeX documents.

Adobe Reader iconPlease ensure you have a PDF viewer already installed before commencing the steps below.  This article will provide instructions on how to configure and integrate two PDF viewers with our LaTeX editor: the free open source PDF viewer Sumatra PDF and the freeware Adobe Acrobat Reader.  You may install either one (or both if you wish).

This article provides instructions for the following platforms: Windows XP, Windows Vista and Windows 7.

  1. Download and run the free open source MiKTeX Net Installer setup-2.X.xxxx.exe from the MiKteX download page. The MiKTeX installation consists of two phases:  the first phase will download the MiKTeX distribution to your PC, the second phase will perform the actual installation.  Once the download operation has finished, the first phase is complete and you are ready to install MiKTeX.  It is recommended to download the latest stable version.  At the time of writing, the latest stable version is 2.9.
  2. To perform the second phase of the installation, start Windows Explorer and browse to the directory which contains the complete MiKTeX distribution (where you downloaded it). Look for a file named setup.exe.   This is the MiKTeX Setup application.  Run setup.exe by double-clicking its icon.  When asked to select a repository folder, select the location of the downloaded MiKTeX distribution. Please be patient as the installation may take quite some time to complete.
  3. Update the MiKTeX Installation:
    From the Start menu, 

    1. On Windows XP:
      select  Start | Programs | MiKTeX 2.X | Update
    2. On Windows Vista or Windows 7:
      select  Start | Programs | MiKTeX 2.X | Maintenance (Admin) | Update (Admin)
    3. Select the option:
      I want to get updated packages from a remote package repository
      and the option:
      Let me choose a remote package repository
      and select the repository nearest you.
    4. Follow the onscreen instructions.
  4. Update the MiKTeX Package Manager:
    From the Start menu, 

    1. On Windows XP:
      select Start | Programs | MiKTeX 2.X | Settings
    2. On Windows Vista or Windows 7:
      select  Start | Programs | MiKTeX 2.X | Maintenance (Admin) | Settings (Admin)
    3. Select the option Refresh FNDB
    4. Select the option Update Formats
    5. Exit the application by clicking Ok.
  5. Install TeXnicCenter:
    1. Download the latest version of TeXnicCenter from http://www.texniccenter.org
    2. Run the TeXnicCenter installer and follow the onscreen instructions.
  6. Configure TeXnicCenter’s initial settings:
    1. When running TeXnicCenter for the first time, follow the onscreen instructions.
    2. Close and rerun TeXnicCenter.
    3. Select Tools | Options | Editor Tab
      Enable display line numbers
  7. If you are running Windows Vista or Windows 7:
    1. Configure the TeXnicCenter application to run as an administrator.
    2. Configure the TeXnicCenter application to run in compatibility mode: Windows XP SP3.
    3. If you will use Sumatra PDF as your PDF viewer, configure the Sumatra PDF application to run in compatibility mode: Windows XP SP3.
  8. A brief explanation of terminology concerning Integration features between TeXnicCenter and the PDF viewers is now required.
    Several PDF viewers support the concept of Forward-Search and Inverse-Search. 

    • What is Forward-Search?: When compiling (generating PDF output) your LaTeX source document in TeXnicCenter, Forward-Search enables the current editing location in the source latex file to be displayed and highlighted in the generated PDF.  For example, if you are editing text that appears on page 8 of the PDF; after compiling the LaTeX source, the PDF viewer will open the document and jump directly to page 8 to display the text you have just edited.  This is a great timesaver.  The communication between the editor and PDF viewer often relies on the DDE protocol.
    • What is Inverse-Search?: Inverse-Search is a synchronisation feature whereby doubling-clicking on a line in the PDF document will switch to the LaTeX editor and display the corresponding line in the document source.  Again, another great timesaver.
    • Adobe Reader and Adobe Acrobat:
      Forward-Search and Inverse-Search may not work with adobe Reader version 8 or higher (i.e.: all recent versions).
    • Sumatra PDF Viewer:
      Forward-Search and Inverse-Search function correctly using Sumatra PDF on Windows XP SP3, Windows Vista and Windows 7. This author’s preference is to use the Sumatra PDF viewer to view the document during the creation and editing phases, and only use Adobe Reader to view the final completed document to verify the final document version appears correctly when viewed with Adobe Reader.
      Note 1: At present (TeXnicCenter v1.0 and Sumatra V1.3), forward search only works if the file name and entire file path do not contain spaces!

      Note 2: Be aware that cutting and pasting the configuration information that appears in the subsequent steps from this webpage directly into the TeXnicCenter configuration panel may not work.  The double-quotes (and single-quotes) are often misrepresented.
  9. To configure TeXnicCenter to view document output using Adobe Reader:
    1. Run TeXnicCenter.
    2. Select Build | Define Output Profiles | Viewer Tab
    3. Ensure the profile selected is LaTeX => PDF
      For both View Project’s Output and Forward Search options, enter the following: 

      1. Enable DDE
      2. Command: [DocOpen(“%bm.pdf”)][FileOpen(“%bm.pdf”)]
      3. Server: acroview
      4. Topic: control
    4. For Close Document before running LaTeX:
      1. Enable DDE
      2. Command: [DocClose(“%bm.pdf”)]
      3. Server: acroview
      4. Topic: control
  10. 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:
          “%bm”
      3. Unselect the checkbox:  MakeIndex
        1. Path to MakeIndex executable:
          C:\software\MiKTeX 2.8\miktex
          \bin\makeindex.exe
          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:
          “%bm”
    4. The Postprocessor tab may be left blank.
    5. Under the Viewer Tab:
      1. Path to executable:
        C:\software\SumatraPDF\SumatraPDF.exe
        -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.
  11. Well Done!  You are now ready to create beautifully typesetted PDF documents.  Enjoy!

References

Ubuntu 9.10 (karmic koala) – How to Customize Themes and Appearance after a New Installation

Screenshot of Ubuntu 9.10 Desktop

Screenshot of my desktop

Note: this article is an updated version of an earlier article I wrote detailing how to customize Ubuntu 9.04 (Jaunty Jackalope).

Ubuntu 9.10 (karmic koala) is a fine exhibition of a solid, stable and powerful open-source operating system.

There is one facet where it is good but could be somewhat better – the built-in default themes and general appearance from icons to desktop wallpapers. However its weakness is ironically its strength in that the open-source community have provided a host of excellent and high quality supplementary material that is available for free.

The first port of call for the curious is Gnome-Look.Org

I will outline below in concise form the customizations I have made to the default themes and appearance that come with a vanilla Ubuntu 9.10 installation. Needless to say, these are a reflection of personal taste and thus are provided for reference only for those who wish to investigate further.

Customizing the Theme

It has been my experience upon spending a considerable amount of time on a computer that a dark-ish theme tends to be easier on the eyes. To that end I installed the Ubuntu Exotic Theme located at the Bisigi Project. The Bisigi Project has several very beautiful themes that I would recommend to all. I chose the Ubuntu Exotic Theme in particular because of the combination of a dark window title bar and gentle grey menu bar and the beautiful clean set of system wide icons. However, the default background image that comes with this theme is a little too bright for my taste and so I choose a different background. More information on the background appears further on.

The installation instructions for the Ubuntu Exotic theme are available  at the author’s site but I shall briefly outline them here.

  1. Edit your software repository’s remote location list:
    In a terminal (from the Menu bar, select Applications | Accessories | Terminal)
  2. sudo gedit /etc/apt/sources.list

  3. Add the following lines to the bottom of the file. Then save the file and exit the editor.
  4. ## Project Bisigi Ubuntu Themes
    deb http://ppa.launchpad.net/bisigi/ppa/ubuntu karmic main
    deb-src http://ppa.launchpad.net/bisigi/ppa/ubuntu karmic main

  5. In a terminal, run the following command:
  6. sudo gpg --keyserver hkp://keyserver.ubuntu.com:11371 --recv-key 881574DE && gpg -a --export 881574DE | sudo apt-key add -

  7. Now update the local package repository reference database with the newly referenced packages.
  8. sudo aptitude update

  9. To install the Ubuntu Exotic Theme:
  10. sudo aptitude install exotic-theme

  11. To install all of the themes available at the Bisigi Project:
  12. sudo aptitude install bisigi-themes

  13. To activate the Ubuntu Exotic Theme – from the menu bar select System | Preferences | Appearance
    Under the Themes Tab:

    • Scroll through the list of themes and select Murrine Exotic
    • Do not select Apply Background
    • Exit by selecting Close

The Background Image

Dm-Intrepid Desktop Wallpaper

Dm-Intrepid Desktop Wallpaper

The background image I use is taken from the DM Intrepid GDM 1.0 theme available at Gnome Look.Org. I feel this image complements the Ubuntu Exotic theme nicely.

You may view the full image by clicking on the thumbnail and then right-click to save the image.

To change the desktop wallpaper, right-click on any clear section of the desktop and select Change Desktop Background.

Icon Shortcuts

I have placed several icon-shortcuts on the System Panel (the default location for the System Panel in Gnome is the top of the screen). The most useful shortcuts are for the terminals. I use two types – the Gnome-terminal and the Xterm.

There are several ways to add a shortcut to the System Panel:

  • Drag and drop an application icon from the desktop to the panel
  • Right-Click on the panel and choose Add to Panel. A list of preset applications is presented. To create your own icon (as we will below) choose Custom Application Launcher.

Gnome-Terminal

Depending on what tasks need to be accomplished I have configure both half-screen-length and full-screen-length terminals.

The settings (properties) for the gnome-terminal launcher on the System panel are below. The geometry settings (AAxBB) determine the width and length of the terminal on the screen. Adjust the BB parameter to according to your display settings and resolution to be half length or full length.

Type: Application
Name: Gnome-Terminal
Command: gnome-terminal --geometry=80x55
Full-Length-Icon: /usr/share/icons/gnome/scalable/devices/chardevice.svg
Half-Length-Icon: /usr/share/icons/exotic/scalable/apps/gnome-terminal.png

Xterm Terminal

The settings (properties) for the Xterm terminal launcher on the System panel are similar.

Type: Application
Name: XTerm
Command: xterm -geometry 80x72
Full-Length-Icon: /usr/share/icons/hicolor/scalable/apps/gnome-display-properties.svg
Half-Length-Icon:/usr/share/icons/hicolor/scalable/apps/gnome-panel-launcher.svg

References

How to Customize Firefox 3.6 into a Blazing Fox

firefox-icon

Firefox is a great browser.

However, like all great things, it can be made better.
The following is a list of the addons I have installed and some customizations I have made to Firefox to make it blaze.

Addons Installed

  • Quickdrag – probably the most useful pluggin of all.
    (Note: Customize the preferences to open clickable links in new tabs).
    Open a link in a new tab by simply dragging it.
    Highlight some words and drag to auto-search them in google.
  • Adblock Plus – block pesky adverts.
  • Download Statusbar – easily manage your downloads.
  • Add Bookmark Here 2. – easily add new bookmarks.
  • All-in-One Sidebar – slim sidebar access.
  • CustomizeGoogle – improve your googling experience.
  • PDF Download – prompt to view or save PDFs.
  • Close Tab by Double Click.
  • Xmarks – Synchronize your bookmarks.
  • BetterPrivacy – Cleans Flash cookies and other tracking mechanisms.

Customizations

The remainder of this article outlines some of the customizations I have made to Firefox.

At several points, I make reference to entering about:config into the Firefox address bar.  The about:config address presents a webpage whereby a user may manually edit their individual user preferences.  However there are hundreds of entries.  To locate a particular entry, enter (some or all of) the text into the filter address bar.   A simple overview illustrating how to customize user preferences via about:config is available at Mozillazine. For the more curious minded, detailed coverage of about:config is presented in a Computerworld article.

Close Button on last Tab

In Firefox 3.6, the close button is no longer displayed on the lab tab (when there is only one tab open).
An attempt to close the last tab using the keyboard shortcut Ctrl-W closes down Firefox.  This behavior is not always desirable.

  • To display the close button on a tab always, place the following code in the UserChrome.css file.

.tabbrowser-tabs[closebuttons="alltabs"] > .tabbrowser-tab > .tab-close-button {
display: -moz-box !important;
}
.tabbrowser-tabs:not([closebuttons="noclose"]):not([closebuttons="closeatend"]) > .tabbrowser-tab[selected="true"] > .tab-close-button {
display: -moz-box !important;
}

  • To ensure the keyboard shortcut Ctrl-W closes only the tab and not the entire Firefox application:
    Enter the address about:config into the Firefox address bar and set:

        browser.tabs.closeWindowWithLastTab = False.

Quick Searches

Firefox 3.6 adds new functionality called quick searches.  The lifehacker website provides a good article detailing what they are and how to create new ones.

Single Click Select of URL in Address bar

To enable/disable the single click select of the URL in the address bar:

browser.urlbar.clickSelectsAll = True | False

Speed up browsing the internet

To speed up the Firefox network browsing speed, change the following settings:

network.http.max-connections 30 to 96
network.http.max-connections-per-server 15 to 32
network.http.max-persistent-connections-per-server 6 to 8
network.http.pipelining false to true
network.http.proxy.pipelining false to true
network.http.pipelining.maxrequests 4 to 6
network.http.pipelining.ssl false to true
network.http.proxy.pipelining false to true
network.dns.disableIPv6 false to true
network.http.request.max-start-delay 10 to 5

Speedup Firefox by compacting its (and other Mozilla-based) databases

*This tip is only for advanced users.

Firefox uses sqlite databases to store bookmarks, internet history, download history, cookie history, anti-phishing websites, and so on. They facilitate fast searching, quick performance and in particular data integrity.

However, overtime and with consistent usage these database files grow bigger and bigger.  Firefox does not regularly compact them.  Thus, in the long term they can slow down your browsing.

The solution is to compact the databases which removes old, deleted and redundant data.  The sqlite databases are located in the Firefox profile folder and are files with the extension .sqlite. They may be compacted using the sqlite command tool sqlite3.

Generically, the solution is to close Firefox down first (important!) and then run the following command:
sqlite databasename.sqlite "VACUUM"
Linux Version:
# make sure sqlite is installed
sudo apt-get install sqlite3
# Now close firefox, open a shell and vacuum the sqlite databases
find ~/.mozilla -name "*.sqlite" -exec sqlite3 {} "VACUUM;" \;

Windows Version:
REM Download the sqlite tool.
@FOR %%G IN (*.sqlite) DO ( sqlite3 %%G "VACUUM" )

References

Ubuntu 9.04 (Jaunty Jackalope) – How to Customize Themes and Appearance after a New Installation

Screenshot of my desktop

Screenshot of My Desktop

Note: There is an updated version of this article detailing how to customize Ubuntu 9.10 (karmic koala).

Ubuntu 9.04 (Jaunty Jackalope) is a fine exhibition of a solid, stable and powerful open-source operating system.

There is one facet where it is good but could be somewhat better – the built-in default themes and general appearance from icons to desktop wallpapers. However its weakness is ironically its strength in that the open-source community have provided a host of excellent and high quality supplementary material that is available for free.

The first port of call for the curious is Gnome-Look.Org

I will outline below in concise form the customizations I have made to the default themes and appearance that come with a vanilla Ubuntu 9.04 installation.  Needless to say, these are a reflection of personal taste and thus are provided for reference only for those who wish to investigate further.

Customizing the Theme

It has been my experience upon spending a considerable amount of time on a computer that a dark-ish theme tends to be easier on the eyes.  To that end I installed the Ubuntu Exotic Theme located at the Bisigi Project.  The Bisigi Project has several very beautiful themes that I would recommend to all.  I chose the Ubuntu Exotic Theme in particular because of the combination of a dark window title bar and gentle grey menu bar and the beautiful clean set of system wide icons.  However, the default background image that comes with this theme is a little too bright for my taste  and so I choose a different background.  More information on the background appears further on.

The installation instructions for the Ubuntu Exotic theme are available in French at the author’s site but I shall briefly outline them here.

  1. Edit your software repository’s remote location list:
    In a terminal (from the Menu bar, select Applications | Accessories | Terminal)
  2. sudo gedit /etc/apt/sources.list

  3. Add the following lines to the bottom of the file. Then save the file and exit the editor.
  4. ## Project Bisigi Ubuntu Themes
    deb http://ppa.launchpad.net/bisigi/ppa/ubuntu jaunty main
    deb-src http://ppa.launchpad.net/bisigi/ppa/ubuntu jaunty main

  5. In a terminal, run the following command:
  6. sudo gpg --keyserver hkp://keyserver.ubuntu.com:11371 --recv-key 881574DE && gpg -a --export 881574DE | sudo apt-key add -

  7. Now update the local package repository reference database with the newly referenced packages.
  8. sudo aptitude update

  9. To install the Ubuntu Exotic Theme:
  10. sudo aptitude install exotic-theme

  11. To install all of the themes available at the Bisigi Project:
  12. sudo aptitude install zgegblog-themes

  13. To activate the Ubuntu Exotic Theme – from the menu bar select System | Preferences | Appearance
    Under the Themes Tab:

    • Scroll through the list of themes and select Murrine Exotic
    • Do not select Apply Background
    • Exit by selecting Close

The Background Image

Dm-Intrepid Desktop Wallpaper

Dm-Intrepid Desktop Wallpaper

The background image I use is taken from the DM Intrepid GDM 1.0 theme available at Gnome Look.Org.  I feel this image complements the Ubuntu Exotic theme nicely.

You may view the image by clicking on the thumbnail and then save the image by

To change the desktop wallpaper, right-click on any clear section of the desktop and select Change Desktop Background.

Icon Shortcuts

I have placed several icon-shortcuts on the System Panel (the default location for the System Panel in Gnome is the top of the screen).  The most useful shortcuts are for the terminals.  I use two types – the Gnome-terminal and the Xterm.

There are several ways to add a shortcut to the System Panel:

  • Drag and drop an application icon from the desktop to the panel
  • Right-Click on the panel and choose Add to Panel. A list of preset applications is presented.  To create your own icon (as we will below) choose Custom Application Launcher.

Gnome-Terminal

Depending on what tasks need to be accomplished I have configure both half-screen-length and full-screen-length terminals.

The settings (properties) for the gnome-terminal launcher on the System panel are below. The geometry settings (AAxBB) determine the width and length of the terminal on the screen. Adjust the BB parameter to according to your display settings and resolution to be half length or full length.

Type: Application
Name: Gnome-Terminal
Command: gnome-terminal --geometry=80x55
Full-Length-Icon: /usr/share/icons/gnome/scalable/devices/chardevice.svg
Half-Length-Icon: /usr/share/icons/exotic/scalable/apps/gnome-terminal.png

Xterm Terminal

The settings (properties) for the Xterm terminal launcher on the System panel are similar.

Type: Application
Name: XTerm
Command: xterm -geometry 80x72
Full-Length-Icon: /usr/share/icons/hicolor/scalable/apps/gnome-display-properties.svg
Half-Length-Icon:/usr/share/icons/hicolor/scalable/apps/gnome-panel-launcher.svg

References

How to Backup and Restore a USB pendrive (stick) in Ubuntu Linux

USB key

USB key

The following is a bash script I quickly put together to do three things:

  1. Make a full backup (low level disk image) of a USB pendrive.
  2. Perform a full restoration to a USB pendrive from a previously created backup image file.
  3. Wipe a USB pendrive with random data.

The script has two prerequisites:

  • Download and install dcfldd (free open source available from sourceforge.net).
    dcfldd is an enhanced version of GNU dd with extra features useful for forensics and security.
    The program dcfldd has one supreme advantage over the standard dd utility – Status output – dcfldd can update the user of its progress in terms of the amount of data transferred and how much longer operation will take.
  • The program must be run as root in order to access the USB device.

The script has two default values that may be overridden using the command line parameters.

  • The default backup image filename is:  USB_backup_$RIGHT_NOW.gz
    where $RIGHT_NOW has the format :  YYYY-MM-DD_HHhMMmins
  • The default path to USB device is: /dev/sdg1

#!/bin/bash
# The purpose of this script is to provide backup,
# restoration and cleaning services for a USB drive.
# There are three services provided:
# - perform a backup of a USB drive to a file
# (partition) image.
# - restore a USB drive from an file (partition) image
# - wipe a USB drive with random data.
 
function usage
{
   echo "usage: manageUSB [[-f backupfile ] [-d usbdrive] [-b] [-r] [-w]] | [-h]]"
   echo ""
   echo "   -f, --file (optional) name of backup file"
   echo "   -d, --drive (optional) name of USB drive"
   echo "   -b, --backup  perform a backup of the USB"
   echo " -r, --restore    restore a backup to the USB"
   echo "  -w, --wipe      wipe the USB with random data"
   echo ""
}
 
function backup
{
   echo "Beginning backup of USB drive..."
   dcfldd conv=notrunc,noerror bs=4096 if=$usbDrive | gzip > $backupFilename
   echo "Backup of USB drive complete."
}
 
function restore
{
   echo "Beginning restoration of USB drive..."
   gzip -dc $backupFilename | dcfldd of=$usbDrive
   echo "Restoration of USB drive complete."
}
 
function wipe
{
   echo "Wiping USB drive..."
   dcfldd bs=65536 if=/dev/urandom of=$usbDrive
}
 
## Main
 
interactive=
RIGHT_NOW=$(date +"%F_%Hh%Mmins")
backupFilename="USB_backup_$RIGHT_NOW.gz"
usbDrive=/dev/sdg1
 
while [ "$1" != "" ]; do
 case $1 in
   -f | --file )         shift
   backupFilename=$1
   ;;
   -d | --drive )     shift
   usbDrive=$1
   ;;
   -b | --backup )  backup
   exit
   ;;
   -r | --restore )  restore
   exit
   ;;
   -w | --wipe )   wipe
   exit
   ;;
   -h | --help )     usage
   exit
   ;;
   * )             usage
   exit 1
 esac
shift
done
 
if [ $# -eq 0 ]; then
usage
fi

References: