Changes

Jump to navigation Jump to search
79 bytes removed ,  01:56, 25 August 2019
m
< [[Main Page]] | [[Second Step]] | [[Next StepsDetailed Example]] >
This page describes the fundamentals of using ConTeXt. It includes hands-on examples, and the instructions assume that you have ConTeXt [[Installation hints|installed]]. If you don't want to install it yet, you can [http://live.contextgarden.net try it on the web].
Start by typing the following into ConTeXt is a ''[[Text Editors|http://en.wikipedia.org/wiki/Markup_language markup language]'' used to primarily create PDF files. To use ConTeXt, create a text editor]] and saving it as file (typically with a <code>hello.tex</code>:extension) with ConTeXt markup and ''compile'' the file by running the command <code>context filename</code>. This creates a PDF file. This page explains how to create your very first ConTeXt document.
<texcode>== First steps ==\starttextHello World\stoptext</texcode>Make sure that ConTeXt is installed on your system. To check that, go to the command line and type
Then go to the command<pre>context -line and type:-version</pre>
You should get an output as follows:
<pre>
mtx-context hello | ConTeXt Process Management 1.03mtx-context |mtx-context | main context file: /opt/context-minimals/texmf-context/tex/context/base/mkiv/context.mkivmtx-context | current version: 2019.07.24 11:17
</pre>
If ConTeXt will then process is not installed on your documentsystem, check the [[Installation|installation]] page for installation instructions. It will output some information, such as follows—this output does ''not'' indicate an error:
Follow the steps below to create a simple document using ConTeXt: == Create a ConTeXt file == Open a [[Text Editors|text editor]], type the following content, and save the file as <precode>hello.tex</code>: <nowikitexcode>\starttextmtx-context | run 1: luatex --fmt\startsection[title="{Testing ConTeXt}] This is my {\em first} ConTeXt document.\stopsection\stoptext</opttexcode> Words starting with a backslash (such as <code>\starttext</context-minimalscode>) are called '''command sequence''' or '''macros'''. The macros <texcode>\starttext....\stoptext</texmf-cachetexcode> mark the content to be typeset. The material before <code>\starttext</luatex-cachecode> (called ''preamble'') is used to change the style of the output; any material after <code>\stoptext</context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luatex/cont-en" --jobnamecode> is ignored.  The macros <texcode>\startsection[title="hello" --lua="/opt/context-minimals/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luatex/cont-en{...lui" --no-parse-first-line --c:currentrun=1 --c:fulljobname="}]./hello.tex" --c:input=".\stopsection</hellotexcode> mark the title and the content of a section.tex" --c:kindofrun=1 "cont-yes The macro <code>{\em .mkiv"This is LuaTeX, Version beta-0.74.0-2012122511 }</code> is a [[Font Switching| font switch]] that emphasizes the content (rev 4541by showing it in slanted font) .  == Compile the ConTeXt file == \write18 enabled.(/opt/context-minimals/texmfGo to the command-line and type: <pre>contexthello</tex/context/base/cont-yes.mkivpre>
ConTeXt ver: 2013will then process your document, display some logging information on the console, and generate a <tt>hello.01.27 21:24 MKIV fmt: 2013.1pdf</tt> output file.28 int: english/english
system <pre><nowiki> cont-new.mkiv loaded(/opt/context-minimals/texmfmtx-context/tex/context/base/cont-new.mkivsystem > beware | run 1: some patches loaded from contluatex -new.mkiv)system > files > jobname: hello, input: hello, result: hellofonts > latin modern fonts are not preloadedlanguages > language en is active(hello.tex{/opt/context-minimalsfmt="/texmf-fontshome/fonts/map/pdftex/contextadityam/mkiv-base.map}fonts > preloading latin modern fonts (second stage)fonts > typescripts > unknown: library 'loc'{/optcache/context-minimals/texmfluatex-fonts/fonts/map/dvips/lm/lm-math.map}{/optcache/context-minimals/texmf-fonts5fe67e0bfe781ce0dde776fb1556f32e/fontsformats/mapluatex/dvips/lm/lmcont-rm.map}fonts > fallback modern rm 12pt is loadedbackend > xmp > using file '/opt/contexten" -minimals/texmf-context/tex/context/base/lpdfjobname="hello" -pdx.xml'pages > flushing realpage 1, userpage 1 ) )</opt/context-minimals/texmf-fonts/fonts/opentype/public/lm/lmroman12-regular.otf>mkiv lua stats > used config file - selfautoparent:="/texmfhome/web2cadityam/texmfcnf.luamkiv lua stats > used cache path - /home/adityam/texmfcontext-cacheminimals/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32emkiv lua stats > resource resolver - loadtime 0.098 seconds, 1 scans with scantime 0.083 seconds, 21 shared scans, 13 found files, scanned paths: /homeformats/adityamluatex/texmfmkiv lua stats > stored bytecode data cont- 318 modules (0en.150 sec), 68 tables (0.000 sec), 386 chunks (0.150 sec)mkiv lua stats > cleaned up reserved nodes lui" - 41 nodes, 9 lists of 441mkiv lua stats > node memory usage - 2 glue, 2 penalty, 9 attribute, 28 glue_spec, 3 attribute_listmkiv lua stats > node list callback tasks c:currentrun=1 - 6 unique task lists, 5 instances (re)created, 39 callsmkiv lua stats > used backend - pdf (backend for directly generating pdf output)mkiv lua stats > loaded patterns - en:c:2mkiv lua stats > jobdata time - 0fulljobname=".001 seconds saving, 0/hello.000 seconds loadingmkiv lua stats > callbacks tex" - 135 direct, 178 indirect, 313 totalmkiv lua stats > randomizer - resumed with value 0c:input=".13015339995276mkiv lua stats > lxml preparation time - 0/hello.000 seconds, 0 nodes, 15 lpath calls, 0 cached callsmkiv lua stats > result saved in file tex" - hello.pdf, compresslevel 3, objectcompreslevel 3mkiv lua stats > loaded fonts - 2 filesc: lmroman12kindofrun=1 -regular.otf latinmodernmath-regular.otfmkiv lua stats > fonts load time c:maxnofruns=9 - 0.069 seconds mkiv lua stats > luatex banner - this is luatex, version betac:texmfbinpath="/opt/context-0.74.0-2012122511 (tex live 2013minimals/dev)(rev 4541)mkiv lua stats > control sequences texmf- 36422 of 65536 + 100000mkiv lua stats > current memory usage linux- 23 MB (ctx: 23 MB)mkiv lua stats > runtime 64/bin" "cont- 0yes.316 seconds, 1 processed pages, 1 shipped pages, 3.165 pages/secondmkiv"
This is LuaTeX, Version 1.10.1 (TeX Live 2019) system commands enabled.open source > level 1, order 1, name '/opt/context-minimals/texmf-context/tex/context/base/mkiv/cont-yes.mkiv'system > system > ConTeXt ver: 2019.07.24 11:17 MKIV beta fmt: 2019.8.17 int: english/english......mkiv lua stats > lua properties: engine: lua 5.3, used memory: 94 MB, ctx: 93 MB, max: unknown MB), hash chars: min(64,40), symbol mask: utf (τεχ)mkiv lua stats > runtime: 0.833 seconds, 1 processed pages, 1 shipped pages, 1.200 pages/secondsystem | total runtime: 04.468485 seconds
</nowiki></pre>
Once <tt>context</tt> has finished, it will leave behind a == View the generated PDF file called == Open the generated <tt>hello.pdf</tt>PDF file using a [http://en. Open it and you will see a "Hello world" documentwikipedia.org/wiki/List_of_PDF_software#Viewers PDF viewer].It should look as follows:
<context source="no" mode="mkiv">% Draw a white frame so that the page is not truncated. % But it does not seem to work :( \setupbackgrounds[text][frame=on]
\starttext
Hello World\startsection[title={Testing ConTeXt}] This is my {\em first} ConTeXt document.\stopsection
\stoptext
</context>
Note that the section has been numbered, the section number and the section title appear in a slightly larger fonts, and the emphasized word comes out in a slanted font.
 
== Modifying the output style ==
 
It is possible to change the style of the output by using appropriate ''setup'' commands in the preamble. For example, to make the section titles bold and to use italic (rather than slanted) font for emphasized words, use
 
<context mode="mkiv" source="yes" text="which gives">
\setuphead[section][style=\bfa]
\setupbodyfontenvironment[default][em=italic]
&rarr; \starttext\startsection[[Second Step]title={Testing ConTeXt}] This is my {\em first} ConTeXt document.\stopsection\stoptext</context>
{{Getting started navbox}}

Navigation menu