Open main menu

Changes

4,924 bytes removed ,  06:52, 10 September 2023
< [[Text Editors]]= Preamble =
=Introduction=Here is the place to get everything that is important to get started with ''ConTeXt'' on ''MS Windows'' operating system.
[https://foicica.com/textadept/ Textadept] is a programmable text editor for LinuxThanks to especially ''Donald Knuth'', Mac OSX ''Hans Hagen'', ''Taco Hoekwater'' and too many other coders and Windows. It is fully extensible using [https://www.lua.org/ Lua].users to mention here!
= Introduction =
= How to [http://wiki.contextgarden.net ConTeXt with Textadept ] (MS Windowspronounced '''ConTehht''' as derived from Dutch) =(updated 2017is a [http://en.wikipedia.org/wiki/TeX TeX] macro package created and maintained by [http://03)www.pragma-ade.com Pragma ADE].
== Step 1: Install / Update '''Setup ConTeXt''' ==
Installation and update of == Download & Install ConTeXt work nearly the same. If you only want to update ConTeXt you can start directly from point 3.==
Installation and update of ConTeXt work the same way. If you only want to update ConTeXt, you can go to point 3. 1. Download [http://standalone.contextgarden.net/setup/ DownloadConTeXt] ConTeXt.* Windows x86 / 32 bit users: [httphttps://standalonedistribution.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 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>updateinstall.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 Alternatively, from the command by handprompt:
* Use Windows Explorer to navigate to your ConTeXt directory.
** 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 key + R</code>, entering <code>cmd</code> and pressing <code>ENTEREnter</code>-key.** Alternatively , you can use <code>Start</code> -> <code>Programs</code> -> <code>Accessories</code> -> <code>Command Pompt</code>.* Some important ''MS 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 drive root ** <code>X:</code> change to driveX:** also possible: <code>cd directory\subdirectory\subsubdir...</code>* Now In the end 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 ==
 
work in progress
 
== 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 ==
 
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 <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:
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 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 it doesn't make 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.
 
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.
 
== Optional: Additional '''Textadept''' tweaks ==
=== Lexing =Add ConTeXt's executables folder to Windows search Path ==
A lexer is a file that defines command highlighting'''Note''': you will need admin rights for this. Since Textadept comes with an own On public machines for example you most probably won't be able to add ConTeXt lexer, it is a good idea to bind <code>*.tex</code> files to Textadeptthat machine's ConTeXt lexerpath. To do so:
1. Add the following lines to your Open Windows' '''System''' dialog* either by <code>USER/.textadept/init.luaRight-click</code>: textadept.file_types.extensions.tex = ing on '''This PC''' / '''My Computer''' on your Desktop and then clicking on '''Properties''context'* If you plan to use LaTeX and ConTeXt, you should use different file extensions. For example <codeor by clicking '''Start''' ->*.tex</code'''Settings''' -> for LaTeX and <code'''About''' ->'''System Info'''*.cxd</code> for ConTeXt documents. In that case you only have or on older Windows Machines by going to bind your new ConTeXt extension to Textadept's ConTeXt lexer, since <code''Control Panel''' ->.tex</code> files are automatically recognized as LaTeX documents: textadept.file_types.extensions.cxd = 'context''System'''.
2. Restart Textadept to reload <code>init.lua</code>Click on '''Advanced System Settings''' ("System Properties").
3. Open a ConTeXt document and check TextadeptClick on 's status bar in the lower right corner. It should say ''Advanced'context'''. If it says '''latex''' make sure it really is a ConTeXt file or repeat the procedure-Tab.
=== Themes & editor font changes ===You can change the theme, font and font size of Textadept with the following line ui4.set_theme(Click on 'dark', {font = 'MonospaceEnvironment Variables...', 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>(create the folder if it's not there yet).There are more settings which you can look up in Textadept's [https://foicica.com/textadept/manual.html#Themes online manual].
=== Snippets ===Snippets are predefined code blocks5. You Choose where to add them ConTeXt's executables folder to:*Either to your <code>'''User variables for USER/''' for the current user only*or to '''System variables''' for all users.textadept/init.lua</code>. Snippets in Textadept look like this:
-- The first line is mandatory: snippets['context'] = snippets['context'] or {} -6. Double- Snippets start here: snippets.context['emph'] = '{\\em %0}' snippets.context['bold'] = '{\\bf %0}' snippets.context['start'] = '\\start%1\n%0\n\\stop%1' snippets.context['itemize'] = '\\startitemize\n\t%0\n\\stopitemize' snippets.context[click on the respective variable called 'item'] = Path'\\startitem\n\t%0\n\\stopitem' snippets.context['enumerate'] = '\\startenumerate\n\t%0\n\\stopenumerate' snippets.context['chapter'] = '\\startchapter[title={%1},marking{%1}]\n%0\n\\stopchapter' snippets.context['section'] = '\\startsection[title={%1},marking{%1}]\n%0\n\\stopsection' snippets.context['ssection'] = '\\startsubsection[title={%1},marking{%1}]\n%0\n\\stopsubsection' snippets.context['title'] = '\\starttitle[title={%1},marking{%1}]\n%0\n\\stoptitle' snippets.context['subject'] = '\\startsubject[title={%1},marking{%1}]\n%0\n\\stopsubject' snippets.context['ssubject'] = '\\startsubsubject[title={%1},marking{%1}]\n%0\n\\stopsubsubject'
7. Add your ConTeXt executables to Windows path.* '''Note''' that a backslash <code>\</code> the position, to where you add the location is created 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 typing using a double backslash semikolon (<code>\\;</code>).* In '''System''' Path variable you probably only have to add a new line.
* The most important formatting commands are the followinglocation should look like this:**<code>%0</code> creates a primary input caret (the cursor will jump here first)**<code>%1</code> creates one or multiple secondary input carets**<code>%n</code> creates a new line**<code>%t</code> creates a tab
* After adding snippets, you have to restart Textadept first.Win x86 / 32 bit: X:\ConTeXt\tex\texmf-mswin\bin* Win x64 / 64 bit: X:\ConTeXt\tex\texmf-win64\bin
* Then you can use <code>Alt + K</code> (by default on Windows machines) to choose from the list of snippets, when a ConTeXt document 8. Save your changes. Usually no restart or re-login is opened in the active tabneeded after this operation.
Opt 1. 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.
=3rd party projects= context -version
* A message with ConTeXt module for textadept 's version number should apear.* If a message like '''context' is being developed at [https://githubnot recognized as an internal or external command..com/stephengaito/ta-.'' appears, you should make sure that you added the correct location of ConTeXt's executables (context-latex ta-context-latex].exe) path to Windows' search path.
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= Text Editors === 's almost more comfortable to create own ConTeXt snippets with the ease of Textadept (see above)'CudaText'' ==See my article here [[CudaText]].
194

edits