Difference between revisions of "Command/ attachment"

From Wiki
Jump to navigation Jump to search
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
<?xml version='1.0'?>
 
<!-- this file was generated on 2020-08-20T09:05 -->
 
 
<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>
<!-- the long description of the command goes here -->
+
<cd:examples><cd:example title="Use of attachment with customized symbol (the file &quot;myattachment.txt&quot; 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">
<!--  command example(s)
+
\setuppapersize[A6,landscape]
<cd:example title="">
+
 
</cd:example>
+
%------------------------------------------------------------------------------
-->
+
 
</cd:examples>
+
\setupinteraction[state=start]                      % #0 - Activate interaction
<cd:notes>
+
 
<!-- this is for special remarks that do not fit elsewhere, like discovered bugs in specific context versions
+
%------------------------------------------------------------------------------
<cd:note author="..." date="...">
+
 
</cd:note>
+
\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>
<!-- one or more of these:
 
<cd:commandref name="xx"></cd:commandref>
 
<cd:wikipage  page="xx"></cd:wikipage>
 
<cd:url        url="https://xx"></cd:url>
 
<cd:manual    pdf="xx"></cd:manual>
 
<cd:source    file="xx"></cd:source>
 
-->
 
 
<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


\attachment

Summary

The instances of \attachment are used for inclusion of attachment files into the PDF output.

Instances

\attachment

Settings instance

\ATTACHMENT[...][...=...,...]
[...]name
...=...,...inherits from \setupattachment

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...)

Screenshot 20201128 121950.png

\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


Notes

See also

Help from ConTeXt-Mailinglist/Forum

All issues with: