Changes

Jump to navigation Jump to search
1,215 bytes added ,  16:44, 21 October 2020
m
Tweaking an Intro to ConTeXt
When you read this code, you can tell immediately that nouns are framed one way, and adjectives another. Since it uses {{cmd|defineframed}} and gives these customizations informative names, editing and maintaining this document is much easier. If you decide that you want to give all the adjectives some other type of frame, a simple change to the {{cmd|defineframed}} is all that is needed. There is no need to worry about going through with search and replace and trying to make sure that you find and update all the adjective frames. A single small change will make the update globally and consistently throughout the document.
Notice that it was worthwhile to define {{code|nounFramed}} even though it contained no customizations. Even though its current configuration is the same as the default configuration for frames, you might decide to change that later. If you don't set up the definition now, there will be no easy way to make changes to the frames for all nouns (and nothing else) later.
Of course not every command in ConTeXt is a ''start-stop'', ''setup'', or ''define'' command, but a large number of them are, including many of the most commonly used commands. If you understand the basic idea behind these types of commands, you will find that you are already able to do lots of things in ConTeXt.
 
 
== Your first ConTeXt document ==
Now that you have an idea of how ConTeXt is structured, let’s look at how you use that structure to make documents. Here is a very minimal example of a ConTeXt document:
== A minimal example: ''start-stop'' and ''setup'' notation ==
To see how these notational conventions get used, let’s start with a minimal example of a ConTeXt document:
<texcode>
\starttext
\input knuthHello, world!
\stoptext
</texcode>
Compiling this document typesets a built-in quotation from Knuth, which is inserted with {{code|\input knuth}}. (Throughout the ConTeXt documentation, you'll find this and other similarly built-in texts used to illustrate examples.) You can already see start-stop at work: the usual way of processing the entire text of the document is named {{code|text}}, so to apply it you enclose the document text in {{cmd|starttext}} {{cmd|stoptext}}.
When you compile this, it produces a page with a 1 in the center at the top and with the text: <context>Hello, world!</context> That's it &mdash; that's all you need to make a ConTeXt document! You can think of the code here this way: ConTeXt&rsquo;s way of formatting the entire text of the document is called {{code|text}}, so to apply that way of formatting you enclose the document text in {{cmd|starttext}} {{cmd|stoptext}}. == Starting to customize things ==When you compile this document, you'&rsquo;ll probably immediately see some things that you want to change. For example, the default paper size in ConTeXt is A4. This works well for most of the world, but if you&rsquo;re in the United States, you might prefer your paper size to be letter. That&rsquo;s easy enough. The way that paper is sized for a document in ConTeXt is called {{code|papersize}}. You could use {{cmd|definepapersize}} to define a {{code|letter}} configuration for {{code|papersize}}, but that is common enough that ConTeXt has defined it automatically: just {{code|letter}} is already built-in. Since you want to configure {{code|papersize}} globally for the entire document, use {{cmd|setuppapersize|[letter]}}.: 
<texcode>
\setuppapersize[letter]
\starttext
\input knuthHello, world!
\stoptext
</texcode>
This example uses the ''setup'' notation. The way Note that paper size is sized not the type of thing that you ordinarily set locally for a only part of the document in ConTeXt , so there is called no {{code|\startpapersize}} {{code|papersize\stoppapersize}}. You just configure it globally with {{cmd|setuppapersize}}, and if you want to define new paper sizes beyond what ConTeXt has already built-in, so you use {{cmd|setuppapersizedefinepapersize}} to configure it. The use of [ ] to enclose the argument is an example of the ''square brackets'' notation
Another thing you might like to change is the page numbering. By default, ConTeXt places a page number at the center of the top of the page. To put it at the center of the bottom of the page instead, you can use {{cmd|setuppagenumbering|[location{{=}}bottom]}}.
53

edits

Navigation menu