Trouble wrapping scalebox in an environment with fixed scale factor

11,323

You are trying to have unmatched { and } and the begin and end part of the environment, which TeX won't let you do. Your \newenvironment is read as follows by LaTeX:

\newenvironment{scaleb}{ \scalebox{0.7}{} {} }

so you have an empty \scalebox and no endscaleb-part. Accessing the content of an environment is slightly tricky and depends on your circumstances (can your scaleb environments be nested, do you want to be able to build new environments on top of scaleb so that you don't have a literal "\end{scaleb}" in your document, etc.) Maybe the environ package can help you: http://www.ctan.org/tex-archive/macros/latex/contrib/environ/.

Share:
11,323
Klaus
Author by

Klaus

Updated on July 18, 2022

Comments

  • Klaus
    Klaus almost 2 years

    The graphicx package provides a scalebox command. I'd like to encapsulate it in an environment like that:

    \newenvironment{scaleb}{ \scalebox{0.7}{ } {}}
    

    However, the second example below works, but the first one outputs the text without scaling and destroys all my layout.

    \begin{scaleb}test\end{scaleb}
    \scalebox{0.7}{test}
    

    What am I doing wrong ?