0

I normally use \verb|\LaTeXe| to typeset the command \LaTeXe in my document. But now I want to frame or/and colorize the command \LaTeXe. How can we do that?

\documentclass{article}
\usepackage{xcolor}
\begin{document}
\textcolor{blue}{text}\\ % without \verb is ok
\textcolor{blue}{\verb|\LaTeXe|}\\ % this is illegal, but I want to colorize the command \LaTeX2e
\fbox{text}\\ % without \verb is ok
\fbox{\verb|\LaTeXe|} % this is illegal too, but I want to frame around the command \LaTeXe. So how can I do that?
\end{document}
Joseph Wright
  • 259,911
  • 34
  • 706
  • 1,036
Say OL
  • 1,793
  • 2
    One example would be to use \textcolor{blue}{\texttt{\string\LaTeX2e}} and/or \fbox{\texttt{\string\LaTeX2e}}, as suggested in How to put \verb command inside of \textbf block? There is also the option of using fancyvrb, or listings, or ... – Werner Jan 30 '15 at 04:33
  • @Werner I actually use listings package but use it whenever I need to include long code. However, I like your solution \textcolor{blue}{\texttt{\string\LaTeX2e}} and \fbox{\texttt{\string\LaTeX2e}}. It does not require additional packages (y) – Say OL Jan 30 '15 at 15:32
  • 1
    These kinds of things are quite easy to do with the verbatimbox package. You can search the site, yielding things like http://tex.stackexchange.com/questions/141100/getting-verbatim-with-soft-grey-background-as-in-tex-stackexchange/141101#141101 or this: http://tex.stackexchange.com/questions/174455/typeset-source-code-with-tcolorbox/174472#174472 – Steven B. Segletes Jan 31 '15 at 12:10

0 Answers0