Difference between revisions of "ConTeXt Standalone/Mac Installation"

From Wiki
Jump to navigation Jump to search
Line 135: Line 135:
 
texexec "$1"
 
texexec "$1"
 
</pre>
 
</pre>
4. SAVE this document in your Home folder in “Library/TeXShop/Engines/” AS “ConTeXt-MKII.engine”. (TeXShop offers the .engine file format). After you have saved the file, open the terminal, navigate to “Library/TeXShop/Engines/” in your Home folder. Once there, run '''chmod +x ConTeXt-MKII.engine'''
+
4. SAVE this document in your Home folder in “Library/TeXShop/Engines/” AS “ConTeXt-MKII.engine”. (TeXShop offers the .engine file format). After you have saved the file, open Terminal, navigate to /Library/TeXShop/Engines in your Home folder using <code>cd ~/Library/TeXShop/Engines</code>. Then, run <code>chmod +x ConTeXt-MKII.engine</code> .
+
 
  
 
5. Repeat steps 3 and 4, by creating a file named “ConTeXt-MKIV.engine” that contains the lines:
 
5. Repeat steps 3 and 4, by creating a file named “ConTeXt-MKIV.engine” that contains the lines:
Line 145: Line 145:
 
context "$1"
 
context "$1"
 
</pre>
 
</pre>
After you have saved the file, open the terminal, navigate to “Library/TeXShop/Engines/” in your Home folder. Once there, run '''chmod +x ConTeXt-MKIV.engine'''
 
  
 
6. Repeat steps 3 and 4 once more, by creating a file named “ConTeXt-XeTeX.engine” that contains the lines:
 
6. Repeat steps 3 and 4 once more, by creating a file named “ConTeXt-XeTeX.engine” that contains the lines:

Revision as of 22:37, 19 March 2009

< ConTeXt Minimals

This page describes an alternative of installing ConTeXt Minimals on Mac OS X. In particular it describes how to configure some GUI applications to work well with minimals.

(For command-line gurus it is enough to follow the three steps described in ConTeXt Minimals.)

Mac newbie installation and configuration

The following assumes that you want to use ConTeXt and you are a not inside unix world (otherwise, see before and after). It guides you to install ConTeXt minimal installation under Mac in the typical Applications folder. Then it gives you some information about how to configure Smultron and TeXShop to work as an editor for ConTeXt. Smultron is a mac-only, open source text editor which is very easy to use and at the same time powerful (see also [1]).

ConTeXt installation

1. Create a folder inside the Applications folder (in the Finder, press Command-Shift-A) and name it “ConTeXtMinimals”

2. Open a Terminal window (i.e., open the Terminal.app in your Utilities folder: a little window pops up)

3. Type this: cd /Applications/ConTeXtMinimals/ , which means “change directory to ConTeXtMinimals”. Now you are working in the folder you have just created.

4. Type this: rsync -ptv rsync://contextgarden.net/minimals/setup/first-setup.sh . and press Enter/Return.

This calls rsync, a program which goes to the contextgarden site (--> you must be connected to internet) and downloads all the necessary files. To start, it simply downloads the little file first-setup.sh: this file contains a set of instructions which allow for automatic downloads (e.g., it selects the right files depending on which platform you are).

To get the rest of the ConTeXt minimals, you have to execute first-setup.sh by typing in Terminal ./first-setup.sh.

This will start the download and install process. Now (well, after a while) you have all the required files in the /Applications/ConTeXtMinimals folder.

Configuring ConTeXT

1. Open a text editor and create a file that has in it the following line: . /Applications/ConTeXtMinimals/tex/setuptex /Applications/ConTeXtMinimals/tex. Save this file as “.bash_profile” (see Where to put files, below). Note: this file will be hidden, so make sure that you save it in the right place before completing the SAVE command.

(There is a small utility for working with hidden files on the Mac called Show/Hide Invisible Files: it is available at http://www.macupdate.com/info.php/id/22318.)

2. Create a new folder named “texmf-local” inside ConTeXtMinimals/tex.

3. Create another folder “web2c” inside this texmf-local folder.

4. Inside your ConTeXtMinimals folder, locate the file named texmf.cnf that is in tex/texmf/web2c. Copy this file to ConTeXtMinimals/tex/texmf-local/web2c. Open this new texmf.cnf file, find the line

HOMETEXMF = /nonexist

and replace it with the single line

HOMETEXMF = ~/texmf

Again, replace the line

TEXMF = {!!$TEXMFPROJECT,!!$TEXMFFONTS,!!$TEXMFLOCAL,!!$TEXMFCONTEXT,!! with the single line

TEXMF = {$HOMETEXMF,!!$TEXMFPROJECT,!!$TEXMFFONTS,!!$TEXMFLOCAL,!!$TEXMFCONTEXT,!!$TEXMFEXTRA,!!$TEXMFMAIN}

(See Where to put files below. These instructions assume that your personal texmf folder is in your Home folder. If you want it elsewhere, be sure to adjust the instructions in section 4 above accordingly.)

5. In Terminal, type context --make and press Enter/Return.

Where to put files

.bash_profile

There are several places that this file may go. One possibility is in your Home folder.

personal texmf

Put your personal texmf folder where it will not get clobbered by future updates. Some possibilities:

(a) inside your Home folder. (Your Home folder is the one that has the house icon.)

(b) inside the Library folder in your Home folder.

Smultron installation and configuration

1. Smultron is a mac application. To install it, simply download the dmg and put the app under the Applications folder (as usual)

2. Open Smultron and go under Tools-->Handle Commands-->Show Commands Window

3. The resulting window allows you to define some commands which can be executed by Smultron. Substantially, this means that Smultron opens for you a Terminal, types the code you want and presses return.

4. Create a new command by pressing the "New Command" button and type a name (e.g. "minimalsTexexec"). Then, write in the text field at the bottom:

#!/bin/sh 

cd /Applications/ConTeXtMinimals/ 
. /Applications/ConTeXtMinimals/tex/setuptex /Applications/ConTeXtMinimals/tex
cd %%d
texexec %%p

Texexec is the command you should call from the Terminal to run ConTeXt. Now Smultron can do it for you.

5. Write your ConTeXt file with Smultron and save it. When you want to compile it, simply go under Tools-->Commands-->Other-->minimalsTexexec. This will generate a pdf file in the same folder of your .tex file.

6. If you want to experiment with LuaTeX simply add another command (you can name it e.g. "minimalsLua") with this text in its text field:

#!/bin/sh 
cd /Applications/ConTeXtMinimals/ 
. /Applications/ConTeXtMinimals/tex/setuptex /Applications/ConTeXtMinimals/tex
cd %%d
context %%p

6b. If you explore the Commands window, you will see that clicking under the Shortcut tab you can insert a shortcut

6c. If you want to see what ConTeXs is telling you (which is fundamental in case of unexpected behaviors) you can select Tools-->Handle Commands-->Show Command Result Window. This will open a window mirroring the content of the Terminal (i.e. what ConTeXt is communicating you)

7. If you want an automatic update of the pdf you are workin on you can use another mac app, pdfview. You have simply to install it, open your pdf file and choose the automatic update option. Every time you recompile form Smultron (or by another editor), it updates the displayed pdf

We are not using the famous TeXShop editor, because it is slighlty more complicated and typically you grab it bundled with a TeX distribution (like MacTeX), and opportunely configured. By using Smultron, we have created a completely autonomous and lightweight ConTeXTMinimals installation which can work aside MacTeX/TeXShop installation. More, by pdfview we have auto update, which is one of the very relevant feature of TeXShop (If you do not know about all this stuff, see Mac installation

TeXShop installation and configuration

TeXShop is a popular TeX editor for Mac OS X.

1. To install it, download the disk image from http://www.uoregon.edu/~koch/texshop/obtaining.html and put this app in the Applications folder alongside your ConTeXTMinimals folder.

2. Launch TeXShop. It will automatically create the necessary support files.

3. Create an empty text document with your favorite text editor or TeXShop. Then, insert the following text into the document:

 
#!/bin/bash
export PATH=/Applications/ConTeXtMinimals/tex/texmf-osx-intel/bin:$PATH
texexec "$1"

4. SAVE this document in your Home folder in “Library/TeXShop/Engines/” AS “ConTeXt-MKII.engine”. (TeXShop offers the .engine file format). After you have saved the file, open Terminal, navigate to /Library/TeXShop/Engines in your Home folder using cd ~/Library/TeXShop/Engines. Then, run chmod +x ConTeXt-MKII.engine .


5. Repeat steps 3 and 4, by creating a file named “ConTeXt-MKIV.engine” that contains the lines:

#!/bin/bash
export PATH=/Applications/ConTeXtMinimals/tex/texmf-osx-intel/bin:$PATH
export TEXMFCACHE=/Applications/ConTeXtMinimals/tex/texmf-cache
context "$1"

6. Repeat steps 3 and 4 once more, by creating a file named “ConTeXt-XeTeX.engine” that contains the lines:

#!/bin/bash
export PATH=/Applications/ConTeXtMinimals/tex/texmf-osx-intel/bin:$PATH
texexec --xtx "$1"

Typesetting with TeXShop

1. Close all open documents in TeXShop, open a new one, go the the Engine menu (immediately to the right of the “Typeset” button in the Toolbar), and select one of

ConTeXt-MKII
ConTeXt-MKIV
ConTeXt-XeTex

This will instruct TeXShop to use this engine to compose your documents.

2. Edit your ConTeXt document with TeXShop. In the TeXShop toolbar, in the “Typeset” menu, choose “ConTeXt” and “Pdftex”. (Check the TeXShop preferences for more settings.) When you want to typeset the document, simply hit Command-T press or “Typeset” at the top of the document window. This will generate a PDF file in the same folder of your .tex file.

Notes

All the process requires that you have installed on your machine rsync, ruby and perl. But if you are on macosx, Apple should already have provided it, so at 99% there should not be problems.