Difference between revisions of "Command/setupdelimitedtext"

From Wiki
Jump to navigation Jump to search
(Added info about repeat and middle keys)
(Example posted on TeX.SE http://tex.stackexchange.com/a/110610/323)
Line 113: Line 113:
 
   \quotation{Clancy's gone to Queensland droving, and we don't know where he are.}
 
   \quotation{Clancy's gone to Queensland droving, and we don't know where he are.}
 
\stopmydt
 
\stopmydt
 +
</context>
 +
 +
=== Smart parenthesis ===
 +
<context mode="mkiv" source="yes">
 +
\definedelimitedtext[parenthesis][location=text]
 +
\setupdelimitedtext [parenthesis:1] [left={(}, right={)}]
 +
\setupdelimitedtext [parenthesis:2] [left={[}, right={]}]
 +
\setupdelimitedtext [parenthesis:3] [left={\{}, right={\}}]
 +
 +
\starttext
 +
 +
\parenthesis{My outer layer \parenthesis{my inner layer \parenthesis{my innermost layer}}}
 +
 +
\stoptext
 
</context>
 
</context>
  

Revision as of 04:37, 25 April 2013

\setupdelimitedtext

Syntax

\setupdelimitedtext[name][n][...,...=...,...]
[name] name of the delimitedtext to set up
[n] (optional) nesting level to set up
(1 = outermost)
location margin text paragraph: function unknown
spacebefore dimension: space above delimitedtext fragment
spaceafter dimension, spacebefore by default: space below delimitedtext fragment
style normal bold italic, etc
color color
leftmargin dimension: distance to edge of the page's left margin area
rightmargin dimension, leftmargin by default
indentnext yes no
before command
after command
left text
middle text
right text
level=0, unknown, 0 by default
repeat no yes
method unknown


Description

Set up the appearance of a delimitedtext environment defined earlier with \definedelimitedtext. \quotation and \quote are delimitedtexts, too, so you can also set up those with this command; but for those you can also use the special commands \setupquotation and \setupquote.

Most of the parameters are self-explanatory, but two things should be borne in mind:

  • Nearly all of the parameters apply only if the new kind of text is invoked with \startmydelimitedtext: if one uses \mydelimitedtext{...}, only left and right have any effect.
  • leftmargin contains the distance to the actual left margin, not to the edge of the body text. If the new delimitedtext inherits from quotation, the text will be indented a bit with respect to the body text; if you want to line them up, set the leftmargin to \leftmargindistance rather than to 0pt.

Example

\definedelimitedtext[mydt]
\setupdelimitedtext[mydt][left=\leftguillemot,right=\rightguillemot]

\quotation{Clancy of the Overflow}, by Banjo Paterson

\startmydt
  And an answer came directed in a manner unexpected, and I
  think the same was written with a thumbnail dipped in tar;
  't was his shearing-mate who wrote it, and verbatim I will quote it:
  \quotation{Clancy's gone to Queensland droving, and we don't know where he are.}
\stopmydt

Smart parenthesis

\definedelimitedtext[parenthesis][location=text]
\setupdelimitedtext [parenthesis:1] [left={(}, right={)}]
\setupdelimitedtext [parenthesis:2] [left={[}, right={]}]
\setupdelimitedtext [parenthesis:3] [left={\{}, right={\}}]

\starttext

\parenthesis{My outer layer \parenthesis{my inner layer \parenthesis{my innermost layer}}}

\stoptext

Multiparagraph quotations

In English typography there is a custom of opening each paragraph in a multiparagraph quotation with a "repeated" opening quotation sign. This behavior may be turned on using the repeat switch and middle key, for example:

\setupquotation[repeat=yes, middle=]                % or equivalently
\setupdelimitedtext[quotation][repeat=yes, middle=]

See also

Help from ConTeXt-Mailinglist/Forum

All issues with: