From the fancyvrb documentation, it looks like I can set left and right margins (paragraph 4.1.13) only. How can I set the top margin for my environment?

More specifically, given that I have a frame and a top title in my environment, I would like some extra padding between the top frame and the first line of text.

\newcommand{\shellheader}{This is a Shell}
  • Please, add the code you have up to now.
    – egreg
    Commented Jul 24, 2012 at 9:42

1 Answer 1


I propose a horrible hack that should take into account all your needs:


\newcommand{\shelltitle}{This is a shell}

  \def\FV@ProcessLine{\noindent\vrule height3ex depth2ex 
                      \hbox to\hsize{\kern\FV@FrameSep This is the shell prompt\hfil}%


%prompt echo foo{}
%prompt echo bar

Act on 3ex and 2ex for modifying the spacing before and after the fixed "This is the shell prompt".

enter image description here

  • Awesome. There's only one little detail left. I'm using the "samepage=true" option. This causes the actual shell content not to be broken, but it doesn't work for the header. Any way I can include the header line ("This is the shell prompt") in the "unbreakable" content? Commented Aug 2, 2012 at 11:22

You must log in to answer this question.

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