Changes

Jump to navigation Jump to search
835 bytes added ,  17:31, 14 December 2021
Re-formatted synctex instructions to make them clearer and stressed the importance of setting the alternate path preferences entry.
= TeXShop =
TeXShop is a good Editor editor for all variants of TeX and ConTeXt. It offers:
* syntax highlighting;
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:
* Go into ''TeXShop > Engines > Inactive > ConTeXt-Sync''. Move or copy the file <code>ConTeXt2021.engine</code> into the ''Engines'' folder.
* Close and reopen TeXShop. The new ''ConTeXt2021'' engine should now appear in the toolbar drop-down menu.
* Open Terminal.app, then type the following to make the engine executble executable and press Enter:
chmod 755 ~/Library/TeXShop/Engines/ConTeXt2021.engine
You may close the terminal.
===== Syncing Between between Source and PDF =====
As of July 2021, ConTeXt provides support, through its Swiss army knife <code>mtxrun</code> script, for getting the filename and line corresponding to a certain spot in a PDF document, and for getting the PDF coordinates (page number + bounding box) corresponding to a given line in a source file. Type this in a terminal window to get some information about this nifty feature:
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:
* 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 does not workbreaks, who is to blame?
If Cmd-clicking somewhere has an effect, e.g., TeXShop jumps somewhere but perhaps not at the right spot, it is more likely that <code>mtxrun</code> is to blame. So, it is recommended to verify that by invoking <code>mtxrun</code> directly. For instance, if <code>test.tex</code> is the name of the minimal example above, then a terminal session may go like this (<code>$</code> is the shell prompt: it must not be typed):
</nowiki>
The output shows the source path, the line number (<code>11</code>), and a tolerance (<code>0</code>), which will be positive if the input coordinate is slightly outside any bounding box recorded in the <code>.synctex</code> file.
If <code>mtxrun</code> output looks accurate enough, then probably TeXShop is at fault; otherwise, report the issue to ConTeXt's mailing list.
If, on the other hand, Cmd-clicking somewhere has no effect whatsoever, then TeXShop might be at fault. But since the configuration for synchronisation is not trivial, be sure to double-check everything explained above before reporting an issue to TeXShop's author. In particular, if you are working with a complex document consisting of many files, make sure that each one has a <code>% !TEX root</code> directive, (the space between <code>%</code> and <code>!</code> is mandatory in magic lines) and the other necessary magic lines, as explained above. Make also sure that you are typesetting with a sufficiently recent ConTeXt release.
If you have configured TeXShop to use an external editor, be sure to (re)read TeXShop's documentation: although syncing with an external editor works (with some limitation for complex documents), you may have to work a bit harder than necessary to convince TeXShop to synchronise with your editor. See the remarks above.
 
===== Making UTF-8 Default File Encoding=====
93

edits

Navigation menu