3

I want to insert a function using verbatim so that my code looks like in a good way (different than regular text). When I insert a function, I always start a new line. Could I insert the function just followed my text by not starting a new line? Thank you. PS: I want put the text "We call the function below via" and the function "tran.prob(N=5, q=0.5)" in the same line.

Here is my code:

We call the function below via 
\begin{verbatim}
tran.prob(N=5, q=0.5)
\end{verbatim}
3
  • 1
    Use \verb|tran.prob(N=5, q=0.5)|
    – Clément
    Feb 4, 2015 at 20:41
  • I would even say: Welcome to TeX.SX! !
    – Clément
    Feb 4, 2015 at 20:50
  • 1
    If you need the verbatim "conditioned" in any way (color, size, shape, etc.) other than what \verb|tran.prob(N=5, q=0.5)| yields, let me know. There are other options for more fancy verbatim forms. Feb 4, 2015 at 21:27

1 Answer 1

3

Just use \verb|tran.prob(N=5, q=0.5)|.

\documentclass{article}
\begin{document}
We call the function below via \verb|tran.prob(N=5, q=0.5)|, which is inline.
\end{document}

A screenshot

4
  • Or simply \texttt
    – egreg
    Feb 4, 2015 at 20:45
  • Yes, but \texttt would not work if the function was called tran%prob: File ended while scanning use of \texttt .
    – Clément
    Feb 4, 2015 at 20:48
  • Just to point to a simpler solution that works in many cases.
    – egreg
    Feb 4, 2015 at 20:52
  • I had no doubt that you knew that :-)
    – Clément
    Feb 4, 2015 at 20:52

You must log in to answer this question.

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