Also I read: When should one use \verb and when \texttt
My issue at hand is that I would like to write a little more than just "small pieces" (wording in linked question) of program code, but without having to escape all the special characters. On the other hand, \verb
does not have {}
-style delimiters, besides being said to have issues with moving arguments.
Is there something I can do such that (sample text follows)
"As a user, do \texttt{if (!(last\_cond \&\& (last\_flags \& (O\_CREATE | O\_EXCL))))}
, but as root, do \texttt{if (!(last\_cond \&\& (last\_flags \& (O\_RDONLY))))}
until…"
can be written as
"As a user, do \texttt{if (!(last_cond && (last_flags & (O_CREATE | O_EXCL))))}
, but as root, do \texttt{if (!(last_cond && (last_flags & (O_RDONLY))))}
until…"
edit:
Defining a new command as in \verbdef
and having to write "As a user, do \verbdef\demo1{\texttt{if (!(last_cond && (last_flags & (O_CREATE | O_EXCL))))}}\demo1
, but as root, do \verbdef\demo2{\texttt{if (!(last_cond && (last_flags & (O_RDONLY))))}}\demo2
until…" does read strangely (in the tex source file).
Best Answer