Open main menu


\setuptyping

Summary

The command \setuptyping is used to setup verbatim text (code highlighting).

Settings

\setuptyping[...,...][...=...,...]
[...,...]name
oddmargindimension
evenmargindimension
marginyes no standard dimension
optionmp lua xml parsed-xml nested tex context none name
stylestyle command
colorcolor
alignsee \setupalign
linesyes no normal hyphenated
spaceon off normal fixed stretch
keeptogetheryes no
beforecommand
aftercommand
stripyes no number
rangenumber name
tabyes no number
escapeyes no text processor->text
indentnextyes no auto
continueyes no
startnumber
stopnumber
stepnumber
numberingfile line no
blanksee \blank

OptionExplanation
option
The type of colorization (syntax highlighting).
mp MetaPost
lua Lua
xml XML
tex TeX
context ConTeXt
none no highlighting
name other (self-defined)
lines
yes no hyphenation and left aligned text (align key is ignored)
no no hyphenation
hyphenated hyphenation
space
fixed Lines will not be broken, even if too long (may cause “overfull hbox” messages)
strip
yes Remove leading whitespace while keeping relative indentation between lines.
no Leave whitespace
range
Limitation of display, e.g. to hide setup code

- {2,5}: line 2 to 5 - {2,+3}: line 2 to 5

- {label:start,label:end}: from label:start to label:end (comments in code)
escape
Process macros between /BTEX and /ETEX instead of highlighting them, e.g. to add formatted text or references.
continue
see \setuplinenumbering
start
see \setuplinenumbering
stop
see \setuplinenumbering
step
see \setuplinenumbering
numbering
see \setuplinenumbering

Description

Changes options for displaying verbatim text. When called with a single argument, this command changes the options for all typing environments: \starttyping, \startTEX etc. as well as \typefile.

With the optional argument, it affects only specific typing environment (as created with \definetyping).

\setuptyping can be used multiple times to change options, and options will stay in effect until the end of file.

Examples

Example 1

\setuptyping
   [before={\startframedtext[width=\textwidth,
                             background=color,
                             backgroundcolor=lightgray]},
    after={\stopframedtext}]

\starttyping
This is a \test{}
    and everything
  is printed just as I write it
\stoptyping

\startTEX
This is a \test{}
\stopTEX

Notes

See also

Help from ConTeXt-Mailinglist/Forum