Open main menu

Changes

2,013 bytes added ,  07:53, 31 March 2023
 
= TeXShop =
If you have installed MacTeX (the TeX Live distribution for macOS), you may start typesetting right away.
If TeXShop was installed with MacTeX, you may find it in the ''/Applications/TeX'' folder; otherwise, it will likely be in your ''/Applications'' folder. Open a ConTeXt document with TeXShop, choose the ''ConTeXt (LuaTeX)'' engine from the drop-down menu in the toolbar of the source window, and typeset!
Most likely, though, you will want to use the most up to date ConTeXt release (see [[Installation]]). For that, you need to perform the following one-time set up:
* ''In the Finder'', Option-click on the ''Go'' menu and select ''Library'' (this menu entry may not be visible if you do not keep Option pressed while clicking). TeXShop installs support files for every user in the folder ''TeXShop'' in the user's ''Library'' folder of the user's home folder. They are installed first when the user runs TeXShop for the first time.
* Go into ''TeXShop > Engines > Inactive > ConTeXt-Sync''. Move or copy the file <code>ConTeXt2021ConTeXt202X.engine</code> into the ''Engines'' folder.* Close and reopen TeXShop. The new ''ConTeXt2021ConTeXt202X'' engine should now appear in the toolbar drop-down menu.
* Open Terminal.app, then type the following to make the engine executable and press Enter:
chmod 755 +x ~/Library/TeXShop/Engines/ConTeXt2021ConTeXt202X.engine
You may close the terminal.
* Back in TeXShop, go to ''Preferences > Engine'' and adjust the ''Alternate Path'' text field to point to the full path of your local ConTeXt installation.
 
''' Remark''' this engines uses <code>context</code> and not <code>mtxrun</code> for compilation. See below how to add an engine using the latter instead.
Now, every time you edit a ConTeXt document and want to use your local installation instead of MacTeX's, add the following “magic lines” right at the beginning of your source document:
% !TEX TS-program = ConTeXt2021ConTeXt202X
% !TEX useAlternatePath
Then, typeset your document. You do not need to select the correct engine from the drop-down menu when <code>% !TEX TS-program</code> is used: TeXShop will pick up the engine specified in the source. Verify in the Console window that the correct ConTeXt distribution is used for typesetting.
TeXShop '''v4.66''' and later has adopted ConTeXt's syncing method. When this method is enabled (see the “magic line” below), Cmd-clicking somewhere in the preview window jumps to the source window and highlights the corresponding line. Vice versa, Cmd-clicking somewhere in a source window jumps to, and highlights, the corresponding spot in the preview.
To enable this feature, '''make syncing:<ol><li> Make sure that you are using the latest ConTeXt release''', and add </li><li> Make sure that you are using TeXShop v4.66 or later</li><li> Add the following additional “magic line” lines” at the start of your source document: <pre>% !TEX useAlternatePath% !TEX useConTeXtSyncParser</pre></li>
Also, make <li>Make sure that your document enables the generation of the generates a <code>.synctex</code> file. Your source should contain this line: <pre>\setupsynctex[state=start,method=min]</pre>
or this:
<pre>\setupsynctex[state=start]</pre></li><li>Make sure the TeXShop preferences setting “alternate path” is set to the path to your LMTX installation. A typical example for an Intel-based Mac is:<pre>TeXShop -> Preferences -> Engines -> Alternate path == /Users/<username>/Applications/context-osx-64/tex/texmf-osx-64/bin </pre><i><b>If you do not do this or get this wrong then the editor will fail to sync from source to PDF or back without any error message.</b></i></li></ol>You may find that you need to quit and restart TeXShop to get it to take account of changes you make to the above.
Then, typeset your document and try Cmd-clicking either in the source or in the preview. This is a minimal example that allows you to test syncing within TeXShop:
<nowiki>
% !TEX TS-program = ConTeXt2021ConTeXt202X
% !TEX useAlternatePath
% !TEX useConTeXtSyncParser
* it simplifies the code required in TeXShop to deal with synchronisation;
* it allows Hans ConTeXt's developers to continue improving synchronisation independently, and TeXShop can automatically benefit from such improvements (as long as <code>mtxrun</code>'s interface does not change).
There is one drawback: if something breaks, who is to blame?
In the manual for TeXShop you can find instructions for making your engine the the default engine or how to have TeXShop use your engine no matter which engine is set on a file by file basis.
 
==== Setting-Up TeXShop for ConTeXt Suite ====
 
TeXShop installs support files for the user in ''~/Library/TeXShop''. Let's create an engine for ''mtxrun'':
 
* Start TeXShop
 
* create a new document
use the File-Menu or use cmd-N
* save the engine
use the File-Menu or use cmd-S
In the dialog window change the name of the file to ''ConTeXt Suite.engine'' or whatever!
In the lower part of the dialog change the file format to ''Plain Text''
 
* enter the following content into the document:
#!/bin/tcsh
echo "$path"
setenv PATH "$3"\:$PATH
echo "$path"
"$3"/mtxrun --autogenerate --script context --autopdf --synctex=1 "$1"
* Save it as ''LMTX.engine'' (use the File-Menu or use cmd-S)
 
* Make the file executable by doing the following in a terminal window
chmod +x LMTX.engine
 
* Quit TeXShop
 
* Open 2 windows in the finder
 
* In one window and navigate to where you saved the engine
 
* In the other window navigate to the folder containing the engines for TeXShop
press: ''shift''-cmd-G
in the dialog enter: ~/Library/TeXShop/Engines
* copy the engine from the other window using 'option'-drag
 
* close the windows
 
* select it in TeXShop
==== Setting-Up TeXShop for ConTeXt Suite System-Wide Installation ====
1

edit