Difference between revisions of "Command/defineconversion"

From ConTeXt wiki
Jump to navigationJump to search
(Add example of \definecoversion custom set)
m
Line 61: Line 61:
 
|}
 
|}
  
== Example ==
+
== Examples ==
  
== Change numbering in itemize to '(i)', '(ii)', ... ==
+
=== Change numbering in itemize to '(i)', '(ii)', ... ===
 
<context source=yes>
 
<context source=yes>
\setuppapersize[A7]
 
 
 
\defineconversion[bracketroman][(\romannumerals]
 
\defineconversion[bracketroman][(\romannumerals]
  
Line 78: Line 76:
 
</context>
 
</context>
  
== Define wholly new conversionset ==
+
=== Define wholly new conversionset ===
 
<context source=yes mode=mkiv>
 
<context source=yes mode=mkiv>
\setuppapersize[A7, landscape]
 
 
 
\defineconversion[inventory][<3,!,\math{\therefore},?]
 
\defineconversion[inventory][<3,!,\math{\therefore},?]
  
Line 92: Line 88:
 
\stopitemize
 
\stopitemize
 
\leftaligned{---Dorothy Parker, \quote{Inventory} (fragment)}
 
\leftaligned{---Dorothy Parker, \quote{Inventory} (fragment)}
 +
</context>
 +
 +
=== Conversion set of stars ===
 +
 +
<context source=yes mode=mkiv>
 +
\defineconversion[starred][\m{*},\m{**},\m{***}] % Math mode gives better spacing, thus \m{...}
 +
 +
\startitemize[starred,packed][stopper=,width=2.5em]
 +
    \item First,
 +
    \item second,
 +
    \item third.
 +
\stopitemize
 
</context>
 
</context>
  
 
== See also ==
 
== See also ==
 
+
* {{cmd|convertnumber}}
 
* {{cmd|setupitemize}}
 
* {{cmd|setupitemize}}
 
* {{cmd|startitemize}}
 
* {{cmd|startitemize}}

Revision as of 07:29, 1 November 2012

\defineconversion

Syntax

\defineconversion[...][...]
[...] name
[...] command text

Description

Predefined conversions:

a \characters
A \Characters
AK \cap\characters
KA \cap\characters
n \numbers
N \Numbers
m \mediaeval
i \romannumerals
I \Romannumerals
r \romannumerals
R \Romannumerals
KR \cap\romannumerals
RK \cap\romannumerals
g \greeknumerals
G \Greeknumerals
o \oldstylenumerals
O \oldstylenumerals
or \oldstyleromannumerals

Examples

Change numbering in itemize to '(i)', '(ii)', ...

\defineconversion[bracketroman][(\romannumerals]

Three be the things I shall never attain:
\startitemize[bracketroman, packed][stopper=), width=2em]
    \item Envy, 
    \item content, and 
    \item sufficient champagne.
\stopitemize
\leftaligned{---Dorothy Parker, \quote{Inventory} (fragment)}

Define wholly new conversionset

\defineconversion[inventory][<3,!,\math{\therefore},?]

Four are the things I'd been better without:
\startitemize[inventory, packed][stopper=, width=2em]
    \item Love, 
    \item curiosity,
    \item freckles,
    \item and doubt.
\stopitemize
\leftaligned{---Dorothy Parker, \quote{Inventory} (fragment)}

Conversion set of stars

\defineconversion[starred][\m{*},\m{**},\m{***}] % Math mode gives better spacing, thus \m{...}

\startitemize[starred,packed][stopper=,width=2.5em]
    \item First, 
    \item second,
    \item third.
\stopitemize

See also

Help from ConTeXt-Mailinglist/Forum

All issues with: