Changes

Jump to navigation Jump to search
2,372 bytes added ,  21:36, 14 May 2015
m
no edit summary
The output of the above shows that both are similar with placefigure having extra White space, but is it semantically different?
 
= Old text =
= Pictures =
 
This section describes various ways to embed pictures in documents.
 
== In Text ==
 
You can directly place a figure in a text using <tt>\externalfigure[cow]</tt>. If you want to align it not to the baseline, but lower you can try whether <tt>\bbox{\externalfigure[cow]}</tt> does the right thing, otherwise you have to tweek <tt>\smash{\lower24pt\hbox{\externalfigure[cow]}}</tt>
 
== Flowing Text ==
 
<context source=yes mode=mkiv>
\setuppapersize[A5]
\setupexternalfigures[location={local,default}]
\starthanging{\externalfigure[cow][width=4cm]}
\input tufte
\stophanging
</context>
 
{{cmd|starthanging}} is influenced by {{cmd|setuphanging}}, but doesn’t take parameters itself.
It’s currently broken in MkII (here in the garden), but works with MkIV.
 
To right-align the image:
 
<texcode>
\setuppapersize[A5]
\setupexternalfigures[location={local,default}]
\setuphanging[location=right]
\starthanging{\externalfigure[cow][width=4cm]}
\input tufte
\stophanging
</texcode>
 
There are more options (distance can even be negative):
 
<texcode>
\setuppapersize[A5]
\setupexternalfigures[location={local,default}]
\setuphanging[location=right,n=2,distance=1cm]
\starthanging{\externalfigure[cow][width=4cm]}
\input tufte
\stophanging
</texcode>
 
Parameter <tt>n</tt> defines how many lines should flow around, useful for pictures with whitespace below.
 
This replaces undocumented {{cmd|starthangaround}} command that might exist [http://source.contextgarden.net/tex/context/base/cont-new.mkiv?search=hangaround in the source], if the wiki isn’t updated yet.
 
Also read about [[Combinations]].
 
== Hyperlinks ==
 
This example makes a picture interactive; when clicked, it opens a browser to the given URL:
 
<texcode>
\setupinteraction[state=start]
 
\starttext
This is a cow: \goto{\externalfigure[cow][height=2ex]}[url(http://en.wikipedia.org/wiki/Cow)]
\stoptext
</texcode>
 
== Full Page ==
 
* See [[Simple Cover Page]]
 
 
=== Enlarged, Shaded Background ===
 
To place a figure in the right margin with a shaded background that is slightly larger than the figure (to give a bit of space):
 
<texcode>
\setupcolors[state=start]
\placefigure[right,high,none]{}{\framed[frame=on, offset=10pt, framecolor=lightgray,
background=color, backgroundcolor=lightgray]%
{\externalfigure[sample/cow.pdf][scale=500]}}
\input knuth
</texcode>

Navigation menu