GeneralHow to pass \newenvironment arguments to {end definition} ?

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
fractal.generator
Posts: 66
Joined: Tue Oct 07, 2008 9:39 am

How to pass \newenvironment arguments to {end definition} ?

Post by fractal.generator »

Dear all,

I am looking for the recommanded way to pass newenvironment arguments to {enddef}.

Right now I used my own way, but I am not sure whether it is the correct way.

If there is a better way to do so, let me know.

Here is my minimal code snippet.

Code: Select all

\documentclass{minimal}
\usepackage{graphicx}

\newsavebox{\tmpBox}%temporary box
\newcommand{\tmpScale}{}%temporary scale
\newenvironment{myBox}[1]%
{%
	\renewcommand{\tmpScale}{#1}%
	\begin{lrbox}{\tmpBox}%
}
{%
	\end{lrbox}\scalebox{\tmpScale}{\usebox{\tmpBox}}%
}


\begin{document}
\begin{myBox}{10}
\LaTeXe
\end{myBox}

\end{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
phi
Posts: 577
Joined: Tue Oct 21, 2008 8:10 pm

Re: How to pass \newenvironment arguments to {end definition} ?

Post by phi »

It's at least the best and easiest way I know.
iranacre
Posts: 7
Joined: Fri Jul 24, 2009 11:14 pm

How to pass \newenvironment arguments to {end definition} ?

Post by iranacre »

You can also use \pushQED and \popQED

Code: Select all

\newenvironment{myBox}[1]%
{%
   \pushQED{#1}%
   \begin{lrbox}{\tmpBox}%
}
{%
   \end{lrbox}\scalebox{\popQED}{\usebox{\tmpBox}}%
}
a358003542
Posts: 1
Joined: Fri Aug 30, 2013 7:43 am

Re: How to pass \newenvironment arguments to {end definition

Post by a358003542 »

thanks , that's help me a lot ,you already have the right road,the second suggestion is not work out .
Post Reply