Difference between revisions of "Command/setupexternalfigure"

From Wiki
Jump to navigation Jump to search
(Created page with "Documentation for \setupexternalfigure")
 
m (Add \definegraphictypesynonym to 'See also')
 
(7 intermediate revisions by 4 users not shown)
Line 21: Line 21:
 
     </cd:parameter>
 
     </cd:parameter>
 
     <cd:parameter name="label">
 
     <cd:parameter name="label">
       <cd:paramdoc></cd:paramdoc>
+
       <cd:paramdoc>internal name</cd:paramdoc>
 
       <cd:constant type="cd:name"></cd:constant>
 
       <cd:constant type="cd:name"></cd:constant>
 
     </cd:parameter>
 
     </cd:parameter>
 
     <cd:parameter name="page">
 
     <cd:parameter name="page">
       <cd:paramdoc></cd:paramdoc>
+
       <cd:paramdoc>Page number of PDF.</cd:paramdoc>
 
       <cd:constant type="cd:number"></cd:constant>
 
       <cd:constant type="cd:number"></cd:constant>
 
     </cd:parameter>
 
     </cd:parameter>
 
     <cd:parameter name="object">
 
     <cd:parameter name="object">
       <cd:paramdoc></cd:paramdoc>
+
       <cd:paramdoc>Reuse this image file as an object, i.e. embed it only once in PDF if it’s used several times? </cd:paramdoc>
 
       <cd:constant default="yes" type="yes"></cd:constant>
 
       <cd:constant default="yes" type="yes"></cd:constant>
 
       <cd:constant type="no"></cd:constant>
 
       <cd:constant type="no"></cd:constant>
Line 38: Line 38:
 
     </cd:parameter>
 
     </cd:parameter>
 
     <cd:parameter name="method">
 
     <cd:parameter name="method">
       <cd:paramdoc></cd:paramdoc>
+
       <cd:paramdoc>force a file type (and processing), e.g. if there are different versions</cd:paramdoc>
 
       <cd:constant type="pdf"></cd:constant>
 
       <cd:constant type="pdf"></cd:constant>
 
       <cd:constant type="mps"></cd:constant>
 
       <cd:constant type="mps"></cd:constant>
Line 49: Line 49:
 
       <cd:constant type="gif"></cd:constant>
 
       <cd:constant type="gif"></cd:constant>
 
       <cd:constant type="tif"></cd:constant>
 
       <cd:constant type="tif"></cd:constant>
       <cd:constant type="mov"></cd:constant>
+
       <cd:constant type="mov">is removed from LMTX</cd:constant>
 
       <cd:constant type="buffer"></cd:constant>
 
       <cd:constant type="buffer"></cd:constant>
 
       <cd:constant type="tex"></cd:constant>
 
       <cd:constant type="tex"></cd:constant>
 
       <cd:constant type="cld"></cd:constant>
 
       <cd:constant type="cld"></cd:constant>
       <cd:constant type="auto"></cd:constant>
+
       <cd:constant type="auto">strips suffix and uses "order"</cd:constant>
 
     </cd:parameter>
 
     </cd:parameter>
 
     <cd:parameter name="controls">
 
     <cd:parameter name="controls">
       <cd:paramdoc></cd:paramdoc>
+
       <cd:paramdoc>Show media controls (for movies)</cd:paramdoc>
 
       <cd:constant type="yes"></cd:constant>
 
       <cd:constant type="yes"></cd:constant>
 
       <cd:constant default="yes" type="no"></cd:constant>
 
       <cd:constant default="yes" type="no"></cd:constant>
Line 70: Line 70:
 
     </cd:parameter>
 
     </cd:parameter>
 
     <cd:parameter name="resolution">
 
     <cd:parameter name="resolution">
       <cd:paramdoc></cd:paramdoc>
+
       <cd:paramdoc>Set the image resolution (after scaling) for automatic downsampling</cd:paramdoc>
       <cd:constant type="cd:number"></cd:constant>
+
       <cd:constant type="cd:number">dpi</cd:constant>
 
     </cd:parameter>
 
     </cd:parameter>
 
     <cd:parameter name="color">
 
     <cd:parameter name="color">
       <cd:paramdoc></cd:paramdoc>
+
       <cd:paramdoc>Colorize the image. Works only with some greyscale pictures (no channels, no additional tables, ...?) and only with toned (<tt>p=</tt>) or [[Spot_Colors|spot colors]]. Use with <cd:iref name="object" type="no"/></cd:paramdoc>
       <cd:constant type="cd:color"></cd:constant>
+
       <cd:constant type="cd:color">color name</cd:constant>
 
     </cd:parameter>
 
     </cd:parameter>
 
     <cd:parameter name="cmyk">
 
     <cd:parameter name="cmyk">
       <cd:paramdoc></cd:paramdoc>
+
       <cd:paramdoc>Force CMYK conversion</cd:paramdoc>
 
       <cd:constant type="yes"></cd:constant>
 
       <cd:constant type="yes"></cd:constant>
 
       <cd:constant default="yes" type="no"></cd:constant>
 
       <cd:constant default="yes" type="no"></cd:constant>
Line 84: Line 84:
 
     </cd:parameter>
 
     </cd:parameter>
 
     <cd:parameter name="arguments">
 
     <cd:parameter name="arguments">
       <cd:paramdoc></cd:paramdoc>
+
       <cd:paramdoc>used for converters</cd:paramdoc>
 
       <cd:constant type="cd:text"></cd:constant>
 
       <cd:constant type="cd:text"></cd:constant>
 
     </cd:parameter>
 
     </cd:parameter>
Line 93: Line 93:
 
     </cd:parameter>
 
     </cd:parameter>
 
     <cd:parameter name="factor">
 
     <cd:parameter name="factor">
       <cd:paramdoc></cd:paramdoc>
+
       <cd:paramdoc>If both <tt>width</tt> and <tt>height</tt> are set, the <tt>factor</tt> is important.
       <cd:constant type="fit"></cd:constant>
+
 
 +
If <cd:iref name="factor"/> is empty, the image is deformed accordingly.</cd:paramdoc>
 +
       <cd:constant type="fit">aspect ratio is kept, the image is scaled to the smaller (fitted) variant</cd:constant>
 
       <cd:constant type="broad"></cd:constant>
 
       <cd:constant type="broad"></cd:constant>
       <cd:constant type="max"></cd:constant>
+
       <cd:constant type="max">aspect ratio is kept, the image is scaled to the bigger (oversized) variant</cd:constant>
 
       <cd:constant type="auto"></cd:constant>
 
       <cd:constant type="auto"></cd:constant>
 
       <cd:constant type="default"></cd:constant>
 
       <cd:constant type="default"></cd:constant>
Line 117: Line 119:
 
     </cd:parameter>
 
     </cd:parameter>
 
     <cd:parameter name="maxwidth">
 
     <cd:parameter name="maxwidth">
       <cd:paramdoc></cd:paramdoc>
+
       <cd:paramdoc>maximum width</cd:paramdoc>
 
       <cd:constant type="cd:dimension"></cd:constant>
 
       <cd:constant type="cd:dimension"></cd:constant>
 
     </cd:parameter>
 
     </cd:parameter>
 
     <cd:parameter name="maxheight">
 
     <cd:parameter name="maxheight">
       <cd:paramdoc></cd:paramdoc>
+
       <cd:paramdoc>maximum height</cd:paramdoc>
 
       <cd:constant type="cd:dimension"></cd:constant>
 
       <cd:constant type="cd:dimension"></cd:constant>
 
     </cd:parameter>
 
     </cd:parameter>
Line 133: Line 135:
 
     </cd:parameter>
 
     </cd:parameter>
 
     <cd:parameter name="scale">
 
     <cd:parameter name="scale">
       <cd:paramdoc></cd:paramdoc>
+
       <cd:paramdoc>1000 is original size (100%); to get 72%, use scale=720.</cd:paramdoc>
 
       <cd:constant type="cd:number"></cd:constant>
 
       <cd:constant type="cd:number"></cd:constant>
 
     </cd:parameter>
 
     </cd:parameter>
Line 157: Line 159:
 
     </cd:parameter>
 
     </cd:parameter>
 
     <cd:parameter name="lines">
 
     <cd:parameter name="lines">
       <cd:paramdoc></cd:paramdoc>
+
       <cd:paramdoc>Height in lines</cd:paramdoc>
 
       <cd:constant type="cd:number"></cd:constant>
 
       <cd:constant type="cd:number"></cd:constant>
 
     </cd:parameter>
 
     </cd:parameter>
Line 175: Line 177:
 
       <cd:constant type="test"></cd:constant>
 
       <cd:constant type="test"></cd:constant>
 
       <cd:constant type="frame"></cd:constant>
 
       <cd:constant type="frame"></cd:constant>
       <cd:constant type="empty"></cd:constant>
