Difference between revisions of "Command/ attachment"
< Command
Jump to navigation
Jump to search
(5 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | |||
− | |||
<cd:commandgroup generated="yes" name="attachment" xmlns:cd="http://wiki.contextgarden.net/commanddoc/20200807"> | <cd:commandgroup generated="yes" name="attachment" xmlns:cd="http://wiki.contextgarden.net/commanddoc/20200807"> | ||
− | <cd:shortdesc> | + | <cd:shortdesc><!-- a short command summary goes here --> |
− | <!-- a short command summary goes here --> | ||
The instances of <tt>\<i>attachment</i></tt> are used for inclusion of attachment files into the PDF output. | The instances of <tt>\<i>attachment</i></tt> are used for inclusion of attachment files into the PDF output. | ||
</cd:shortdesc> | </cd:shortdesc> | ||
Line 26: | Line 23: | ||
</cd:command> | </cd:command> | ||
</cd:variants> | </cd:variants> | ||
− | <cd:description> | + | <cd:description>Additional documentation can be found in the [http://www.pragma-ade.com/general/manuals/interaction.pdf#page=29 "Interaction" manual].</cd:description> |
− | + | <cd:examples><cd:example title="Use of attachment with customized symbol (the file "myattachment.txt" should exists, that why the demo here does not show attachment...)">[[File:Screenshot_20201128_121950.png|800px]] | |
− | </cd:description> | + | |
− | <cd:examples> | + | <context source="yes" text="produces"> |
− | + | \setuppapersize[A6,landscape] | |
− | <cd:example title=""> | + | |
− | < | + | %------------------------------------------------------------------------------ |
− | -- | + | |
− | + | \setupinteraction[state=start] % #0 - Activate interaction | |
− | + | ||
− | + | %------------------------------------------------------------------------------ | |
− | + | ||
− | </cd: | + | \startuseMPgraphic{myattachmentsymbol} % #1 - Draw a symbol, here a paperclip! |
− | + | path pa; | |
− | </cd:notes> | + | numeric u; u=1mm; |
+ | numeric Ra; Ra=u/2; numeric Rb; Rb=1.5Ra; numeric Rc; Rc=1.35Rb; | ||
+ | numeric La; La=3.5u; numeric Lb; Lb=-La/10; numeric Lc; Lc=1.2*La; | ||
+ | |||
+ | pair a[]; | ||
+ | a0=(0,0); | ||
+ | a1=(La,0); a2=(La+Ra,-Ra); a3=(La,-2Ra); | ||
+ | a4=(Lb,-2Ra); a5=(Lb-Rb,-2Ra+Rb); a6=(Lb,-2Ra+2Rb); | ||
+ | a7=(Lc,-2Ra+2Rb); a8=(Lc+Rc,-2Ra+2Rb-Rc); a9=(Lc,-2Ra+2Rb-2Rc); | ||
+ | a10=(1u,-2Ra+2Rb-2Rc); | ||
+ | |||
+ | pa := (a0--a1..a2..a3--a4..a5..a6--a7..a8..a9--a10) rotated 45; | ||
+ | |||
+ | path pb; | ||
+ | pb := fullcircle scaled (2.2*(Lc-Lb-Rb)) shifted (center(pa)) ; | ||
+ | fill pb withcolor 0.5white; | ||
+ | pickup pencircle scaled (1.5*(Rb-Ra)) ; | ||
+ | draw pa withcolor white; | ||
+ | \stopuseMPgraphic | ||
+ | |||
+ | %------------------------------------------------------------------------------ | ||
+ | |||
+ | \definesymbol % #2 - Define the drawing as a symbol | ||
+ | [myattachmentsym] | ||
+ | [\useMPgraphic{myattachmentsymbol}] | ||
+ | |||
+ | %------------------------------------------------------------------------------ | ||
+ | |||
+ | \setupattachments % #3 - Use the symbol for attachment | ||
+ | [symbol=myattachmentsym] | ||
+ | |||
+ | %------------------------------------------------------------------------------ | ||
+ | |||
+ | \starttext % #4 - Use it | ||
+ | |||
+ | Text before | ||
+ | \attachment | ||
+ | [file={myattachment.txt}, | ||
+ | title={attachment title}, | ||
+ | location=rightmargin] | ||
+ | and after. | ||
+ | |||
+ | \stoptext | ||
+ | |||
+ | </context> | ||
+ | |||
+ | </cd:example></cd:examples> | ||
+ | <cd:notes></cd:notes> | ||
<cd:seealso> | <cd:seealso> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
<cd:commandref name="_startattachment" originator="system"></cd:commandref> | <cd:commandref name="_startattachment" originator="system"></cd:commandref> | ||
<cd:commandref name="defineattachment" originator="system"></cd:commandref> | <cd:commandref name="defineattachment" originator="system"></cd:commandref> | ||
<cd:commandref name="setupattachment" originator="system"></cd:commandref> | <cd:commandref name="setupattachment" originator="system"></cd:commandref> | ||
− | <cd:source file="scrn-wid.mkvi" originator="system"></cd:source> | + | <cd:source file="scrn-wid.mkvi" originator="system"></cd:source> |
− | <cd:wikipage originator="system" page="Category:Pdf"></cd:wikipage> | + | <cd:wikipage originator="system" page="Category:Pdf"></cd:wikipage> |
<cd:commandref name="registerattachment"></cd:commandref> | <cd:commandref name="registerattachment"></cd:commandref> | ||
<cd:commandref name="setupattachments"></cd:commandref> | <cd:commandref name="setupattachments"></cd:commandref> | ||
− | <cd:commandref name="placeattachments"></cd:commandref> | + | <cd:commandref name="placeattachments"></cd:commandref></cd:seealso> |
− | |||
− | </cd:seealso> | ||
</cd:commandgroup> | </cd:commandgroup> |
Latest revision as of 09:42, 13 December 2020
Contents
\attachment
Summary
The instances of \attachment are used for inclusion of attachment files into the PDF output.
Instances
\attachment |
Settings instance
Description
Additional documentation can be found in the "Interaction" manual.
Examples
Use of attachment with customized symbol (the file "myattachment.txt" should exists, that why the demo here does not show attachment...)
\setuppapersize[A6,landscape] %------------------------------------------------------------------------------ \setupinteraction[state=start] % #0 - Activate interaction %------------------------------------------------------------------------------ \startuseMPgraphic{myattachmentsymbol} % #1 - Draw a symbol, here a paperclip! path pa; numeric u; u=1mm; numeric Ra; Ra=u/2; numeric Rb; Rb=1.5Ra; numeric Rc; Rc=1.35Rb; numeric La; La=3.5u; numeric Lb; Lb=-La/10; numeric Lc; Lc=1.2*La; pair a[]; a0=(0,0); a1=(La,0); a2=(La+Ra,-Ra); a3=(La,-2Ra); a4=(Lb,-2Ra); a5=(Lb-Rb,-2Ra+Rb); a6=(Lb,-2Ra+2Rb); a7=(Lc,-2Ra+2Rb); a8=(Lc+Rc,-2Ra+2Rb-Rc); a9=(Lc,-2Ra+2Rb-2Rc); a10=(1u,-2Ra+2Rb-2Rc); pa := (a0--a1..a2..a3--a4..a5..a6--a7..a8..a9--a10) rotated 45; path pb; pb := fullcircle scaled (2.2*(Lc-Lb-Rb)) shifted (center(pa)) ; fill pb withcolor 0.5white; pickup pencircle scaled (1.5*(Rb-Ra)) ; draw pa withcolor white; \stopuseMPgraphic %------------------------------------------------------------------------------ \definesymbol % #2 - Define the drawing as a symbol [myattachmentsym] [\useMPgraphic{myattachmentsymbol}] %------------------------------------------------------------------------------ \setupattachments % #3 - Use the symbol for attachment [symbol=myattachmentsym] %------------------------------------------------------------------------------ \starttext % #4 - Use it Text before \attachment [file={myattachment.txt}, title={attachment title}, location=rightmargin] and after. \stoptext
produces