JezK
Edit File: Image-Syntax.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <!-- Created by GNU Texinfo 6.8, https://www.gnu.org/software/texinfo/ --> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <!-- This manual is for GNU Texinfo (version 6.8, 8 June 2021), a documentation system that can produce both online information and a printed manual from a single source using semantic markup. Copyright (C) 1988, 1990-1993, 1995-1999, 2001-2021 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License". --> <title>Image Syntax (GNU Texinfo 6.8)</title> <meta name="description" content="Image Syntax (GNU Texinfo 6.8)"> <meta name="keywords" content="Image Syntax (GNU Texinfo 6.8)"> <meta name="resource-type" content="document"> <meta name="distribution" content="global"> <meta name="Generator" content="texi2any"> <meta name="viewport" content="width=device-width,initial-scale=1"> <link href="index.html" rel="start" title="Top"> <link href="Command-and-Variable-Index.html" rel="index" title="Command and Variable Index"> <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> <link href="Images.html" rel="up" title="Images"> <link href="Image-Scaling.html" rel="next" title="Image Scaling"> <style type="text/css"> <!-- a.copiable-anchor {visibility: hidden; text-decoration: none; line-height: 0em} a.summary-letter {text-decoration: none} blockquote.indentedblock {margin-right: 0em} div.display {margin-left: 3.2em} div.example {margin-left: 3.2em} kbd {font-style: oblique} pre.display {font-family: inherit} pre.format {font-family: inherit} pre.menu-comment {font-family: serif} pre.menu-preformatted {font-family: serif} span.nolinebreak {white-space: nowrap} span.roman {font-family: initial; font-weight: normal} span.sansserif {font-family: sans-serif; font-weight: normal} span:hover a.copiable-anchor {visibility: visible} ul.no-bullet {list-style: none} --> </style> </head> <body lang="en"> <div class="subsection" id="Image-Syntax"> <div class="header"> <p> Next: <a href="Image-Scaling.html" accesskey="n" rel="next">Image Scaling</a>, Up: <a href="Images.html" accesskey="u" rel="up">Inserting Images</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Command-and-Variable-Index.html" title="Index" rel="index">Index</a>]</p> </div> <hr> <span id="Image-Syntax-1"></span><h4 class="subsection">9.2.1 Image Syntax</h4> <p>Here is the synopsis of the <code>@image</code> command: </p> <div class="example"> <pre class="example">@image{<var>filename</var><span class="roman">[,</span> <var>width</var><span class="roman">[,</span> <var>height</var><span class="roman">[,</span> <var>alttext</var><span class="roman">[, </span><var>extension</var><span class="roman">]]]]</span>} </pre></div> <span id="index-Formats-for-images"></span> <span id="index-Image-formats"></span> <p>The <var>filename</var> argument is mandatory, and must not have an extension, because the different processors support different formats: </p> <ul> <li> <span id="index-eps-image-format"></span> TeX (DVI output) reads the file <samp><var>filename</var>.eps</samp> (Encapsulated PostScript format). </li><li> <span id="index-pdftex_002c-and-images"></span> <span id="index-png-image-format"></span> <span id="index-jpeg-image-format"></span> <span id="index-pdf-image-inclusions"></span> pdfTeX reads <samp><var>filename</var>.pdf</samp>, <samp><var>filename</var>.png</samp>, <samp><var>filename</var>.jpg</samp>, or <samp><var>filename</var>.jpeg</samp> (in that order). It also tries uppercase versions of the extensions. The PDF format does not support EPS images, so such must be converted first. </li><li> For Info, <code>makeinfo</code> includes <samp><var>filename</var>.txt</samp> verbatim (more or less as if it were in <code>@verbatim</code>). The Info output may also include a reference to <samp><var>filename</var>.png</samp> or <samp><var>filename</var>.jpg</samp>. (See below.) </li><li> For HTML, <code>makeinfo</code> outputs a reference to <samp><var>filename</var>.png</samp>, <samp><var>filename</var>.jpg</samp>, <samp><var>filename</var>.jpeg</samp> or <samp><var>filename</var>.gif</samp> (in that order). If none of those exist, it gives an error, and outputs a reference to <samp><var>filename</var>.jpg</samp> anyway. </li><li> <span id="index-SVG-images_002c-used-in-DocBook"></span> For DocBook, <code>makeinfo</code> outputs references to <samp><var>filename</var>.eps</samp>, <samp><var>filename</var>.gif</samp> <samp><var>filename</var>.jpeg</samp>, <samp><var>filename</var>.jpg</samp>, <samp><var>filename</var>.pdf</samp>, <samp><var>filename</var>.png</samp> and <samp><var>filename</var>.svg</samp>, for every file found. Also, <samp><var>filename</var>.txt</samp> is included verbatim, if present. (The subsequent DocBook processor is supposed to choose the appropriate one.) </li><li> For Info and HTML output, <code>makeinfo</code> uses the optional fifth argument <var>extension</var> to <code>@image</code> for the file extension, if it is specified and the file is found. Any leading period should be included in <var>extension</var>. For example: <span id="index-XPM-image-format"></span> <div class="example"> <pre class="example">@image{foo,,,,.xpm} </pre></div> </li></ul> <p>If you want to install image files for use by Info readers too, we recommend putting them in a subdirectory like ‘<samp><var>foo</var>-figures</samp>’ for a package <var>foo</var>. Copying the files into <code>$(infodir)/<var>foo</var>-figures/</code> should be done in your <code>Makefile</code>. </p> <p>The <var>width</var> and <var>height</var> arguments are described in the next section. </p> <p>If an image is the first thing in a paragraph and followed by more text, then you should precede the <code>@image</code> command with <code>@indent</code> or <code>@noindent</code> to indicate the beginning of paragraph formatting. This is especially important for TeX output to get correct paragraph indentation. </p> <p>Use <code>@center</code> to center an image (see <a href="_0040titlefont-_0040center-_0040sp.html"><code>@titlefont</code>, <code>@center</code>, and <code>@sp</code></a>). </p> <span id="index-Alt-attribute-for-images"></span> <span id="index-Images-1"></span> <span id="index-_002d_002d-_0028in-image-alt-string_0029"></span> <p>For HTML output, <code>makeinfo</code> sets the <em>alt attribute</em> for inline images to the optional <var>alttext</var> (fourth) argument to <code>@image</code>, if supplied. If not supplied, <code>makeinfo</code> uses the full file name of the image being displayed. The <var>alttext</var> is processed as Texinfo text, so special characters such as ‘<samp>"</samp>’ and ‘<samp><</samp>’ and ‘<samp>&</samp>’ are escaped in the HTML output; also, you can get an empty <code>alt</code> string with <code>@-</code> (a command that produces no output; see <a href="_0040_002d-_0040hyphenation.html"><code>@-</code> and <code>@hyphenation</code>: Helping TeX Hyphenate</a>). </p> <p>For Info output, the <code>alt</code> string is also processed as Texinfo text and output. In this case, ‘<samp>\</samp>’ is escaped as ‘<samp>\\</samp>’ and ‘<samp>"</samp>’ as ‘<samp>\"</samp>’; no other escapes are done. </p> <p>In Info output, <code>makeinfo</code> writes a reference to the binary image file (trying <var>filename</var> suffixed with <samp><var>extension</var></samp>, <samp><var>.extension</var></samp>, <samp>.png</samp>, or <samp>.jpg</samp>, in that order) if one exists. It also literally includes the <samp>.txt</samp> file if one exists. This way, Info readers which can display images (such as the Emacs Info browser, running under X) can do so, whereas Info readers which can only use text (such as the standalone Info reader) can display the textual version. </p> <span id="index-_005e_0040_005eH-for-images-in-Info"></span> <p>The implementation of this is to put the following construct into the Info output: </p> <div class="example"> <pre class="example">^@^H[image src="<var>binaryfile</var>" text="<var>txtfile</var>" alt="<var>alttext</var> ... ^@^H] </pre></div> <p>where ‘<samp>^@</samp>’ and ‘<samp>^H</samp>’ stand for the actual null and backspace control characters. If one of the files is not present, the corresponding argument is omitted. </p> <p>The reason for mentioning this here is that older Info browsers (this feature was introduced in Texinfo version 4.6) will display the above literally, which, although not pretty, should not be harmful. </p> </div> <hr> <div class="header"> <p> Next: <a href="Image-Scaling.html">Image Scaling</a>, Up: <a href="Images.html">Inserting Images</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Command-and-Variable-Index.html" title="Index" rel="index">Index</a>]</p> </div> </body> </html>