+
       <cd:constant type="empty">don’t include actual image (“draft mode”)</cd:constant>
 
     </cd:parameter>
 
     </cd:parameter>
 
     <cd:parameter name="foregroundcolor">
 
     <cd:parameter name="foregroundcolor">
       <cd:paramdoc></cd:paramdoc>
+
       <cd:paramdoc>probably synonymous to "color"</cd:paramdoc>
 
       <cd:constant type="cd:color"></cd:constant>
 
       <cd:constant type="cd:color"></cd:constant>
 
     </cd:parameter>
 
     </cd:parameter>
Line 187: Line 189:
 
     </cd:parameter>
 
     </cd:parameter>
 
     <cd:parameter name="background">
 
     <cd:parameter name="background">
       <cd:paramdoc></cd:paramdoc>
+
       <cd:paramdoc>like {{cmd|setupframed}}</cd:paramdoc>
 
       <cd:constant type="color"></cd:constant>
 
       <cd:constant type="color"></cd:constant>
 
       <cd:constant type="foreground"></cd:constant>
 
       <cd:constant type="foreground"></cd:constant>
Line 193: Line 195:
 
     </cd:parameter>
 
     </cd:parameter>
 
     <cd:parameter name="frame">
 
     <cd:parameter name="frame">
       <cd:paramdoc></cd:paramdoc>
+
       <cd:paramdoc>Show frame around image. Most(?) options of {{cmd|setupframed}} are usable!</cd:paramdoc>
 
       <cd:constant type="on"></cd:constant>
 
       <cd:constant type="on"></cd:constant>
 
       <cd:constant default="yes" type="off"></cd:constant>
 
       <cd:constant default="yes" type="off"></cd:constant>
 
     </cd:parameter>
 
     </cd:parameter>
 
     <cd:parameter name="backgroundcolor">
 
     <cd:parameter name="backgroundcolor">
       <cd:paramdoc></cd:paramdoc>
+
       <cd:paramdoc>like {{cmd|setupframed}}, used if <tt>background=color</tt></cd:paramdoc>
 
       <cd:constant type="cd:color"></cd:constant>
 
       <cd:constant type="cd:color"></cd:constant>
 
     </cd:parameter>
 
     </cd:parameter>
Line 215: Line 217:
 
     </cd:parameter>
 
     </cd:parameter>
 
     <cd:parameter name="interaction">
 
     <cd:parameter name="interaction">
       <cd:paramdoc></cd:paramdoc>
+
       <cd:paramdoc>How to handle the interaction (links etc.) of included PDFs – default is to disable all of them.</cd:paramdoc>
       <cd:constant type="yes"></cd:constant>
+
       <cd:constant type="yes">keep all(?)</cd:constant>
       <cd:constant type="all"></cd:constant>
+
       <cd:constant type="all">keep all</cd:constant>
       <cd:constant default="yes" type="none"></cd:constant>
+
       <cd:constant default="yes" type="none">disable all</cd:constant>
       <cd:constant type="reference"></cd:constant>
+
       <cd:constant type="reference">keep references</cd:constant>
       <cd:constant type="layer"></cd:constant>
+
       <cd:constant type="layer">keep PDF layers (viewer layers, optional content groups)</cd:constant>
       <cd:constant type="bookmark"></cd:constant>
+
       <cd:constant type="bookmark">keep bookmarks</cd:constant>
 
     </cd:parameter>
 
     </cd:parameter>
 
     <cd:parameter name="bodyfont">
 
     <cd:parameter name="bodyfont">
Line 233: Line 235:
 
     </cd:parameter>
 
     </cd:parameter>
 
     <cd:parameter name="size">
 
     <cd:parameter name="size">
       <cd:paramdoc></cd:paramdoc>
+
       <cd:paramdoc>Use specified box of PDF (MediaBox, CropBox, TrimBox, ArtBox). (No BleedBox?)</cd:paramdoc>
 
       <cd:constant type="none"></cd:constant>
 
       <cd:constant type="none"></cd:constant>
 
       <cd:constant type="media"></cd:constant>
 
       <cd:constant type="media"></cd:constant>
Line 241: Line 243:
 
     </cd:parameter>
 
     </cd:parameter>
 
     <cd:parameter name="cache">
 
     <cd:parameter name="cache">
       <cd:paramdoc></cd:paramdoc>
+
       <cd:paramdoc>Set location of cache for conversions</cd:paramdoc>
 
       <cd:constant type="cd:path"></cd:constant>
 
       <cd:constant type="cd:path"></cd:constant>
 
     </cd:parameter>
 
     </cd:parameter>
Line 249: Line 251:
 
     </cd:parameter>
 
     </cd:parameter>
 
     <cd:parameter name="display">
 
     <cd:parameter name="display">
       <cd:paramdoc></cd:paramdoc>
+
       <cd:paramdoc>alternative figure, e.g. lowres; used with movie and 3D contents, probably obsolete</cd:paramdoc>
 
       <cd:constant type="cd:file"></cd:constant>
 
       <cd:constant type="cd:file"></cd:constant>
 
     </cd:parameter>
 
     </cd:parameter>
 
     <cd:parameter name="conversion">
 
     <cd:parameter name="conversion">
       <cd:paramdoc></cd:paramdoc>
+
       <cd:paramdoc>see {{src|grph-con.lua}}.
 +
<tt>conversion=mp</tt> activates internal processing of [[SVG]] via [[MetaPost]]</cd:paramdoc>
 
       <cd:constant type="cd:text"></cd:constant>
 
       <cd:constant type="cd:text"></cd:constant>
 
     </cd:parameter>
 
     </cd:parameter>
Line 264: Line 267:
 
     <cd:parameter name="crossreference">
 
     <cd:parameter name="crossreference">
 
       <cd:paramdoc></cd:paramdoc>
 
       <cd:paramdoc></cd:paramdoc>
       <cd:constant type="yes"></cd:constant>
+
       <cd:constant type="yes">use counter for referencing</cd:constant>
 
       <cd:constant type="no"></cd:constant>
 
       <cd:constant type="no"></cd:constant>
 
       <cd:constant type="cd:number"></cd:constant>
 
       <cd:constant type="cd:number"></cd:constant>
 
     </cd:parameter>
 
     </cd:parameter>
 
     <cd:parameter name="transform">
 
     <cd:parameter name="transform">
       <cd:paramdoc></cd:paramdoc>
+
       <cd:paramdoc>Rotation in 90˚ steps (otherwise use {{cmd|rotate}}); does not always work (?) `orientation=90|180|270` works</cd:paramdoc>
 
       <cd:constant default="yes" type="auto"></cd:constant>
 
       <cd:constant default="yes" type="auto"></cd:constant>
 
       <cd:constant type="cd:number"></cd:constant>
 
       <cd:constant type="cd:number"></cd:constant>
 
     </cd:parameter>
 
     </cd:parameter>
 
     <cd:parameter name="userpassword">
 
     <cd:parameter name="userpassword">
       <cd:paramdoc></cd:paramdoc>
+
       <cd:paramdoc>Access to encrypted PDFs</cd:paramdoc>
 
       <cd:constant type="cd:text"></cd:constant>
 
       <cd:constant type="cd:text"></cd:constant>
 
     </cd:parameter>
 
     </cd:parameter>
 
     <cd:parameter name="ownerpassword">
 
     <cd:parameter name="ownerpassword">
       <cd:paramdoc></cd:paramdoc>
+
       <cd:paramdoc>Access to encrypted PDFs</cd:paramdoc>
 
       <cd:constant type="cd:text"></cd:constant>
 
       <cd:constant type="cd:text"></cd:constant>
 
     </cd:parameter>
 
     </cd:parameter>
Line 285: Line 288:
 
   </cd:command>
 
   </cd:command>
 
</cd:variants>
 
</cd:variants>
<cd:description><!-- the long description of the command goes here -->
+
<cd:description>There are a few more options that are missing in the interface files:
</cd:description>
+
 
 +
* '''orientation''': rotation (in LMTX arbitrary angles, in MkIV only 90˚steps)
 +
* '''minwidth/minheight'''
 +
* '''strut''': strut=none also avoids the \noindent; otherwise we're in hmode when blank happens and we get a lineskip</cd:description>
 
<cd:examples><cd:example title=""><texcode>
 
<cd:examples><cd:example title=""><texcode>
 
\setupexternalfigures
 
\setupexternalfigures
Line 296: Line 302:
 
<cd:seealso>
 
<cd:seealso>
 
<cd:commandref name="defineexternalfigure" originator="system"></cd:commandref>
 
<cd:commandref name="defineexternalfigure" originator="system"></cd:commandref>
<cd:source file="grph-inc.mkvi" originator="system"></cd:source>
+
<cd:commandref name="externalfigure"></cd:commandref>
 +
<cd:commandref name="definegraphictypesynonym"></cd:commandref>
 
<cd:wikipage originator="system" page="Category:Graphics"></cd:wikipage>
 
<cd:wikipage originator="system" page="Category:Graphics"></cd:wikipage>
<cd:commandref name="externalfigure"></cd:commandref></cd:seealso>
+
<cd:source file="grph-inc.mkvi" originator="system">MkIV source</cd:source>
 +
<cd:source file="grph-inc.mkxl">LMTX source</cd:source>
 +
<cd:source file="grph-con.lua">conversions source</cd:source>
 +
<cd:wikipage page="Using Graphics"></cd:wikipage>
 +
<cd:wikipage page="Multimedia Inclusion">to add audio and video contents</cd:wikipage></cd:seealso>
 
</cd:commandgroup>
 
</cd:commandgroup>

Latest revision as of 20:46, 5 March 2024


\setupexternalfigure

Summary

The command \setupexternalfigure sets up \externalfigure

Settings

\setupexternalfigure[...,...][...=...,...]
[...,...]name
widthdimension
heightdimension
labelname
pagenumber
objectyes no
prefixtext
methodpdf mps jpg png jp2 jbig svg eps gif tif mov buffer tex cld auto
controlsyes no
previewyes no
masknone
resolutionnumber
colorcolor
cmykyes no auto
argumentstext
repeatyes no
factorfit broad max auto default
hfactorfit broad max auto default
wfactorfit broad max auto default
maxwidthdimension
maxheightdimension
equalwidthdimension
equalheightdimension
scalenumber
xscalenumber
yscalenumber
snumber
sxnumber
synumber
linesnumber
locationlocal global default
directorypath
optiontest frame empty
foregroundcolorcolor
resetyes no
backgroundcolor foreground name
frameon off
backgroundcolorcolor
xmaxnumber
ymaxnumber
frameson off
interactionyes all none reference layer bookmark
bodyfontdimension
commentcommand text
sizenone media crop trim art
cachepath
resourcespath
displayfile
conversiontext
orderlist
crossreferenceyes no number
transformauto number
userpasswordtext
ownerpasswordtext

OptionExplanation
label
internal name
page
Page number of PDF.
object
Reuse this image file as an object, i.e. embed it only once in PDF if it’s used several times?
method
force a file type (and processing), e.g. if there are different versions
mov is removed from LMTX
auto strips suffix and uses "order"
controls
Show media controls (for movies)
resolution
Set the image resolution (after scaling) for automatic downsampling
number dpi
color
Colorize the image. Works only with some greyscale pictures (no channels, no additional tables, ...?) and only with toned (p=) or spot colors. Use with object=no
color color name
cmyk
Force CMYK conversion
arguments
used for converters
factor
If both width and height are set, the factor is important. If factor is empty, the image is deformed accordingly.
fit aspect ratio is kept, the image is scaled to the smaller (fitted) variant
max aspect ratio is kept, the image is scaled to the bigger (oversized) variant
maxwidth
maximum width
maxheight
maximum height
scale
1000 is original size (100%); to get 72%, use scale=720.
lines
Height in lines
location
Where to find figure files. Multiple comma-separated options are allowed, and the default value is local,global
local search in the current directory
global search path specified with the directory key
default search in the texmf tree
directory
comma-separated directories to search for figure files
option
empty don’t include actual image (“draft mode”)
foregroundcolor
probably synonymous to "color"
background
like \setupframed
frame
Show frame around image. Most(?) options of \setupframed are usable!
backgroundcolor
like \setupframed, used if background=color
interaction
How to handle the interaction (links etc.) of included PDFs – default is to disable all of them.
yes keep all(?)
all keep all
none disable all
reference keep references
layer keep PDF layers (viewer layers, optional content groups)
bookmark keep bookmarks
size
Use specified box of PDF (MediaBox, CropBox, TrimBox, ArtBox). (No BleedBox?)
cache
Set location of cache for conversions
display
alternative figure, e.g. lowres; used with movie and 3D contents, probably obsolete
conversion
see grph-con.lua. conversion=mp activates internal processing of SVG via MetaPost
order
Sets the order in which the individual file types are looked up.
crossreference
yes use counter for referencing
transform
Rotation in 90˚ steps (otherwise use \rotate); does not always work (?) orientation=90|180|270 works
userpassword
Access to encrypted PDFs
ownerpassword
Access to encrypted PDFs

Description

There are a few more options that are missing in the interface files:
  • orientation: rotation (in LMTX arbitrary angles, in MkIV only 90˚steps)
  • minwidth/minheight
  • strut: strut=none also avoids the \noindent; otherwise we're in hmode when blank happens and we get a lineskip

Examples

Example 1

\setupexternalfigures
   [order={pdf,png,jpg},
    location=global,
    directory={images}]

Notes

See also

Help from ConTeXt-Mailinglist/Forum

All issues with: