29 March 2011

LaTeX not found?

by Jaromir Benes

Got LaTeX installed on your computer, and still IRIS cannot find it? No problem. You can always fix it manually.

Giving IRIS access to LaTeX is necessary if you wish to use some of the IRIS reporting or publishing functions. IRIS uses the pdflatex program to produce PDFs (and also epstopdf for converting graphics if needed) and thus needs to know the location of these executables. By default, IRIS attempts to find the LaTeX executables automatically during its start-up (i.e. at the time you run irisstartup) by calling a TeX utility called findtexmf.

The automatic detection may fail on some computers or systems for a variety of reasons. Whenever the LaTeX executables are not found the IRIS introductory message contains a warning

LaTeX binary files: No TeX/LaTeX installation found.
instead of displaying their location.

If you however know that TeX/LaTeX really resides on your computer, and know where it is, you can always resort to setting up the paths manually. The location of pdflatex and epstopdf are configurable (together with several other IRIS settings): this is to say that you can set or change them either by calling the irisset function, or by creating an irisuserconfig m-file. The first option is temporary (the changes made only last within one IRIS session), the second option is more permanent (the settings are made automatically at the beginning of each IRIS session).

  • Calling irisset

    Set the paths to latex, pdflatex and epstopdf as follows:
    irisset('latexpath','C:\MiKTeX\miktex\bin\latex.exe');
    irisset('pdflatexpath','C:\MiKTeX\miktex\bin\pdflatex.exe');
    irisset('epstopdfpath','C:\MiKTeX\miktex\bin\epstopdf.exe');
    irisget()
    
    where you, of course, replace the example paths with the actual ones as on your computer. The last command line displays the current configurable settings, including the newly entered paths. Any changes made by irisset are reverted to the default settings each time you re-start Matlab and/or IRIS.

  • Creating irisuserconfig

    Create an m-file function named irisuserconfig.m as follows:
    function c = irisuserconfig(c)
        c.latexpath = 'C:\MiKTeX\miktex\bin\latex.exe';
        c.pdflatexpath = 'C:\MiKTeX\miktex\bin\pdflatex.exe';
        c.epstopdfpath = 'C:\MiKTeX\miktex\bin\epstopdf.exe';
    end
    
    Again, you need to replace the example paths with the real ones. Save the m-file in a folder that is on the Matlab search path. Then re-run irisstartup. You should see two changes in the introductory message: the location of the LaTeX executables, and the location of the user config file. For instance,
    User config file: C:\Users\Home\Documents\MATLAB\irisuserconfig.m.
    LaTeX binary files: C:\MiKTeX\miktex\bin.
    
    As long as you keep the config file on the Matlab path, the m-file will be executed each time you run irisstartup, and IRIS will be able to use LaTeX.

2 comments:

  1. I use a Mac and have problems finding LaTex. I have already installed MacTex on my Mac, but anyway IRIS could not find the path to appropriate files. I also could not find the latex, pdflatex and epstopdf files. How can I go with it?

    ReplyDelete
  2. Hello Hayk

    After having installed TexLive 2010 (with Mac Tex), create a irisuserconfig.m file with the following path:

    function c = irisuserconfig(c)
    c.latexpath ='/usr/local/texlive/2010/bin/x86_64-darwin/latex';
    c.pdflatexpath ='/usr/local/texlive/2010/bin/x86_64 darwin/pdflatex';
    c.epstopdfpath ='/usr/bin/pstopdf';
    end

    Note the 3rd path which executes pstopdf in the original hidden directory /user/bin. The executable epstopdf provided in TexLive does not work, at least on my Mac, presumably because the link with GhostScript is severed.

    Have fun

    Nic

    ReplyDelete