I have to insert a graphic into the whole page with tikz. The graphic has the same size as the final document. I use tikz because I have to insert some drawing and some text into the graphic. My problem now is, that some margin is inserted to. How to avoid this margin?
\documentclass{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage[
total={512pt,512pt},
papersize={512pt,512pt}]{geometry}
\usepackage{tikz}
\usepackage{mwe}
\pagestyle{empty}
\setlength{\parindent}{0cm}
\begin{document}
\begin{tikzpicture}
\node (0,0) {\includegraphics[width=512pt,height=512pt]{example-image-a}};
\end{tikzpicture}
\end{document}
My problem is that the image doesn't fit. The warning says overfull hbox and I get an empty first page.
Best Answer
If you want to creat a document with only one page and sized according size of an inserted graphic,
standalone
class can help you. It crops the output file to contents.Following code uses
TiKZ
to insert a graphics as a tikzpicture node. Every node contains certaininner sep
between its contents and border. Withinner sep=0pt
there won't be any white margin around the inserted graphics.Being the inserted graphic node, it can be used as reference for adding text or paintings over it.
An alternative solution could be using
incgraph
package. Some examples: