Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would like to post questions here concerning ConTeXt and graphics.

However, I cannot find a minimum working example package for ConTeXt like Martin Scharrer's mwe package for LaTeX. Nothing alike appears on the ConTeXt module and packages list.

Is there a MWE package or similar built-in functionality for ConTeXT?

It would be great to see here an example of a Context MWE with graphics.

share|improve this question
2  
Have a look at meta-imp-dum.mkiv. All you have to do is to place the statement \useMPlibrary[dum] at the top of your document and then use figure names that do not resolve to real image files. If you need further functionality your chances of a good answer will rise if you describe what exactly it is that you wish (image!). You cannot presuppose that Context users will be familiar with any Latex package. –  phg Aug 31 '13 at 8:52
3  
Also, have a look at the files in the sample/ directory. They exist in every Context installation for demonstrational purposes. E.g. use \input knuth if you need some dummy text, \externalfigure[cow] for an image etc. –  phg Aug 31 '13 at 8:57
add comment

1 Answer

up vote 4 down vote accepted

There are a couple of options:

  1. The mwe package is just provides a bunch of images. By default, the package is located in $TEXMF/tex/latex/ subtree, so these images are not found by ConTeXt. If the package is repackaged so that the images are in $TEXMF/tex/generic then the images can also be used in ConTeXt (see next point).

  2. ConTeXt provides a few sample images in $TEXMF/tex/context/sample directory. These include cow.pdf, hacker.jpg, mill.png, and spider.eps. By default, ConTeXt does not search in the $TEXMF tree for images. To change that use (see ConTeXt wiki for details)

    \setupexternalfigures
        [location={local,global,default}]
    
    \starttext
    \startcombination[3*1]
       {\externalfigure[cow.pdf][width=0.3\textwidth]}    {cow.pdf}
       {\externalfigure[hacker.jpg][width=0.3\textwidth]} {hacker.jpg}
       {\externalfigure[mill.png][width=0.3\textwidth]}   {mill.png}
    \stopcombination
    \stoptext
    

    enter image description here

  3. ConTeXt provides a MP library dum to create dummy images. To use that simply add \useMPlibrary[dum]. Then, a dummy figure is drawn whenever you call \externalfigure with a filename that does not exist. The convention is to use \externalfigure[dummy]. For example:

    \useMPlibrary[dum]
    
    \starttext
    \startcombination[3*1]
      {\externalfigure[dummy][width=0.3\textwidth]}{Dummy figure}
      {\externalfigure[dummy][width=0.3\textwidth]}{Dummy figure}
      {\externalfigure[dummy][width=0.3\textwidth]}{Dummy figure}
    \stopcombination
    \stoptext
    

    gives

    enter image description here

    The colors are chosen at random.

  4. ConTeXt can download images from the web, so you can use any image that you want. For example

    \starttext
    \startcombination[3*1]
      {\externalfigure[http://placekitten.com/g/400/600][method=jpg]}{One cat}
      {\externalfigure[http://placekitten.com/g/500/600][method=jpg]}{Another cat}
      {\externalfigure[http://placekitten.com/g/600/600][method=jpg]}{And one more}
    \stopcombination
    \stoptext
    

    which gives

    enter image description here

    The method=jpg is needed because the image name does not have an extension. The images are downloaded and stored in the cache directory. This means that if you really want the images provided by the mwe package, you can use:

    \starttext
    \startcombination[3*1]
      {\externalfigure[http://mirrors.ctan.org/macros/latex/contrib/mwe/example-image-a.pdf][width=0.3\textwidth]}{A}
      {\externalfigure[http://mirrors.ctan.org/macros/latex/contrib/mwe/example-image-b.pdf][width=0.3\textwidth]}{B}
      {\externalfigure[http://mirrors.ctan.org/macros/latex/contrib/mwe/example-image-c.pdf][width=0.3\textwidth]}{C}
    \stopcombination
    \stoptext
    

    which gives

    enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.