Changes

Jump to navigation Jump to search
3,048 bytes added ,  20:11, 28 June 2020
m
I missed an error in the year: 22020 to 2020
< [[Main PageFirst Document]] | [[Second StepDetailed Example]] | [[Next StepsBasics]] >
This page describes the fundamentals of using ConTeXtis a ''[http://en.wikipedia. It includes hands-on examples, and the instructions assume that you have ConTeXt [[Installation hints|installedorg/wiki/Markup_language markup language]]. If you don't want ' used to install it yetprimarily create PDF files. To use ConTeXt, you can [http:create a text file (typically with a <code>.tex</code> extension) with ConTeXt markup and ''compile'' the file by running the command <code>context filename</livecode>.contextgardenThis creates a PDF file.net try it on the web]This page explains how to create your very first ConTeXt document.
Start by typing the following into a [[text editor]] and saving it as <code>hello.tex</code>:== First steps ==
<texcode>\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>
texexec hellomtx-context | 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: 2020.01.30 14:13
</pre>
If ConTeXt will then process is not installed on your system, check the [[Installation|installation]] page for installation instructions. 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 <code>hello.tex</code>: <texcode>\starttext\startsection[title={Testing ConTeXt}] This is my {\em first} ConTeXt document. It will output some information, \stopsection\stoptext</texcode> Words starting with a backslash (such as follows—this output does <code>\starttext</code>) are called '''command sequence''' or '''macros'''. The macros <texcode>\starttext....\stoptext</texcode> mark the content to be typeset. The material before <code>\starttext</code> (called ''notpreamble'' indicate an error) is used to change the style of the output; any material after <code>\stoptext</code> is ignored.  The macros <texcode>\startsection[title={...}]...\stopsection</texcode> mark the title and the content of a section.  The macro <code>{\em ...}</code> is a [[Font Switching| font switch]] that emphasizes the content (by showing it in slanted font).  == Compile the ConTeXt file == Go to the command-line and type<pre>context hello</pre> ConTeXt will then process your document, display some logging information on the console, and generate a <tt>hello.pdf</tt> output file.
<pre><nowiki>
TeXExec | processing document 'hello.tex'TeXExec | no ctx file foundTeXExec | tex processing method: mtx-contextTeXExec | TeX run 1TeXExec | writing option file : luatex --fmt="/home/adityam/.cache/context-minimals/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luatex/cont-en" --jobname="hello" --lua="/home/adityam/.topTeXExec | tex engine: pdfetexTeXExec | tex format: cache/context-minimals/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luatex/cont-enTeXExec | progname: contextThis is pdfeTeXk, Version 3.141592lui" --c:currentrun=1--c:fulljobname=".30/hello.3tex" -2-c:input=".2 (Web2c 7/hello.5.5) \write18 enabled. %&tex" --c:kindofrun=1 --c:maxnofruns=9 --line parsing enabled. (c:\texmfbinpath="/opt/context\usr\local\context\tex\-minimals/texmf-locallinux-64/web2c/natural.tcx)entering extended mode(./hellobin" "cont-yes.texmkiv"
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: 20062019.0507.14 2324 11:57 17 MKIV beta fmt: 20062019.58.16 17 int: english mes: /english language : language en is active<protectionstate 0>...
...
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/second
system | total runtime: 4.485 seconds
</nowiki></pre>
Once == View the generated PDF file == Open the generated <tt>texexechello.pdf</tt> has finished, it will leave behind PDF file using a file called [http://en.wikipedia.org/wiki/List_of_PDF_software#Viewers PDF viewer]. It should look as follows: <ttcontext mode="mkiv">hello% Draw a white frame so that the page is not truncated. % But it does not seem to work :( \setupbackgrounds[text][frame=on]\starttext\startsection[title={Testing ConTeXt}] This is my {\em first} ConTeXt document.pdf\stopsection\stoptext</ttcontextNote 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. Open it For example, to make the section titles bold and you will see a to use italic (rather than slanted) font for emphasized words, use <context mode="mkiv" source="yes" text="Hello worldwhich gives" >\setuphead[section][style=\bfa]\setupbodyfontenvironment[default][em=italic] \starttext\startsection[title={Testing ConTeXt}] This is my {\em first} ConTeXt document.\stopsection\stoptext</context>
> [[Second StepCategory:Basics]][[Category:Sample documents]]
2

edits

Navigation menu