Difference between revisions of "Command/setuptyping"

From ConTeXt wiki
Jump to navigationJump to search
m (Text replace - "== Help from ConTeXt-Forum ==" to "== Help from ConTeXt-Forum == All issues with:")
 
(10 intermediate revisions by 7 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>
 
  
 +
<syntax>setuptyping</syntax>
  
 
== 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|\starttyping]]. When the optional argument is given, it identifies a specific typing environment (as created with [[cmd:definetyping|\definetyping]]).
+
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}}).
  
[[cmd:setuptyping|\setuptyping]] can be used multiple times to change options and options will stay in effect until the end of file.
+
{{cmd|setuptyping}} can be used multiple times to change options and options will stay in effect until the end of file.
  
Note that [[cmd:setuptyping|\setuptyping]] also affects the display of the [[cmd:typefile|\typefile]] command.
+
Note that {{cmd|setuptyping}} also affects the display of the {{cmd|typefile}} command.
  
 
* space
 
* space
Line 118: Line 23:
 
**  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)
 +
 
 +
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 ==
  
<texcode>
+
Note that background=screen,backgroundscreen=.8 is depricated in MKIV and should be replaced by something like background=color,backgroundcolor=lightgray.
\setuptyping
+
 
 +
<context source=yes>
 +
\setuptyping
 
   [before={\startframedtext[width=\makeupwidth,
 
   [before={\startframedtext[width=\makeupwidth,
 
                             background=screen,
 
                             background=screen,
Line 128: Line 45:
 
     after={\stopframedtext}]
 
     after={\stopframedtext}]
  
\starttext
+
\starttext
\starttyping
+
\starttyping
test
+
This is a \test{}
\stoptyping
+
    and everything
\stoptext
+
  is printed just as I write it
</texcode>
+
\stoptyping
 
+
\stoptext
 +
</context>
  
 
== See also ==
 
== See also ==
[[cmd:typefile|\typefile]], [[cmd:starttyping|\starttyping]], [[cmd:definetyping|\definetyping]]
+
* {{cmd|typefile}} to print files verbatim
 
+
* {{cmd|starttyping}} to print lines verbatim
 +
* {{cmd|definetyping}} to define a custom typing environment
 +
* {{src|buff-ver.mkiv}} source code
 +
* {{cmd|setuplinenumbering}}
  
== Help from ConTeXt-Forum ==
+
== Help from ConTeXt-Mailinglist/Forum ==
 
All issues with:
 
All issues with:
 
{{Forum|{{SUBPAGENAME}}}}
 
{{Forum|{{SUBPAGENAME}}}}
  
[[Category:Commands|setuptyping]]
+
[[Category:Command/Verbatim Text|setuptyping]]

Latest revision as of 20:46, 13 January 2020

\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


\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 the default typing environment as created with \starttyping. When the optional argument is given, it identifies a 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.

Note that \setuptyping also affects the display of the \typefile command.

  • 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)

The option option is for the type of colorization. E.g., to turn off colorization in \startLUA blocks:

\setuptyping[LUA][option=]

Example

Note that background=screen,backgroundscreen=.8 is depricated in MKIV and should be replaced by something like background=color,backgroundcolor=lightgray.

\setuptyping
   [before={\startframedtext[width=\makeupwidth,
                             background=screen,
                             backgroundscreen=.8]},
    after={\stopframedtext}]

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

See also

Help from ConTeXt-Mailinglist/Forum

All issues with: