Since I always used TeXShop to compile my tex-files I did not have to run LaTeX commands via terminal (many macros like BibTeX, MakeIndex etc. are included in TeXShop). Now that I want to include an index and change its style I need for my understanding to run the following command in terminal to generate a .ist file:

makeindx -g -s a:\mkidx.ist MyIndex.idx

I just do not know how to run (LaTeX-)commands via Terminal. Can anyone help?

  • 2
    Chances are you don't need to run latex from the terminal to do this. You might want to check out the latexmk Engine for TeXShop. See All-in-one-engine for TeXShop. – Alan Munn Sep 8 '12 at 17:27
  • The package imakeidx provides easy access to makeindex' options without the need to use the command line. You have to run your document with shell-escape enabled, though. – cgnieder Sep 8 '12 at 17:56
  • 5
    You can say \usepackage{imakeidx} and \makeindex[options=-g -s mkidx.ist]; you won't even need to run makeindex from the Terminal, as the package takes care of that. – egreg Sep 8 '12 at 17:57

Open Terminal, and use cd to get to the folder containing MyIndex.idx. If the folder is your home directory, then just cd ~ will do the trick, otherwise cd ~/Documents for your Documents folder, etc. Then just enter the command, which is probably

makeindex -g -s mkidx.ist MyIndex.idx

rather than what you have above (i.e. makeindex in place of makeindx and no a:\ which looks like MS-DOS to me).

This assumes that Terminal knows where to find makeindex, which may not always be the case, depending on how your system is set up. If it fails, use Spotlight to find a file called makeindex, and add its location before makeindex. On the machine I am using, makeindex is located in /opt/local/libexec/texlive/binaries/, so the above command becomes

 /opt/local/libexec/texlive/binaries/makeindex -g -s mkidx.ist MyIndex.idx
  • I get the following makeindex -g -s mkidx.ist MyIndex.idx -bash: makeindex: command not found – John Sep 8 '12 at 17:30
  • @John --- I have edited my answer. – Ian Thompson Sep 8 '12 at 17:41
  • 1
    If @John is using a standard MacTeX installation, he won't have a /opt directory, since that is installed by MacPorts. The standard path for TeX binaries in MacTeX is /usr/texbin. It's possible that John's path is set incorrectly in the terminal. Similarly, Spotlight is usually set not to index system files, so it usually won't find TeX related files by default. – Alan Munn Sep 8 '12 at 17:57
  • 1
    @AlanMunn ---- On the machine I am using (which is quite old) there is no setting to determine whether Spotlight should index system files. Could you add a comment explaining how to turn this feature on when it is optional? – Ian Thompson Sep 8 '12 at 18:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.