So I've been looking to expand on the following bit of code (a hack to not screw up the margins when using oversized figures):

  \blindtext & \blindtext

I wanted to turn this into an environment, so was thinking of doing the following:


This throws a strop, LaTeX decides to insert the "missing" brace. So to see if this was a newenvironment quirk, I tried the following bit of code:

  \blindtext & \blindtext

LaTeX once again tries to insert the "missing" brace. Any suggestions how I can resolve this?

  • 2
    You must save the contents in a savebox. An example can be found on tex stackexchange: tex.stackexchange.com/questions/26881/… – Marco Daniel Sep 9 '11 at 16:11
  • For me it's duplicated. – Marco Daniel Sep 9 '11 at 16:11
  • @Macro: \makebox doesn't scale, so a fail the duplication. It is true that you need to store the content in a box, but this doesn't make it a duplicate just because this was also required for the other question. – Martin Scharrer Sep 9 '11 at 17:08
  • @Martin: The linked question was an example how to use savebox ;-) – Marco Daniel Sep 9 '11 at 17:10
  • @Macro: Ah, ok. Please link to the duplicated question then. In your first comment you should have linked to the answer which uses savebox, not to the question BTW. – Martin Scharrer Sep 9 '11 at 17:13

You can only use \bgroup and \egroup as a replacement for { and } if LaTeX is expanding the content like it does for low-level boxing commands, but not when it is looking for an macro argument. The \makebox macro reads the content as argument not as box, so your attempt doesn't work. I wrote the realboxes package which provides variants of all \...box macros which read the content as real boxes using my other package collectbox. Simply load realboxes and use \Makebox instead:


Also have a look on my adjustbox package which provides an \adjustbox macro and adjustbox environment. It also allows \bgroup/\egroup and provides many options which can be easily combined. A \makebox[\textwidth] (which by default centers the content) can be done using \adjustbox{center=\textwidth}. The \textwidth is already the default value, so \adjustbox{center} would be enough.


You can easily collect information that is meant to span from \<myenv> to \<endmyenv> by using the environ package. The contents of the environment is subsequently contained in the \BODY macro, giving you access to provide it as argument to another macro or environment. Not sure whether this addresses your needs, but here's a mock-up:

\usepackage{tabularx}% http://ctan.org/pkg/tabularx
\usepackage{blindtext}% http://ctan.org/pkg/blindtext
\usepackage{environ}% http://ctan.org/pkg/environ
\NewEnviron​{mybox}[1][\textwidth]{% \begin{mybox}[..] ... \end{mybox}
    \BODY% Typeset contents

    \blindtext & \blindtext


In the above example, the default if no optional argument is specified, is \textwidth.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.