Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Latex - Is it possible to have text on top of images?

I want to create something like a leaflet/magazine using Latex. Is it possible to place text on top of an image and style the text freely?

Any links to examples of something like this?

like image 435
anonymous Avatar asked Apr 13 '10 09:04

anonymous


People also ask

How do I put text over a picture in LaTeX?

Including images in your LaTeX document requires adding: \usepackage{graphicx} to the beginning/preamble of your document. \includegraphics{ } command tells LaTeX to insert the image. To upload an image, click the upload button, and upload your image file.

How do I put something on top of a page in LaTeX?

You can insert a pagebreak via \clearpage or \newpage , then use the t option on the figure environment: ... \clearpage \begin{figure}[t!]

How do I get my images to stay where I put them in LaTeX?

In general text you can force a LaTeX image to stay where it is placed in the code using the [! h] command in the figure environment. A slight modification of this which allows the image to move to the top of the next page if there is an overhang is the [! ht] command.

Can you include JPG in LaTeX?

For inclusion of JPG images, you cannot use the latex compiler. You need to use pdflatex.


4 Answers

I usually do something like

\usepackage{tikz}
...
\begin{tikzpicture}
    \draw (0, 0) node[inner sep=0] {\includegraphics[width=4cm]{imagefile.png}};
    \draw (1, 1) node {Hello world};
\end{tikzpicture}
like image 165
midtiby Avatar answered Oct 20 '22 23:10

midtiby


A very good toolset for manipulating images is pgf/TikZ pdf doc.

See \pgfimage for examples. It allows to mix text and image freely. There are many ways to do it. One of them is to use layers (p. 220 of pgfmanual). The pgf manual contains many simple examples, and is very precise.

Another solution is to use the lpic package: the homepage contains some examples.

You can find other examples for pfg and TikZ here and here for many impressive examples.

like image 36
tonio Avatar answered Oct 21 '22 00:10

tonio


Another solution is the textpos package which allows you to specify boxes at absolute positions on the page. The boxes can overlap, so you can put the figure in one box, and text in another box on top of it.

like image 24
Rob Hyndman Avatar answered Oct 20 '22 23:10

Rob Hyndman


I realise that the question is old and answer is accepted, but for completeness would like to propose an alternative approach for making leaflets in LaTeX.

Specifically, the leaflet document style served me really well for this purpose.

A good blog post wrt background image can be found here. There are a couple of packages that are required to use in order to make the proposed approach work, but were not mentioned in the blog post:

\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{transparent}
like image 21
01es Avatar answered Oct 21 '22 01:10

01es