I am preparing a latex document. Inside the body of a function I need to use the ceiling function. How will I use the ceiling function inside verbatim?


Method a(b)


  return a(ceiling of sqrt(b));


Can anyone suggest me how to write ceiling inside verbatim?

  • Welcome to TeX.sx! Your post was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question.
    – Werner
    Commented Mar 22, 2013 at 5:23

1 Answer 1


fancyvrb provides a stepping stone to mix regular math with verbatim content. Here's a small example:

enter image description here

\usepackage{fancyvrb}% http://ctan.org/pkg/fancyvrb
Method \mesc{a(b)}
return \mesc{a(\lceil\sqrt{b}\rceil)};

You can, of course, also try using listings, which provides the mathescape key; yielding similar results as above.


You must log in to answer this question.

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