Difference between revisions of "Command/startuserdata"

From Wiki
Jump to navigation Jump to search
(Created page with "Documentation for \startuserdata ... \stopuserdata")
 
 
(One intermediate revision by the same user not shown)
Line 20: Line 20:
 
   </cd:command>
 
   </cd:command>
 
</cd:variants>
 
</cd:variants>
<cd:description>The <code>userdata</code> environments provides a optional argument which let you unlike the the <code>\start ... \stop</code> environment pass your own values to the content of the environment.
+
<cd:description>The <code>userdata</code> environments provide a optional argument which let you pass your own values to the content of the environment.
  
New layouts for the environment can be created with the <code>\defineuserdataalternative</code> command.
+
It is possible to define a rendering setup by use of the <code>\defineuserdataalternative</code> command. Within that rendering setup, the actual userdata content is saved as a buffer and can be retrieved using <code>\getinlineuserdata</code>.  
 
</cd:description>
 
</cd:description>
<cd:examples><cd:example title=""><context source="yes">
+
<cd:examples><cd:example title="Simple use"><context source="yes">
 +
\defineuserdata
 +
  [epigraph]
 +
 
 +
\startuserdata [epigraph] [author={Sean B. Carrol}]
 +
    The fraction of fossil olfactory receptor genes is significantly higher in
 +
    all species with full color vision. This suggests that the evolution of
 +
    trichromatic vision --- which allows these primates to detect food, mates,
 +
    and danger with visual cues --- has reduced their reliance on the sense of
 +
    smell. \qquad \userdataparameter{author}
 +
\stopuserdata
 +
</context></cd:example><cd:example title="Using a rendering setup"><context source="yes">
 
\defineuserdataalternative [epigraph] [renderingsetup=userdata:epigraph]
 
\defineuserdataalternative [epigraph] [renderingsetup=userdata:epigraph]
  

Latest revision as of 10:36, 14 September 2023


\startuserdata ... \stopuserdata

Summary

The environment \startuserdata ... \stopuserdata is used for user-defined environments with arguments


Settings

\startuserdata[...][...=...,...] ... \stopuserdata
[...]name
keyvalue

Description

The userdata environments provide a optional argument which let you pass your own values to the content of the environment.

It is possible to define a rendering setup by use of the \defineuserdataalternative command. Within that rendering setup, the actual userdata content is saved as a buffer and can be retrieved using \getinlineuserdata.

Examples

Simple use

\defineuserdata
  [epigraph]

\startuserdata [epigraph] [author={Sean B. Carrol}]
    The fraction of fossil olfactory receptor genes is significantly higher in
    all species with full color vision. This suggests that the evolution of
    trichromatic vision --- which allows these primates to detect food, mates,
    and danger with visual cues --- has reduced their reliance on the sense of
    smell. \qquad \userdataparameter{author}
\stopuserdata

Using a rendering setup

\defineuserdataalternative [epigraph] [renderingsetup=userdata:epigraph]

\startsetups [userdata:epigraph]
    \startframedtext [location=right,frame=off,align={flushleft,broad},style=\tfx,offset=.25ex,width=.5\textwidth]
        \begstrut\getinlineuserdata\endstrut
        \hairline
        \wordright{\userdataparameter{author}}
    \stopframedtext
\stopsetups

\defineuserdata
  [epigraph]
  [alternative=epigraph]

\startuserdata [epigraph] [author={Sean B. Carrol}]
    The fraction of fossil olfactory receptor genes is significantly higher in
    all species with full color vision. This suggests that the evolution of
    trichromatic vision --- which allows these primates to detect food, mates,
    and danger with visual cues --- has reduced their reliance on the sense of
    smell.
\stopuserdata

Notes

See also

Help from ConTeXt-Mailinglist/Forum

All issues with: