# Ceiling function within verbatim in latex

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?

\begin{verbatim}

Method a(b)

.
.
.

return a(ceiling of sqrt(b));

\end{verbatim}

Can anyone suggest me how to write ceiling inside verbatim?

-

## migrated from stackoverflow.comMar 22 '13 at 0:43

This question came from our site for professional and enthusiast programmers.

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 Mar 22 '13 at 5:23

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

\documentclass{article}
\usepackage{fancyvrb}% http://ctan.org/pkg/fancyvrb
\newcommand{\mesc}[1]{$#1$}
\begin{document}
\begin{Verbatim}[commandchars=\\\{\}]
Method \mesc{a(b)}
.
.
.
return \mesc{a(\lceil\sqrt{b}\rceil)};
\end{Verbatim}
\end{document}

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

-
Thanks Werner, it works! Thanks for the example. –  Neel Mar 21 '13 at 17:38