User:Solis/Quick Start

From Wiki
< User:Solis
Revision as of 22:08, 12 February 2025 by Solis (talk | contribs) (My sketch of a "quickstart" page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Installation

You can install ConTeXt from here.

ConTeXt is a compiler. Once installed, you must supply it with a ConTeXt source file (typically with .tex or .mkxl extension), and it will produce a PDF:

$ context myFile.mkxl

Basics

A simple ConTeXt file can be typeset like so:

  • \starttext
    Hello, words!
    
    To typeset a new paragraph, leave an empty line in the source code.
    Without an empty line, words in different lines are still considered part of the same paragraph.
    
    The end.
    \stoptext
    

    Everything that should be typeset in the output document goes between \starttext and \stoptext. As explained in the text, a new paragraph can be started by leaving an empty line in the source code.

Titles and sections

To add a title, section or chapter, simply use the \title, \section, \chapter commands:

  • \starttext
    \title{My First Document}
    
    \section{The beginnings}
    
    Hello, words!
    
    \section{The journey}
    
    Exciting developments.
    
    \subsection{The overworld}
    The hero heeds the Call to Adventure.
    
    \subsection{The underworld}
    The hero dives into the unknown, facing challenges and temptations.
    \stoptext
    

    The name of the title, section, etc. goes inside curly brackets. That's how commands work, and ConTeXt is full of them. They're how you'll tell the ConTeXt compiler how you'd like your document to look like. Note how ConTeXt takes care of the page and section numbering for you.

Formatting words and sentences

Formatting pieces of text is also done with commands:

  • I'm regular text, \italic{I am in italic!}
    
  • I'm regular text, \bold{I am in bold!}
    

and many others:

  • \smallcaps{Small caps},
    \slanted{slanted},
    \sans{sans serif},
    \type{typewriter},
    \bolditalic{and combinations},
    \color[red]{and colors!}
    

Setting things up

One of the biggest advantages of the way ConTeXt does things is its ability to separate form and content. Once the content has been typeset, we can give it whatever form we want, using \setup<command> commands.

Things like the paper size, font style, font size, how the titles and sections will look, and much more:

  • \setuppapersize[A6] % the default is A4
    \setupwhitespace[medium] % Whitespace between paragraphs
    \setupbodyfont[times, 9pt] % Font
    \setuppagenumbering[location=bottom]
    \setuphead[title][alternative=middle]
    \setuphead[section][numbercolor=orange]
    \setuphead[subsection][style=\italic]
    
    
    \starttext
    \title{My First Document}
    
    \section{The beginnings}
    
    Hello, words!
    
    \section{The journey}
    
    Exciting developments.
    
    \subsection{The overworld}
    The hero heeds the Call to Adventure.
    
    \subsection{The underworld}
    The hero dives into the unknown, facing challenges and temptations.
    \stoptext