Difference between revisions of "Command/setuptyping"
< Command
Jump to navigation
Jump to search
(replace MkII syntax, fix explanation) |
|||
(2 intermediate revisions by 2 users not shown) | |||
Line 7: | Line 7: | ||
<syntax>setuptyping</syntax> | <syntax>setuptyping</syntax> | ||
− | |||
== Description == | == Description == | ||
− | Changes options for displaying verbatim text. When called with a single argument, this command changes the options for | + | Changes options for displaying verbatim text. When called with a single argument, this command changes the options for all typing environments: {{cmd|starttyping}}, {{cmd|startTEX}} etc. as well as {{cmd|typefile}}. |
− | {{cmd| | + | With the optional argument, it affects only specific typing environment (as created with {{cmd|definetyping}}). |
− | + | {{cmd|setuptyping}} can be used multiple times to change options, and options will stay in effect until the end of file. | |
* space | * space | ||
Line 28: | Line 27: | ||
** {2,+3}: line 2 to 5 | ** {2,+3}: line 2 to 5 | ||
** {label:start,label:end}: from label:start to label:end (comments in code) | ** {label:start,label:end}: from label:start to label:end (comments in code) | ||
+ | |||
+ | * strip | ||
+ | ** yes: Remove leading white space while keeping relative indentation between lines. | ||
The <code>option</code> option is for the type of colorization. E.g., to turn off colorization in <code>\startLUA</code> blocks: | The <code>option</code> option is for the type of colorization. E.g., to turn off colorization in <code>\startLUA</code> blocks: | ||
Line 35: | Line 37: | ||
== Example == | == Example == | ||
− | |||
− | |||
<context source=yes> | <context source=yes> | ||
\setuptyping | \setuptyping | ||
− | [before={\startframedtext[width=\ | + | [before={\startframedtext[width=\textwidth, |
− | background= | + | background=color, |
− | + | backgroundcolor=lightgray]}, | |
after={\stopframedtext}] | after={\stopframedtext}] | ||
− | |||
\starttyping | \starttyping | ||
This is a \test{} | This is a \test{} | ||
Line 51: | Line 50: | ||
is printed just as I write it | is printed just as I write it | ||
\stoptyping | \stoptyping | ||
− | \ | + | |
+ | \startTEX | ||
+ | This is a \test{} | ||
+ | \stopTEX | ||
</context> | </context> | ||
Latest revision as of 17:28, 29 July 2023
\setuptyping
Syntax (autogenerated)
\setuptyping[...,...][...=...,...] | |
[...,...] | name |
oddmargin | dimension |
evenmargin | dimension |
margin | yes no standard dimension |
option | mp lua xml parsed-xml nested tex context none name |
style | style command |
color | color |
align | see \setupalign |
lines | yes no normal hyphenated |
space | on off normal fixed stretch |
keeptogether | yes no |
before | command |
after | command |
strip | yes no number |
range | number name |
tab | yes no number |
escape | yes no text processor->text |
indentnext | yes no auto |
continue | yes no |
start | number |
stop | number |
step | number |
numbering | file line no |
blank | see \blank |
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.
- space
- fixed: Lines will not be broken, even if too long (may cause "overfull hbox" message)
- lines
- no (default): no hyphenation
- yes: no hyphenation and left aligned text (align key is ignored)
- hyphenated: hyphenation
- range
- {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)
- strip
- yes: Remove leading white space while keeping relative indentation between lines.
The option
option is for the type of colorization. E.g., to turn off colorization in \startLUA
blocks:
\setuptyping[LUA][option=]
Example
\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
See also
- \typefile to print files verbatim
- \starttyping to print lines verbatim
- \definetyping to define a custom typing environment
- buff-ver.mkiv source code
- \setuplinenumbering
Help from ConTeXt-Mailinglist/Forum
All issues with: