Figures in format-independent documents are a problem. You cannot avoid contact with the final format (HTML, LaTeX or whatever) if you want to include figures in a text. The way Yodl approaches figures, is currently the folloowing.
  • Figures can only be included in LaTeX or in HTML documents.
  • For LaTeX, you must prepare a picture in an external file that is included in the document as en encapsulated PostScript file. Incidentally, that means that epsf must be stated as one of the LaTeX styles using latexoptions macro. The file in question is stated in Yodl without an extension. Yodl provides a default extension, being .ps.
  • For HTML, you must prepare a picture in an external file that is placed in the document using the <img src=...> stanza. The file must be a GIF file. The file is -again- stated without the filename extension; Yodl supplies .gif.
  • All other output formats do not include pictures in the document, but typeset something like insert figure .. here.
  • The macro to include a figure is called, appropriately, figure. It takes three arguments:
  • The first argument is the filename. This name may include directories, but may not include the filename extension. The reason for this is, that Yodl supplies the correct extension once the output format is known.
  • The second argument is the figure title, or the caption. Yodl prefixes this caption with the text Figure xx:, where xx is a number.
  • The last argument is a label, which Yodl defines as a placeholder for the figure number.
  • For example, you might draw a picture or scan a photo and put it in a .gif file, for usage with HTML documents. The conversion to PostScript could be automated, e.g., using a Yodl macro:
    SYSTEM(xpmtoppm picture.xpm | pnmtops > picture.ps)
    

    See the discussion of the SYSTEM macro (section ??) for the danger of live data and how Yodl handles them.

    After this, you would be reasonably safe that the picture is available for both HTML and LaTeX output. The picture would be typeset in a figure using:

    figure(picture)
          (A photo of me.)
          (photo)
    

    Note how the first argument, the filename, does not contain an extension. The third argument, which is a label, can be used in, e.g.,

    See figure ref(photo) for a photograph.
    

    Yodl has a few auxiliary macros, which are:

  • fig(label): This macro is a shorthand for getfigurestring() ref(label). It just makes typing shorter, and is used as e.g.: See fig(photo) for a photograph. Note that the string figure that is generated by this macro can be (re)defined, see below.

  • setfigurestring(name): This macro is similar to setchapterstring etc.. It defines the string that is used to identify a figure, and is (appropriately) figure by default. The macro getfigurestring() expands to the string in question. See also section ?? for a discussion of national language support.

  • sethtmlfigureext(.new): This macro redefines the filename extension for HTML conversions from .gif to .new. Note that you must include a leading dot in the redefinition.

    The new extension is used in the first following figure statement.

  • sethtmlfigurealign(align): This redefines the alignment of figures in HTML, which is default bottom. Check your HTML handbook for possible options; top and center should be fairly standard.

  • setlatexfigureext(.new): Redefines the extension from .ps to .new.

  • Finally, an example of a picture is shown in figure ??. The picture is also distributed with the Yodl package as Documentation/pictures/world.xpm.

    figure 1 is shown here.
    figure 1: Sample picture in a figure.



    Go back to index of Yodl.

    Please send Yodl questions and comments to yodl@icce.rug.nl.

    Please send comments on these web pages to (address unknown)

    Copyright (c) 1997, 1998, 1999 Karel Kubat and Jan Nieuwenhuizen.

    Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.


    This page was built from Yodl-1.31.18 by

    <(address unknown)>, Mon Apr 30 09:54:52 2007 EDT.