Difference between revisions of "Command/setuptyping"

From Wiki
Jump to navigation Jump to search
m (Improve formatting a bit)
(replace MkII syntax, fix explanation)
 
(9 intermediate revisions by 5 users not shown)
Line 4: Line 4:
 
}}
 
}}
  
== [[Help:Reference|Syntax]] ==
+
== [[Help:Reference|Syntax]] (autogenerated) ==
<table cellspacing="4" cellpadding="2" class="cmd">
+
<syntax>setuptyping</syntax>
  <tr>
+
 
    <td colspan="2" class="cmd">\setuptyping<span class="first" style="color:red;">[...]</span><span class="second" >[...,...=...,...]</span></td>
 
  </tr>
 
  <tr valign="top" class="first">
 
    <td class="cmd">[...]</td>
 
    <td>file typing name </td>
 
  </tr>
 
  <tr valign="top" class="second">
 
    <td class="cmd">[[Command/keyword:space|space]]</td>
 
    <td>[[Command/value:on|on]] [[Command/value:off|off]] [[Command/value:fixed|fixed]] </td>
 
  </tr>
 
  <tr valign="top" class="second">
 
    <td class="cmd">[[Command/keyword:page|page]]</td>
 
    <td>[[Command/value:yes|yes]] [[Command/value:no|no]] </td>
 
  </tr>
 
  <tr valign="top" class="second">
 
    <td class="cmd">[[Command/keyword:option|option]]</td>
 
    <td>[[Command/value:slanted|slanted]] [[Command/value:normal|normal]] [[Command/value:commands|commands]] [[Command/value:color|color]] [[Command/value:none|none]] </td>
 
  </tr>
 
  <tr valign="top" class="second">
 
    <td class="cmd">[[Command/keyword:text|text]]</td>
 
    <td>[[Command/value:yes|yes]] [[Command/value:no|no]] </td>
 
  </tr>
 
  <tr valign="top" class="second">
 
    <td class="cmd">[[Command/keyword:icommand|icommand]]</td>
 
    <td>[[Command/value:command|command]] </td>
 
  </tr>
 
  <tr valign="top" class="second">
 
    <td class="cmd">[[Command/keyword:vcommand|vcommand]]</td>
 
    <td>[[Command/value:command|command]] </td>
 
  </tr>
 
  <tr valign="top" class="second">
 
    <td class="cmd">[[Command/keyword:ccommand|ccommand]]</td>
 
    <td>[[Command/value:command|command]] </td>
 
  </tr>
 
  <tr valign="top" class="second">
 
    <td class="cmd">[[Command/keyword:before|before]]</td>
 
    <td>[[Command/value:command|command]] </td>
 
  </tr>
 
  <tr valign="top" class="second">
 
    <td class="cmd">[[Command/keyword:after|after]]</td>
 
    <td>[[Command/value:command|command]] </td>
 
  </tr>
 
  <tr valign="top" class="second">
 
    <td class="cmd">[[Command/keyword:margin|margin]]</td>
 
    <td>[[Command/value:dimension|dimension]] [[Command/value:standard|standard]] [[Command/value:yes|yes]] [[Command/value:no|no]] </td>
 
  </tr>
 
  <tr valign="top" class="second">
 
    <td class="cmd">[[Command/keyword:evenmargin|evenmargin]]</td>
 
    <td>[[Command/value:dimension|dimension]] </td>
 
  </tr>
 
  <tr valign="top" class="second">
 
    <td class="cmd">[[Command/keyword:oddmargin|oddmargin]]</td>
 
    <td>[[Command/value:dimension|dimension]] </td>
 
  </tr>
 
  <tr valign="top" class="second">
 
    <td class="cmd">[[Command/keyword:blank|blank]]</td>
 
    <td>[[Command/value:dimension|dimension]] [[Command/value:small|small]] [[Command/value:medium|medium]] [[Command/value:big|big]] [[Command/value:standard|standard]] [[Command/value:halfline|halfline]] [[Command/value:line|line]] </td>
 
  </tr>
 
  <tr valign="top" class="second">
 
    <td class="cmd">[[Command/keyword:escape|escape]]</td>
 
    <td>[[Command/value:character|character]] </td>
 
  </tr>
 
  <tr valign="top" class="second">
 
    <td class="cmd">[[Command/keyword:tab|tab]]</td>
 
    <td>[[Command/value:number|number]] [[Command/value:yes|yes]] [[Command/value:no|no]] </td>
 
  </tr>
 
  <tr valign="top" class="second">
 
    <td class="cmd">[[Command/keyword:indentnext|indentnext]]</td>
 
    <td>[[Command/value:yes|yes]] [[Command/value:no|no]] </td>
 
  </tr>
 
  <tr valign="top" class="second">
 
    <td class="cmd">[[Command/keyword:style|style]]</td>
 
    <td>[[Command/value:normal|normal]] [[Command/value:bold|bold]] [[Command/value:slanted|slanted]] [[Command/value:boldslanted|boldslanted]] [[Command/value:type|type]] [[Command/value:cap|cap]] [[Command/value:small...|small...]] [[Command/value:command|command]] </td>
 
  </tr>
 
  <tr valign="top" class="second">
 
    <td class="cmd">[[Command/keyword:color|color]]</td>
 
    <td>[[Command/value:name|name]] </td>
 
  </tr>
 
  <tr valign="top" class="second">
 
    <td class="cmd">[[Command/keyword:palet|palet]]</td>
 
    <td>[[Command/value:name|name]] </td>
 
  </tr>
 
  <tr valign="top" class="second">
 
    <td class="cmd">[[Command/keyword:lines|lines]]</td>
 
    <td>[[Command/value:yes|yes]] [[Command/value:no|no]] [[Command/value:hyphenated|hyphenated]] </td>
 
  </tr>
 
  <tr valign="top" class="second">
 
    <td class="cmd">[[Command/keyword:empty|empty]]</td>
 
    <td>[[Command/value:yes|yes]] [[Command/value:all|all]] [[Command/value:no|no]] </td>
 
  </tr>
 
  <tr valign="top" class="second">
 
    <td class="cmd">[[Command/keyword:numbering|numbering]]</td>
 
    <td>[[Command/value:line|line]] [[Command/value:file|file]] [[Command/value:no|no]] </td>
 
  </tr>
 
</table>
 
  
 
== Description ==  
 
== Description ==  
Changes options for displaying verbatim text. When called with a single argument, this command changes the options for the default typing environment as created with {{cmd|starttyping}}. When the optional argument is given, it identifies a specific typing environment (as created with {{cmd|definetyping}}).
+
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|setuptyping}} can be used multiple times to change options and options will stay in effect until the end of file.
+
With the optional argument, it affects only specific typing environment (as created with {{cmd|definetyping}}).
  
Note that {{cmd|setuptyping}} also affects the display of the {{cmd|typefile}} command.
+
{{cmd|setuptyping}} can be used multiple times to change options, and options will stay in effect until the end of file.
  
 
* space
 
* space
Line 117: Line 22:
 
**  yes:          no hyphenation and left aligned text (align key is ignored)
 
**  yes:          no hyphenation and left aligned text (align key is ignored)
 
**  hyphenated:  hyphenation
 
**  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 <code>option</code> option is for the type of colorization. E.g., to turn off colorization in <code>\startLUA</code> blocks:
 +
<pre>
 +
\setuptyping[LUA][option=]
 +
</pre>
 +
 
 
== Example ==
 
== Example ==
  
 
<context source=yes>
 
<context source=yes>
 
\setuptyping
 
\setuptyping
   [before={\startframedtext[width=\makeupwidth,
+
   [before={\startframedtext[width=\textwidth,
                             background=screen,
+
                             background=color,
                             backgroundscreen=.8]},
+
                             backgroundcolor=lightgray]},
 
     after={\stopframedtext}]
 
     after={\stopframedtext}]
  
\starttext
 
 
\starttyping
 
\starttyping
 
This is a \test{}
 
This is a \test{}
Line 133: Line 50:
 
   is printed just as I write it
 
   is printed just as I write it
 
\stoptyping
 
\stoptyping
\stoptext
+
 
 +
\startTEX
 +
This is a \test{}
 +
\stopTEX
 
</context>
 
</context>
  
Line 140: Line 60:
 
* {{cmd|starttyping}} to print lines verbatim
 
* {{cmd|starttyping}} to print lines verbatim
 
* {{cmd|definetyping}} to define a custom typing environment
 
* {{cmd|definetyping}} to define a custom typing environment
 +
* {{src|buff-ver.mkiv}} source code
 +
* {{cmd|setuplinenumbering}}
  
 
== Help from ConTeXt-Mailinglist/Forum ==
 
== Help from ConTeXt-Mailinglist/Forum ==

Latest revision as of 17:28, 29 July 2023

\setuptyping

Syntax (autogenerated)

\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



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

Help from ConTeXt-Mailinglist/Forum

All issues with: