First of all, I'm sorry if this is a bit of an obvious newbie question, I've tried reading as many of the posts on here about doing this sort of thing, but was unable to get any of them to work.

I'm working on a macro which draws a vertical line down the side of some text, the following version works perfectly when used like \sbshort{Foo Bar}

\long\def\sbshort #1 {\par{\bigbreak\vbox{\hbox{\vrule\kern3.5pt\everypar{\leftskip 5pt\rightskip 2.75pt}\vbox{\noindent {#1}}}}\par}}

However when I try to use the environ package as follows:

Foo Bar

I receive the error Argument of \env@ignore has an extra }.

  • 1
    There is a space after #1 that shouldn't be there.
    – egreg
    Commented Jan 20, 2012 at 11:49
  • @egreg Thankyou so much! I hadn't realised that could cause a problem. It's all working perfectly now. Commented Jan 20, 2012 at 11:53

2 Answers 2


There is a spurious space in your definition, that could be simplified in many ways: for example

      \vbox{\advance\hsize-5.9pt \noindent#1\par}%

However, a high level package can do the same and also allow page breaks inside your environment:


I have had some problems with the usage of environ package, but I solved them the following way: Suppose we want an environment equivalent of \foobar{lorem impsum or anything}, let's say \begin{FOOBAR}lorem ipsum or anything\end{FOOBAR}

% \makeatletter because we use at-signs in the macros

% The environment foobar@env only stores the \BODY in \foobar@BODY

% Now we define our foobar environment
  \FOOBAR@env% at \begin{FOOBAR} we just begin FOOBAR@env
  \endFOOBAR@env% at \end{FOOBAR}, firstly end FOOBAR@env
  \foobar{\FOOBAR@BODY}% perform the command on the stored material
  \global\let\FOOBAR@BODY\@undefined% free the resources

% \makeatother as the counterpart of \makeatletter
  • What's wrong with \NewEnviron{FOOBAR}{\foobar{\BODY}}?
    – egreg
    Commented Jan 21, 2012 at 23:23
  • It simply doesn't work in some cases. There happened an error when I made something like \NewEnviron{FOOBAR}{\sbox{\mybox}{\vbox{\BODY}} ... \smash{\usebox{\mybox}}} (I don't remember the exact thing, because once I solved it, I forgot the details.)
    – yo'
    Commented Jan 23, 2012 at 13:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .