开发者

Trouble wrapping scalebox in an environment with fixed scale factor

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 ?


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/.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