TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
There is a space after #1 that shouldn't be there. – egreg Jan 20 '12 at 11:49
@egreg Thankyou so much! I hadn't realised that could cause a problem. It's all working perfectly now. – Simon StJohn-Green Jan 20 '12 at 11:53
up vote 5 down vote accepted

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:

share|improve this answer

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
share|improve this answer
What's wrong with \NewEnviron{FOOBAR}{\foobar{\BODY}}? – egreg Jan 21 '12 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' Jan 23 '12 at 13:34

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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