summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/inline-images/README.md
blob: a4e0e2d8d50fdf61a53c4741c942cff154531a66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
LaTeX-Template for Inline Images
================================

If you want your document to be self contained, you might want to decare inline images in base64 encoding.

Just use:

    \usepackage{inline-images}
    …
    \inlineimg{<filename>}{<base64 encoded raw image data>}

This creates a file `<filename>.base64` containning a copy of  the raw image data, then a sytsem shell is executed to convert the raw data to the binary image and a file `<filename>` is created, which is then include in your document.

**Note:** The LaTeX compiler must be able to execute system commands, so option `--shell-escape` is required.

**Note:** It is desiged for Unix systems and it requires the command line tool `base64` installed. Compilation calls `base64 -d <filename>.img.base64 > <filename>.img`.


Example
=======

This [example code]:

```latex
\documentclass[a5]{article}
\usepackage[paperwidth=6cm,paperheight=4cm]{geometry}

\usepackage{inline-images}

\newcommand{\img}{iVBORw0KGgoAAAANSUhEUgAAAMgAAADIC … BQ8f/JOcTkviE7+QAAAABJRU5ErkJggg==}

\begin{document}
\inlineimg{example.png}{\img}

© 2018 Marc Wäckerlin
\end{document}
```

After compilation:

   xelatex --shell-escape -synctex=1 -interaction=nonstopmode example.tex

Results in this [example document]:

![example screenshot](screenshots/example.jpg)


Need More
=========

If you are missing a feature or a configuration option, consult the [project] page. Just open a [ticket] and the [author] will care about it. Or extend it, it's [lgpl].



[example code]: screenshots/screenshot.tex "screenshot of the example document"
[example document]: examples/example.pdf "full example document"
[ticket]: https://mrw.sh/templates/inline-images/issues "open issues and tickets for my LaTeX-templates project"
[author]: https://marc.wäckerlin.ch "Marc Wäckerlin"
[project]: https://mrw.sh/templates/inline-images "the main project page"
[lgpl]: https://www.gnu.org/licenses/lgpl-3.0 "Library GNU Public License"