Difference between revisions of "First Document"

From Wiki
Jump to navigation Jump to search
 
 
(40 intermediate revisions by 12 users not shown)
Line 1: Line 1:
What is ConTeXt? What can I do with it? Let’s see. Take your favourite text editor and type in the following document. Save it as file hello.tex.
+
== 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]
  
<pre>
 
 
\starttext
 
\starttext
Hello World
+
\startsection[title={Testing ConTeXt}]
 +
  This is my {\em first} ConTeXt document.
 +
\stopsection
 
\stoptext
 
\stoptext
</pre>
+
</context>
 
 
Now go to the shell/command line and type in
 
 
 
<pre><nowiki>
 
texexec --pdf hello.tex
 
 
 
  and now ConTeXt will start. It will give you some output on your terminal 
 
TeXExec 4.3 - ConTeXt / PRAGMA ADE 1997-2004
 
 
 
            executable : pdfetex
 
                format : cont-en
 
            inputfile : test
 
                output : standard
 
            interface : en
 
              options : once nonstop
 
          current mode : none
 
 
 
This is pdfeTeXk, Version 3.141592-1.11a-2.1 (Web2C 7.5.2)
 
\write18 enabled.
 
%&-line parsing enabled.
 
(/opt/texlive/8/texmf/web2c/cp8bit.tcx)
 
entering extended mode
 
(./test.tex{pdftex.cfg}
 
 
 
ConTeXt  ver: 2004.4.9  fmt: 2004.4.16  int: english  mes: english
 
 
 
language      : language en is active
 
<protectionstate 0>
 
...
 
</nowiki></pre>
 
  
Don’t be worried. This is the way it should look. Once texexec has finished, it will leave behind a file called hello.pdf. Open it and you will see a Hello world on a virtual A4 paper and a page number.
+
[[Category:Basics]]
 +
[[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