Changes

Jump to navigation Jump to search
188 bytes added ,  18:11, 21 October 2020
m
drafting this introduction
LIKE EVERYTHING IN THIS SANDBOX, THIS IS ONLY A DRAFT AND SHOULD NOT BE USED YET.
= An introduction to ConTeXt ==
ConTeXt has a very logical structure. Once you are familiar with its basic underlying principles, you will find that many of its commands seem quite natural.
== Delimiters in ConTeXt ==
One other useful thing to understand about ConTeXt is how it uses delimiters. Aside from ''start-stop'' commands, there There are two three main delimiters in ConTeXt:
# '''start-stop''' commands: you have learned about these above.
# '''square brackets''': arguments to ConTeXt commands are enclosed in [ ].
# '''curly braces''': in ConTeXt, { } are used as delimiters to group text as a single self-contained unit.
=== Curly braces ===
You have now seen examples of four of the five notational conventions listed aboveThere are three main ways that { } are used as delimiters to group text as a single unit: all of them except the ''curly braces'' notation.
To see one way # with commands that operate on the ''curly braces'' notation is used, note single unit that enclosing text in {{cmd|startframed}} {{cmd|stopframed}} is not follows them# to define the only way scope of switches (such as font switches)# to put use [ ] or , in a box around text. Another way, which is really just syntactic sugar for the same thing, is to used the {{cmd|framed}} command. This will put a box around the next single unit following it (ignoring whitespace). For example:argument
An example above of how { } are used with commands that operate on the single unit that follows them is:<context sourcetexcode>\definehighlight[definedTerm][style="yes">it]The quick brown \definedTerm{fox} jumped over the lazy \framed definedTerm{An exampledogs}.}</contexttexcode>In this case, {{code|\definedTerm}} is the type of command that operates on the single unit that follows it, so you need { } to indicate that the enclosed ''fox'' is what is to be operated on. A fair number of ConTeXt commands work this way: they may have some optional arguments that configure them enclosed in [ ], but whatever comes immediately after that is what the command is applied to.
This is an An example above of how ''curly braces'' notation is { } are used in ConTeXt. In order to delimit the single unit that follows it, you use { }. Although many of ConTeXt's commands involve {{code|start}}, {{code|stop}}, switches is:<texcode>The quick brown {{code|setup\em fox}}, or {{code|define}}, a fair number of them instead operate on jumped over the single unit following them, as lazy {{cmd|framed}} does. Some, like {{cmd|framed}\em dogs}, allow you to use either syntax.</texcode>
Another situation where text needs While this is not the best way to be treated as achieve this formatting, it is still valid. The {{code|\em}} is a single font switch, and it applies only to the grouped unit that it is when an argument contained in. The { } are used to a command takes some text that involves [ ]delimit this unit. For example, the following code works fine because the text for the section title doesn&rsquo;t contain [ ]:<context source="yes">\startsection[title=A section title]\stopsection</context>
HoweverTo see how { } are used to treat text within command arguments as a single unit, because notice that the following section title contains [ ], it wonexample doesn&rsquo;t work unless you do something to tell ConTeXt that those square brackets are not signaling produce the end of the function&rsquo;s argumentsdesired section title ''a[5] and other list elements'':
<context source="yes" text="produces">
\startsection[title=a[5] and other list elements]
Here is the text for this section.
\stopsection
</context>
One way to get around But this problem is to apply ''curly braces'' notation: enclose the title in { } so that ConTeXt will treat the title text as a single unit. Then it works just fine:
<context source="yes" text="produces">\startsection[title={a[5] , and other list elements}]Here is the text for this section.
\stopsection
</context>
You would run into a similar problem if your section title contained a comma. In any such situation, enclosing the value in { } solves the problem.
== Summary ==
You have now seen the three main types of ConTeXt commands (''start-stop'', ''setup'', and ''define'') and how to use them. You have also seen the three main types of delimiters that ConTeXt uses (''start-stop'' commands, [ ], and { }) and how to use them. Understanding only these things will get you pretty far in ConTeXt.
 
Of course, the basic concepts described in this introduction are by no means exhaustive. There is plenty more in ConTeXt to explore! But hopefully this introduction will at least help you make your way through the other documentation more readily. And below are some good places to start...
== Summary ==
Naturally not everything in ConTeXt is written using these five notational conventions. There are many further notational details to learn, and not everything in ConTeXt is completely consistent with these conventions. However, the design of ConTeXt really is if not entirely consistent at least highly consistent in using these conventions, so they serve as a useful guide when you are trying to figure out how best to use the powerful tools that ConTeXt offers.
== Some commands that use this notation What can I customize? ==
Here I'll put some commands.
53

edits

Navigation menu