pondělí 16. února 2009

How to embed PDF in LaTeX documents

In the previous entry to this blog, I have shown that OASA can create pictures of molecules in PDF. However a picture of a molecule as a separate PDF file is not very useful.
Today, I will show a snippet of LaTeX code that can be used to embed the exported PDF file inside a PDF document produced by pdflatex. (Please note that this post is not intended to be an in-depth tutorial, its main purpose it to inform that the possibility to use PDFs this way even exists.)
The whole LaTeX source looks like this:

\documentclass[a4paper,12pt]{article}
\usepackage{graphics}
\usepackage[left=1.5cm,right=2cm,top=2cm]{geometry}

\begin{document}

\begin{center}
\begin{large}Exam - \bf{1A}\end{large}
\end{center}

Write down SMILES for the following molecule:

\includegraphics{test}

Name the following molecule:

\includegraphics{test2}

\end{document}

The most important commands are the following two - \usepackage{graphics} and \includegraphics{test} (please note that the name of the file to embed is used without the extension .pdf).
After running pdflatex on this code you will get a PDF file with the two images embedded inside (provided the two images exist in the same directory). The result looks like this, you can download the source files of this example here.

Žádné komentáře:

Okomentovat