Changes

Jump to navigation Jump to search
3,710 bytes added ,  22:50, 3 March 2017
m
no edit summary
All of my wiki.contextgarden.net work in progress< [[Text Editors]]
= ConTeXt mkiv with Textadept v9.3 (updated 2017/03) Introduction=
== Step 1[https: Install '''ConTeXt''' ==//foicica.com/textadept/ Textadept] is a programmable text editor for Linux, Mac OSX and Windows. It is fully extensible using [https://www.lua.org/ Lua].
 = How to ConTeXt with Textadept (MS Windows) =(updated 2017/03) == Step 1: Install / Update '''ConTeXt''' == Installation and update of ConTeXt work in progressnearly the same. If you only want to update ConTeXt you can start directly from point 3. 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. 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.   3. Install / Update ConTeXt  3. Method 1: Write a batch file Since at this point the installation and update of ConTeXt work the same, 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>.* Use Windows Notepad or <code>Right-click</code> -> '''New''' -> '''Textfile''' to create such.* Write or paste the following line into the batch file: first-setup -engine=luatex -modules=all* Save the batch file and name it something like <code>update.bat</code>.** '''Note''' that the document ending has to be <code>.bat</code> not <code>.txt</code> or anything else.* Execute the batch file you just created by double-clicking on it. A command prompt window should pop up.** If it appears for only a few seconds, chances are high that the download server is down. In that case you might want to re-try the procedure at some other time.* Wait for the download / update to finish. After it is done, the command window should disappear by itself.** ConTeXt's folder's size should be around 380 - 400 MB when everything worked fine.  3. Method 2: Type the command by hand * Use Windows Explorer to navigate to your ConTeXt directory.** Click into the upper white field where the current location is displayed.** Enter <code>cmd</code> and press <code>Enter</code>-key.** Now Windows command prompt should pop up with the correct location.* Otherwise you can start your Windows command prompt like this:** by using the key shortcut <code>Windows-Key + R</code>, entering <code>cmd</code> and pressing <code>ENTER</code>-key.** Alternatively you can use <code>Start</code> -> <code>Programs</code> -> <code>Accessories</code> -> <code>Command Pompt</code>.* Some DOS commands you might need:** <code>X:</code> change to drive X:** <code>dir</code> list the content of the current directory** <code>cd DIRECTORY</code> change to directory with name DIRECTORY** <code>cd..</code> change to superior directory** <code>cd\</code> change to root drive* Now your command prompt should look like this: X:\ConTeXt>_* Enter the following line:** If you only want ConTeXt mkiv (highly '''recommended'''): first-setup -engine=luatex -modules=all* Wait until the download / update is complete.
== Step 2: Add ConTeXt's executables folder to Windows search PATH ==
== Step 3: Install '''Textadept''' ==
# 1. [https://foicica.com/textadept/download/textadept_LATEST.win32.zip Download] and extract [https://foicica.com/textadept/ '''Textadept'''] to a folder of your choice.# 2. Use <code>textadept.exe</code> from the extracted folder to start '''Textadept'''.
== Step 4: Tweak '''Textadept''''s settings ==
* After extraction of the downloaded Textadept archive there is a file called <code>init.lua</code> 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\USERNAME\.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 PATH:
* If for some reason you can't add the folder to PATH 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"'
* '''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 is it doesn't make a any difference. 
3. Restart Textadept to reload the modified <code>init.lua</code>.
4. Open or create a ConTeXt test document:
\starttext hello world! \stoptext 
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.
=== Lexing ===
Textadept comes with an own ConTeXt lexer. A lexer is a file that defines command highlighting. So Since Textadept comes with an own ConTeXt lexer, it's is a good idea to bind <code>*.tex</code> and/or <code>*.ctx</code> files to Textadept's ConTeXt lexer. To do so:
1. Add the following lines to your <code>USER/.textadept/init.lua</code>:
textadept.file_types.extensions.tex = 'context'
* If you plan to use LaTeX and ConTeXt, you should use different file extensions. For example <code>*.tex</code> for LaTeX and <code>*.ctxcxd</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: textadept.file_types.extensions.ctx cxd = 'context' 2. Restart Textadept to reload <code>init.lua</code>.
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.
=== Themes & editor font changes ===
* You can change the theme, font and font size of Textadept with the following line
ui.set_theme('dark', {font = 'Monospace', fontsize = 10})
in which the expression '''dark''' is the filename of the theme located either in <code>Textadept\themes</code> or you can download and add new themes to <code>USER\.textadept\themes</code>
=== Snippets ===
Snippets are predefined code blocks. You add them, again, to your <code>USER/.textadept/init.lua</code>. Snippets in Textadept look like this:
-- The first line is mandatory:
snippets['context'] = snippets['context'] or {}
-- Snippets start here:
snippets.context['emph'] = '{\\em %0}'
snippets.context['bold'] = '{\\bf %0}'
snippets.context['ssubject'] = '\\startsubsubject[title={%1},marking{%1}]\n%0\n\\stopsubsubject'
* '''Note''' that a backslash is created as you would type it in ConTeXt: typing a double backslash <code>\\</code> prints is created by typing a single double backslash <code>\\</code>.
* The most important formatting commands are the following:
**<code>%0</code> creates a primary or a single input caret(the cursor will jump here first)**<code>%1</code> creates a one or multiple secondary input caretcarets
**<code>%n</code> creates a new line
**<code>%t</code> creates a tab
* After you added adding snippets, you have to restart Textadept first. * Then you can use <code>Alt + K</code> (by default on Windows machines) to choose from the list of snippets, when a ConTeXt documents document is opened in the active tab.  =3rd party projects= A ConTeXt module for textadept is openbeing 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. It's almost more comfortable to create own ConTeXt snippets with the ease of Textadept (see above).
194

edits

Navigation menu