3

OK, I admit I haven't tried my MWE without Beamer.

My goal is to use e.g \textwidth with the picture environment, and my overall goal is to include several rectangular portions of an .eps file within a picture environment.

I was trying to follow @Qrrbrbirlbel's example here: How to use \textwidth (or any variable) in a picture environment

But I can't use his geometry package options with Beamer (not sure if that is the problem, but I guess not).

Here's the MWE:

\documentclass[compress,red,notes]{beamer}

\begin{document}

\frame{\frametitle{An overview to constraint-based modeling}

\makeatletter
\def\strippt{\strip@pt}
\makeatother

\newsavebox{\toynet}
\savebox{\toynet}{  
\includegraphics*[width=\textwidth, viewport=0 418 708 718, clip=true]
{SmatExample}  }

\newsavebox{\toySmat}
\savebox{\toySmat}{
\includegraphics*[width=\textwidth, viewport=0 0 708 418, clip=true]
{SmatExample} }

\newsavebox{\FBAgeom}

\begin{picture}(\strippt\textwidth, \strippt\textheight)
\put(0,\strippt\textheight){\usebox{\toynet}}

\end{picture}
} % end of \frame

\end{document}

When I try to compile this, I get the following error:

No file test.nav.
<SmatExample.eps> <SmatExample.eps>
! Undefined control sequence.
\strippt ->\strip
                  @pt
l.27 }
       % end of \frame

And here is another question I had using the same image (if you want to download the image to work with the MWE):

How to correctly clip with viewports with includegraphics and beamer columns?

Note that in my current example I haven't attempted to use the correct coefficients for \textwidth or \textheight.

bbarker
  • 1,177
  • What are you trying to do exactly and what is the question? Or what doesn't work? – cfr Jun 05 '14 at 01:03
  • I forgot to include the error, but it doesn't compile. Will update with error message in 15 minutes. As for what I am trying to do, I hope to include several rectangles from an eps file in a picture environment. – bbarker Jun 05 '14 at 01:09
  • Actually, I would like to include some nonconvex polygonal objects eventually. – bbarker Jun 05 '14 at 01:13

1 Answers1

3

Package picture extends environment picture and related commands to allow length instead of factors for \unitlength in their arguments:

\documentclass[compress,red,notes]{beamer}
\usepackage{picture}

\begin{document}

\frame{\frametitle{An overview to constraint-based modeling}

\newsavebox{\toynet}
\savebox{\toynet}{
\includegraphics*[width=\textwidth, viewport=0 418 708 718, clip=true]
{SmatExample}  }

\newsavebox{\toySmat}
\savebox{\toySmat}{
\includegraphics*[width=\textwidth, viewport=0 0 708 418, clip=true]
{SmatExample} }

\newsavebox{\FBAgeom}

\begin{picture}(\textwidth, \textheight)
  \put(0,\textheight){\makebox(\textwidth,0)[t]{\usebox{\toynet}}} 
\end{picture}
} % end of \frame
\end{document}

Result

Answer to the error of the question

! Undefined control sequence.
\strippt ->\strip
                  @pt

This is a typical error, if @ has the wrong category code. \makeatletter and \makeatother are not working in a normal frame, because the contents of the frame is already parsed and tokenized, before the category code are changed. Either move \makeatletter and \makeatother outside the frame or use option fragile:

\begin{frame}[fragile]
  \frametitle{...}

  \makeatletter
  \def\strippt{\strip@pt}
  \makeatother
  ...
\end{frame}
Heiko Oberdiek
  • 271,626