Changes

Jump to navigation Jump to search
1,606 bytes added ,  12:55, 27 April 2017
m
Changed snippet details
== Step 1: Install / Update '''ConTeXt''' ==
Installation and update of ConTeXt works work the sameway. If you only want to update ConTeXt you can start directly from point 3.
1. [http://standalone.contextgarden.net/setup/ Download] ConTeXt.
3. Method 1: Write a batch file
Since at this point the installation and update of ConTeXt work the sameway, the most effective solution is to create a batch file. To do so
* use Windows Explorer to navigate to your ConTeXt directory. In there should be a file called <code>first-setup.bat</code>.
** <code>cd DIRECTORY</code> change to directory with name DIRECTORY
** <code>cd..</code> change to superior directory
** <code>cd\</code> change to drive root drive
** <code>X:</code> change to drive X:
** also possible: <code>cd directory\subdirectory\subsubdir...</code>
* Win x86 / 32 bit:
DX:\CTXConTeXt\tex\texmf-mswin\bin
* Win x64 / 64 bit:
DX:\CTXConTeXt\tex\texmf-win64\bin
8. Save your changes. Usually no restart or re-login is needed after this operation, but to make sure, that the folder was added, you should restart your machine.
== Step 4: Tweak '''Textadept''''s settings ==
 
'''Note''' that almost all changes to Textadept are saved in the file <code>init.lua</code>. There is two of them, of which you should edit only one:
 
* One of them is in the extracted Textadept main folder. It is '''not recommended''' to edit this file as your changes will be lost when you update Textadept. Instead:
* When you start Textadept for the first time, a new folder <code>SYSDRIVE:\users\USERNAME\.textadept</code> gets created. It also contains a file called <code>init.lua</code>. This is the file and location where you should save all your Textadept settings. This way you can make a copy and use it on several computers. When you open it for the first time it should be empty.
 
Usually you have to restart Textadept after changing its configuration files. Robert Gieseke created a code though, which you can add to your <code>init.lua</code> to circumvent having to restart Textadept, whenever a change is made:
 
-- Save and reset Lua state: `F9`
keys['f9'] = function() -- Mac OSX users might prefer: keys[OSX and 'mf9' or 'f9']
io.save_file()
reset()
end
 
Save <code>init.lua</code> and restart Textadept once. After doing so you can add changes to Textadept's configuration files and press <code>F9</code>-key afterwards to save and reload the changes without having to restart Textadept.
=== Step 4.1: Bind a PDF build command into Textadept ===
1. Use your freshly installed Textadept to open Textadept's main configuration file called <code>init.lua</code>.* After extraction of the downloaded Textadept archive there is a file called your <code>init.lua</code> stored in the main program folder. It is '''not recommended''' to edit this file as your changes will be lost when you update Textadept. Instead:* When you start Textadept for the first time a new folder <code>SYSDRIVE:\users\USERNAMEUSER\.textadept\</code> gets created. It also contains the file called <code>init.lua</code>. It's the file and location where you should save all your Textadept settings. This way you can make a copy and use it on several computers. When you open it for the first time it should be empty.
2. Add an execute command for ConTeXt to Textadept's menu:
* If your ConTeXt executables folder is already in the Windows search PATHPath:
textadept.run.compile_commands.tex = 'mtxrun --autogenerate --script context --autopdf --purge --synctex=-1 "%f"'
* If for some reason you can't add the folder to PATH, for example on public machines, you have to add the full path to your ConTeXt executables. For example:
textadept.run.compile_commands.tex = 'C:/ctx/tex/texmf-mswin/bin/mtxrun --autogenerate --script context --autopdf --purge --synctex=-1 "%f"'
* '''Important''': you have to start `first-setup.bat` from the main ConTeXt directory every time you restart a machine, on which ConTeXt is not in the Windows search path (see Step 1.3), otherwise you will get ''file not found''-errors, when trying to compile a ConTeXt document.
* '''Note''' that you have to use slash <code>/</code> instead of backslash <code>\</code> in the file path, since Lua (same as ConTeXt) interprets a <code>\</code> as the beginning of a command, while for Windows it doesn't make any difference.
=== Step 4.2: Lexing (command highlighting & code folding) ===
A lexer is a file that defines command highlighting and code folding keywords. Since Textadept comes with an own a ConTeXt lexer, it is a good idea . In order to be able to bind <use command highlighting and code>*.tex</code> files to Textadept's folding when writing ConTeXt lexerdocuments, as otherwise you won't benefit from have to bind those documents to the mentioned features when writing ConTeXt documentslexer. SoTo do so
1. add the following line to your <code>USER/.textadept/init.lua</code> and save it afterwards:
* There are more settings which you can look up in Textadept's [https://foicica.com/textadept/manual.html#Themes manual].
 
* Many ''base16'' themes for Textadept can be found at [https://github.com/rgieseke/textadept-themes Robert Gieseke's GitHub]. You can preview them [https://chriskempson.github.io/base16/ here] (partially).
=== Snippets ===
snippets['context'] = snippets['context'] or {}
-- Snippets start here:
snippets.context['emph'] = '{\\em %<selected_text>%0}' snippets.context['bold'] = '{\\bf %<selected_text>%0}'
snippets.context['start'] = '\\start%1\n%0\n\\stop%1'
snippets.context['itemize'] = '\\startitemize\n\t%0\n\\stopitemize'
* The most important formatting commands are the following:
**<code>%0</code> creates a primary input ''closing'' caret (placeholder) (the cursor will jump here first'''last''')**<code>%1</code> creates one or multiple secondary input carets(1, 2, 3 and so on; you can also use the same integer multiple times: e.g. <code>\\start%1 ... \\stop%1</code>)**<code>%\n</code> creates a new line**<code>%\t</code> creates a tab**<code>%<selected_text></code> this is where highlighted text will be pasted when enclosing it with a snippet (e.g. <code>{\\emph %<selected_text>%0}</code>)
* After adding snippets, you have to restart Textadept firstor reset Lua state as described in Step 4.
* You can paste snippets into ConTeXt documents
A ConTeXt module for textadept is being developed at [https://github.com/stephengaito/ta-context-latex ta-context-latex].
Note though, that if you plan to use Textadept without LaTeX with ConTeXt mkiv only (recommended), then you might not need the package mentioned above as it comes with literally only a hand full of ConTeXt snippets. Italso needs additional software to be installed (Textredux, ctags), so that it's almost more comfortable to create own ConTeXt snippets with the ease of Textadept (see above).
194

edits

Navigation menu