Difference between revisions of "First Document"

From Wiki
Jump to navigation Jump to search
 
(24 intermediate revisions by 7 users not shown)
Line 1: Line 1:
< [[Main Page]] | [[Second Step]] | [[Next Steps]] >
+
== Modifying the output style ==
  
{{todo|mention MKII and IV and both texexec and context already at this step}}
+
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
  
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].
+
<context mode="mkiv" source="yes" text="which gives">
 +
\setuphead[section][style=\bfa]
 +
\setupbodyfontenvironment[default][em=italic]
  
Start by typing the following into a [[Text Editors|text editor]] and saving it as <code>hello.tex</code>:
 
 
<texcode>
 
\starttext
 
Hello World
 
\stoptext
 
</texcode>
 
 
Then go to the command-line and type:
 
 
<pre>
 
texexec hello.tex
 
</pre>
 
 
ConTeXt will then process your document. It will output some information, such as follows—this output does ''not'' indicate an error:
 
 
<pre><nowiki>
 
TeXExec | processing document 'hello.tex'
 
TeXExec | no ctx file found
 
TeXExec | tex processing method: context
 
TeXExec | TeX run 1
 
TeXExec | writing option file hello.top
 
TeXExec | tex engine: pdfetex
 
TeXExec | tex format: cont-en
 
TeXExec | progname: context
 
This is pdfeTeXk, Version 3.141592-1.30.3-2.2 (Web2c 7.5.5)
 
\write18 enabled.
 
%&-line parsing enabled.
 
(c:\context\usr\local\context\tex\texmf-local/web2c/natural.tcx)
 
entering extended mode
 
(./hello.tex
 
 
ConTeXt  ver: 2006.05.14 23:57  fmt: 2006.5.16  int: english  mes: english
 
 
language        : language en is active
 
<protectionstate 0>
 
...
 
</nowiki></pre>
 
 
Once <tt>texexec</tt> has finished, it will leave behind a file called <tt>hello.pdf</tt>. Open it and you will see a "Hello world" document.
 
 
<context source="no">
 
 
\starttext
 
\starttext
Hello World
+
\startsection[title={Testing ConTeXt}]
 +
  This is my {\em first} ConTeXt document.
 +
\stopsection
 
\stoptext
 
\stoptext
 
</context>
 
</context>
  
 
+
[[Category:Basics]]
&rarr; [[Second Step]]
+
[[Category:Sample documents]]

Latest revision as of 19:18, 14 April 2024

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

\setuphead[section][style=\bfa]
\setupbodyfontenvironment[default][em=italic]

\starttext
\startsection[title={Testing ConTeXt}]
  This is my {\em first} ConTeXt document.
\stopsection
\stoptext

which gives