| 1 |
LaTeX-Template for Inline Images |
| 2 |
================================ |
| 3 |
|
| 4 |
If you want your document to be self contained, you might want to decare inline images in base64 encoding. |
| 5 |
|
| 6 |
Just use: |
| 7 |
|
| 8 |
\usepackage{inline-images} |
| 9 |
… |
| 10 |
\inlineimg{<filename>}{<base64 encoded raw image data>} |
| 11 |
|
| 12 |
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. |
| 13 |
|
| 14 |
**Note:** The LaTeX compiler must be able to execute system commands, so option `--shell-escape` is required. |
| 15 |
|
| 16 |
**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`. |
| 17 |
|
| 18 |
|
| 19 |
Example |
| 20 |
======= |
| 21 |
|
| 22 |
This [example code]: |
| 23 |
|
| 24 |
```latex |
| 25 |
\documentclass[a5]{article} |
| 26 |
\usepackage[paperwidth=6cm,paperheight=4cm]{geometry} |
| 27 |
|
| 28 |
\usepackage{inline-images} |
| 29 |
|
| 30 |
\newcommand{\img}{iVBORw0KGgoAAAANSUhEUgAAAMgAAADIC … BQ8f/JOcTkviE7+QAAAABJRU5ErkJggg==} |
| 31 |
|
| 32 |
\begin{document} |
| 33 |
\inlineimg{example.png}{\img} |
| 34 |
|
| 35 |
© 2018 Marc Wäckerlin |
| 36 |
\end{document} |
| 37 |
``` |
| 38 |
|
| 39 |
After compilation: |
| 40 |
|
| 41 |
xelatex --shell-escape -synctex=1 -interaction=nonstopmode example.tex |
| 42 |
|
| 43 |
Results in this [example document]: |
| 44 |
|
| 45 |
 |
| 46 |
|
| 47 |
|
| 48 |
Need More |
| 49 |
========= |
| 50 |
|
| 51 |
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]. |
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
[example code]: screenshots/screenshot.tex "screenshot of the example document" |
| 56 |
[example document]: examples/example.pdf "full example document" |
| 57 |
[ticket]: https://mrw.sh/templates/inline-images/issues "open issues and tickets for my LaTeX-templates project" |
| 58 |
[author]: https://marc.wäckerlin.ch "Marc Wäckerlin" |
| 59 |
[project]: https://mrw.sh/templates/inline-images "the main project page" |
| 60 |
[lgpl]: https://www.gnu.org/licenses/lgpl-3.0 "Library GNU Public License" |
| 61 |
|