Changes

Jump to navigation Jump to search
2,643 bytes added ,  04:26, 22 May 2015
m
no edit summary
< [[Main Page]] | [[Second Step]] | [[Next StepsDetailed Example]] >
What ConTeXt is ConTeXt? What can I do with it? Let’s seea ''[http://en.wikipedia. Take your favourite [[text editor]org/wiki/Markup_language markup language]'' used to primarily create PDF files. To use ConTeXt, type in the following document and save it as create a text 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>\starttextHello World\stoptext</texcode>== First steps ==
It shows already a Make sure that ConTeXt essential: everything's between <tt>\startsomething</tt> is installed on your system. To check that, go to the command line and <tt>\stopsomething</tt>.type
If you don't have ConTeXt [[Installation hints|installed]] (yet), you can first try out the latest <pre>context --version using the web interface http:<//live.contextgarden.net. If you already installed it, you can go to the shell/command line and type inpre>
You should get an output as follows:
<pre>
texexec hellomtx-context | ConTeXt Process Management 0.61mtx-context |mtx-context | main context file: /opt/context-minimals/texmf-context/tex/context/base/context.mkivmtx-context | current version: 2014.12.29 10:01
</pre>
If ConTeXt 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 now save the file as <code>hello.tex</code>: <texcode>\starttext\startsection[title={Testing ConTeXt will start}] This is my {\em first} ConTeXt document.\stopsection\stoptext</texcode> Words starting with a backslash (such as <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 ''preamble'') 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). It   == Compile the ConTeXt file == Go to the command-line and type: <pre>context hello</pre> ConTeXt will give you then process your document, display some logging information on the console, and generate a <tt>hello.pdf</tt> output on your terminal file.
<pre><nowiki>
TeXExec mtx-context | processing document 'run 1: luatex --fmt="/opt/context-minimals/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luatex/cont-en" --jobname="hello" --lua="/opt/context-minimals/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luatex/cont-en.tex'TeXExec | lui" --no ctx file foundTeXExec | tex processing method-parse-first-line --c: contextTeXExec | TeX run currentrun=1TeXExec | writing option file --c:fulljobname="./hello.topTeXExec | tex engine" --c: pdfetexTeXExec | input="./hello.tex format" --c: kindofrun=1 "cont-enTeXExec | progname: contextyes.mkiv"This is pdfeTeXkLuaTeX, Version 3.141592beta-10.3074.30-2.2 2012122511 (Web2c 7.5.5rev 4541)
\write18 enabled.
%&-line parsing enabled. (c:\/opt/context\usr\local\-minimals/texmf-context\/tex\texmf-local/web2ccontext/natural.tcx)entering extended mode(.base/hellocont-yes.texmkiv
ConTeXt ver: 20062013.0501.14 2327 21:57 24 MKIV fmt: 20062013.51.16 28 int: english /english......mkiv lua stats mes> current memory usage - 23 MB (ctx: english23 MB)mkiv lua stats > runtime - 0.316 seconds, 1 processed pages, 1 shipped pages, 3.165 pages/second
language system | total runtime: language en is active<protectionstate 0>...468
</nowiki></pre>
Don’t be worried. This is == View the way it should look. Once texexec has finished, it will leave behind a generated PDF file called == Open the generated <tt>hello.pdf</tt>PDF file using a [http://en.wikipedia.org/wiki/List_of_PDF_software#Viewers PDF viewer]. Open it and you will see a It should look as follows: <context mode="Hello worldmkiv" >% 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.\stopsection\stoptext</context> Note that the section has been numbered, the section number and the section title appear in a virtual A4 paper slightly larger fonts, and the emphasized word comes out in a page numberslanted 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] \starttext\startsection[title={Testing ConTeXt}] This is my {\em first} ConTeXt document.\stopsection\stoptext</context>
> [[Second Step]]{{Getting started navbox}}

Navigation menu