\documentclass[12pt]{article}
\def\draft{n}
\usepackage{graphicx, xcolor}
\usepackage[textwidth=6.5in,textheight=9in,headsep=0.15in,centering]{geometry}

% Following http://tex.stackexchange.com/a/847/22475:
\usepackage[pagebackref,breaklinks=true]{hyperref}\hypersetup{colorlinks,
  linkcolor={green!50!black},
  citecolor={green!50!black},
  urlcolor=blue
}

% Following
% http://tex.stackexchange.com/questions/23521/tabular-vertical-alignment-to-top
\def\imagetop#1{\vtop{\null\hbox{#1}}}

\def\face{\input{figs/face.pdf_t}}
\def\human{\input{figs/human.pdf_t}}
\def\machine{\input{figs/machine.pdf_t}}

\def\cellscale{1}
\newsavebox\pdfbox
\newlength{\pdfheight}

\def\nbpdfInput#1{{%
  \savebox{\pdfbox}{\includegraphics[scale=\cellscale]{#1}}%
  \settoheight{\pdfheight}{\usebox{\pdfbox}}%
  %\uselengthunit{mm}\printlength{\pdfheight}%
  \noindent\imagetop{\ifdim\pdfheight<10mm\face\else\human\fi}\ %
  \imagetop{\usebox{\pdfbox}}%
  \vskip 2mm%
}}

\def\nbpdfOutput#1{{\noindent{\imagetop{\machine}\ \imagetop{\includegraphics[scale=\cellscale]{#1}}\vskip 2mm}}}

\def\nbpdfPrint#1{{\noindent{\imagetop{\machine}\ \imagetop{\includegraphics[scale=\cellscale]{#1}}\vskip 2mm}}}

\def\nbpdfMessage#1{{\noindent{\qquad\imagetop{\includegraphics[scale=\cellscale]{#1}}\vskip 2mm}}}

\def\nbpdfSection#1{{\noindent{\imagetop{\includegraphics[scale=\cellscale]{#1}}\vskip 2mm}}}
\def\nbpdfSubsubsection#1{{\noindent{\imagetop{\includegraphics[scale=\cellscale]{#1}}\vskip 2mm}}}
\def\nbpdfText#1{{\noindent{\imagetop{\includegraphics[scale=\cellscale]{#1}}\vskip 2mm}}}

\begin{document}

\noindent Roland -

\vskip 5mm

This is a demo of how to include Mathematica notebooks in a latex document. See also \url{http://drorbn.net/AP/Projects/nb2tex/nb2tex.pdf} (written in Groningen!).

The files used to construct this document are all at \url{http://drorbn.net/AP/Projects/nb2tex/nb2tex.pdf}. The ``main'' file is {\tt Demo.tex}. It defines a few macros that detail how various types of Mathematica notebook cells should be formatted (especially see \verb$\nbpdfInput$ and \verb$\nbpdfoutput$, it contains all the text down to the separator line below, and it inputs {\tt TraditionalHopfStructure.tex}. That latter \verb$.tex$ file is produced automatically from the notebook \verb$TraditionalHopfStructure@.nb$ by running the code in the notebook \verb$Make.nb$.

\noindent\rule{\linewidth}{1pt}

\input TraditionalHopfStructure.tex

\end{document}
\endinput

