Changes

Jump to navigation Jump to search
108 bytes added ,  22:06, 20 June 2017
no edit summary
== Step 1: Install / Update '''ConTeXt''' ==
Installation and update of ConTeXt work the same way. If you only want to update ConTeXt you can start directly from point 1.3.
1.1. [http://standalone.contextgarden.net/setup/ Download] ConTeXt.
* Windows x86 / 32 bit users: [http://standalone.contextgarden.net/setup/context-setup-mswin.zip context-setup-mswin.zip]
* Windows x64 / 64 bit users: [http://standalone.contextgarden.net/setup/context-setup-win64.zip context-setup-win64.zip]
** Download the x64 / 64 bit version only when you are really sure, that you '''need''' it.
1.2. Extract the archive to a location of your choice.
* You might want to change the name of the extracted directory to a shorter one as it will be the final location for ConTeXt.
1.3. Install / Update ConTeXt
1.3. Method 1: Write a batch file
Since at this point the installation and update of ConTeXt work the same way, the most effective solution is to create a batch file. To do so
** ConTeXt's folder's size should be around 380 - 400 MB when everything worked fine.
From here you can go to Step 2 directly.
 1.3. Method 2: Type the command by hand
* Use Windows Explorer to navigate to your ConTeXt directory.
'''Note''': you will need admin rights for this. On public machines for example you most probably won't be able to add ConTeXt to that machine's path. In that case skip this step and go to Step 3 respectively Step 4.1 directly.
2.1. Open Windows' '''System''' dialog
* either by <code>Right-click</code>ing on '''This PC''' / '''My Computer''' on your Desktop and then clicking on '''Properties'''
* or by clicking '''Start''' -> '''Settings''' -> '''About''' -> '''System Info'''
* or on older Windows Machines by going to '''Control Panel''' -> '''System'''.
2.2. Click on '''Advanced System Settings''' ("System Properties").
2.3. Click on '''Advanced'''-Tab.
2.4. Click on '''Environment Variables...'''.
2.5. Choose where to add ConTeXt's executables folder to:
*Either to '''User variables for USER''' for the current user only
*or to '''System variables''' for all users.
2.6. Double-click on the respective variable called Path.
2.7. Add your ConTeXt executables to Windows path.
* '''Note''' that the position, to where you add the location is sorted by importancy. The most important directories will be searched first. This might be taken into account when using ConTeXt together with MiKTeX for example. It's safest to place ConTeXt's path at the very beginning.
* In '''User''' Path variable you might need to add the location and seperate it from the existing ones by using a semikolon (<code>;</code>).
X:\ConTeXt\tex\texmf-win64\bin
2.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.
Optional: You can test whether it worked by starting your Command prompt and entering the following line, while being in a directory other than the one you just added.
== Step 3: Install '''Textadept''' ==
3.1. [https://foicica.com/textadept/download/textadept_LATEST.win32.zip Download] and extract [https://foicica.com/textadept/ '''Textadept'''] to a folder of your choice.
3.2. Use <code>textadept.exe</code> from the extracted folder to start Textadept.
== Step 4: Tweak '''Textadept''''s settings ==
* 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`
=== Step 4.1: Bind a PDF build command into Textadept ===
4.1.1. Use Textadept to open your <code>init.lua</code> stored in <code>SYSDRIVE:\users\USER\.textadept\</code>.
4.1.2. Add an execute command for ConTeXt to Textadept's menu:
* If your ConTeXt executables folder is already in the Windows search Path:
textadept.run.compile_commands.tex = 'mtxrun --autogenerate --script context --autopdf --purge --synctex=-1 "%f"'
* '''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.
4.1.3. Restart Textadept to reload the modified <code>init.lua</code>.
4.1.4. Open or create a ConTeXt test document:
\starttext
hello world!
\stoptext
4.1.5. Use Textadept's '''Tools''' -> '''Compile''' to build a PDF with the options added to <code>init.lua</code>. A message buffer with compilation status will open in a seperate tab.
4.1.6. When you have a popular PDF reader installed already, it should pop up at the end of the process and show the created PDF output. [https://www.sumatrapdfreader.org/free-pdf-reader.html '''Sumatra PDF'''] is highly recommended for this.
=== Step 4.2: Lexing (command highlighting & code folding) ===
A lexer is a file that defines command highlighting and code folding keywords. Textadept comes with a ConTeXt lexer. In order to be able to use command highlighting and code folding when writing ConTeXt documents, you have to bind those documents to the lexer. To do so
4.2.1. add the following line to your <code>USER/.textadept/init.lua</code> and save it afterwards:
textadept.file_types.extensions.tex = 'context'
* If you plan to use LaTeX and ConTeXt, you might want to use different file extensions for each format. For example <code>*.tex</code> for LaTeX and <code>*.cxd</code> for ConTeXt documents. In that case you only have to bind your new ConTeXt extension to Textadept's ConTeXt lexer, since <code>.tex</code> files are automatically recognized as LaTeX documents:
** When linking files within ConTeXt documents without adding an extension though, ConTeXt will expect those files to have the ending <code>*.tex</code>, i.e. you will have to work with filenames and extensions when using a format other than <code>*.tex</code>, which on the other hand should not be seen as a disadvantage. (TODO: which way is more "hack proof"?)
4.2.2. Restart Textadept to reload <code>init.lua</code>.
4.2.3. Open a ConTeXt document and check Textadept's status bar in the lower right corner. It should say '''context'''. If it says '''latex''' make sure it really is a ConTeXt file or repeat the procedure.
== Optional: Additional '''Textadept''' tweaks ==
snippets.context['TRIGGERKEYWORD'] = 'PASTEDTEXT'
To get an idea how writing snippets in Lua (for ConTeXt ) works, you can copy and paste the following list to your <code>init.lua</code>:
-- The first line is mandatory:
194

edits

Navigation menu