[Tex/LaTex] Inline verbatim

htmlinline()verbatim

I would like to write something like this inline:

This is paragraph element <p>

I'm using verbatim for writing the HTML element part, but cannot form everything in one line. I get something like this:

This is paragraph element
<p>

After looking through some answers on this forum I found that I should use \verb.
Can anyone help me correct my code:

This is paragraph element
\begin{verbatim}
<p>
\end{verbatim}

Best Answer

To typeset inline verbatim-like material, it's best to use the macros \verb and \Verb; the latter is provided by the fancyvrb package. If that package is loaded and the instruction \VerbatimFootnotes is executed, one can even have \Verb instructions in footnotes. (One can't do this with \verb.)

Note that \verb and \Verb don't use matching pairs of curly braces ({ and }) to delimit their arguments; instead, use any non-letter symbol (except "*") that doesn't occur in the verbatim material itself. (Even \verb{<p>{ is legal, though I'll be the first one to state that it looks positively weird.)

If you prefer to render the inline verbatim material using the "regular" text font instead of a monospaced font, consider loading the listings package and writing "Paragraph element \lstinline{<p>}".

enter image description here

\documentclass{article}
\usepackage{fancyvrb} % for "\Verb" macro
\VerbatimFootnotes    % enable use of \Verb in footnotes

\setlength\textheight{3cm} % just for this example

\begin{document}
\obeylines
Paragraph element \verb+<p>+
Paragraph element \verb_</p>_
Paragraph element \Verb^<p>^
Paragraph element \Verb#</p>#
\VerbatimFootnotes
Some text.\footnote{In a footnote: \Verb"<p>",  \Verb:</p>:.}
\end{document}