[texhax] Creating an environment with unexpected results

Scott Hyde hydes at byuh.edu
Mon Jun 4 23:59:45 CEST 2007


Hi,

I'm trying to create an environment with picture commands in it, such as /line, /vector, etc.  In addition, I am trying to color it.  The code is given below.  The line it is graphing \line(10,13){20}, should be the same line.  However, it graphs two separate lines separated horizontally.  In addition, if the % is removed before the \put in the {newpicture} environment in the body of the code, the line moves around more.  Why is it moving around?  I think it should only show one line, but it is showing two.

-Scott

\documentclass[10pt,letterpaper]{article}

\usepackage{color}
%\usepackage{pict2e}
\usepackage{epic,eepic}

%% An example of a template graph
\newcommand{\backgraph}[0]{
  \put(0,0){\line(10,13){20}}
}

\makeatletter\newenvironment{newpicture}{%
  \begin{lrbox}{\@tempboxa}\begin{picture}(50,50)
      {\color{yellow} \backgraph}
      \color{blue} \thicklines}{\end{picture}\end{lrbox}%
  \colorbox{black}{\usebox{\@tempboxa}}
}\makeatother

\begin{document}

%% Additional drawing on the template
\begin{newpicture}
\thinlines 
%\put(0,0){\line(10,13){20}}
\color{green} \put(0,0){\line(10,13){20}}
\end{newpicture}
  
\end{document}


More information about the texhax mailing list