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}
122174
It looks like you can't use \verb|...| inside of \textbf{...}. I tried the following:  \textbf{Be very careful when using \verb|-i| as it's destructive and it's not reversible!}   And got this error:  ! LaTeX Error: \verb illegal in command argument.   Any ideas?
49215
I have \newcommand\dd[2]{\item[\texttt{#1}] #2} and later I have   \dd{bc}{text \verb#$(echo 5+4 | bc)# text \verb#$((5+4))# text}   and I get  ! You can't use `macro parameter character #' in math mode. &lt;argument&gt; ...nicht mit \verb ##$(echo 5+4 | bc)## rechnen, sondern die neue... l.74 ...ekten Rechnen, \verb#$((5+4))#, benutzen.} Sorry, but I'm not programmed to handle this case; I'll just pretend that you didn't ask for it. If you're in the wrong mode, you might be able to return to the right one by typing `I}' or `I$' or `I\par'.   How can I get the verbatim into my command without the command interpreting it wrongly?
117248
I defined a certain command, but now I want to change its definition. I tried to simply change it, but it doesn't compile.  What should I do?  Thank you very much.  EDIT  The former command was  \newcommand{\dt}{\frac{\partial \gamma}{\partial t}}  Then I wanted to change it to   \newcommand{\dt}{\dot{\gamma}}  but it didn't work. Now I tried with   \renewcommand{\dt}{\dot{\gamma}}  but I got this message:     LaTeX Error: \dt undefined.
18440
I want to generate a PDF of user-submitted text using LaTeX. To handle crazy user input, I first thought about using the verbatim package, but of course it doesn't break up too long lines. Is there some package that works similar to verbatim (i.e., accept any input) but formats the text nicely?
64056
Inside the verbatim environment, is it possible to use a different color, please? For example, I want a to be normal, i.e., black. But I want b to be red.  \documentclass[]{article}  \begin{document}  \begin{verbatim} a (black) b (I want this letter to be red) \end{verbatim}  \end{document}   Follow-up Question:  The solution provided by Ignasi was neat. However, there is a problem. If I need to write the entire verbatim in a non-black color, then it will not work.  \documentclass[]{article} \usepackage{fancyvrb} \usepackage{xcolor}  \begin{document}  I want the following to look exactly like the way I put, i.e., like an align. But it displays in one line. How to fix?  \begin{Verbatim}[commandchars=\\\{\}] \textcolor{red}{ a = b + 1   = x + y   = s + t   = c - d   = o * p } \end{Verbatim}  \end{document}
19668
I need the characters «» in my LaTeX document.  I'm writing in English though, and I don't want to use Babel.  I have the following hack but I'd like a better way:  \newcommand{\q}[1]{{% \font\larm = larm1000% \larm% \char 190}{#1}{% \font\larm = larm1000% \larm% \char 191}}
5046
Is it possible and furthermore constructive to make LaTeX automatically format specific words in specific way? Let's say, for example, I'd like to have every occurrence of the word "hello" in a bold cyan monospaced font, whereas the rest of the document remains normal, sans serif and black.   How can I achieve that without having to do a search&amp;replace to place "hello" into a custom command every time before I compile the .tex file?
121839
I have quite a simple question. I was wondering if it was possible to do something like this in LaTeX:    But formatted a little more nicely.  It doesn't need to be arrows necessarily. Just some form of annotation marker.
16244
The first time I learnt LaTeX, I thought \newcommand properly fits for inline mode and \newenvironment for displayed mode.  Later I noticed it is not correct. So the question is   What is the rule of thumb when deciding whether we should use one over the other one?
70228
I've found a number of answers online, and plainly none of them have seemed to be able to execute any conditional code.  answer looked particularly promising.  One thing I noticed is that in the command line help, xetex (and similarly pdflatex) claim that the COMMANDS part of      xetex [OPTION]... [TEXNAME[.tex]]   [COMMANDS]   is latex code that will be processed after the file TEXNAME.tex. Now it occurs to me that this would cause any conditionals which rely on the value of the flags set in COMMANDS to fail, due to the processor not finding the flag value until the end of the file, at which point it is too late. How do I get a command line argument to be interpretted as xetex/latex code which is to be inserted into the document at some point before the \begin{document} element?  The specific problem that I have, is that I want a document that may contain hyperlinks to different parts of the document, but only if I flag it as an electronic copy upon compilation.
40907
To modify the definition of a command we use \renewcommand, but how about modify a beamer template. For example if we change itemize item like this:   \defbeamertemplate{itemize item}{triangle} {\scriptsize\raise1.25pt\hbox{\donotcoloroutermaths$\blacktriangleleft$}}   We get the error:     ! LaTeX Error: Command \beamer@@tmpop@itemize item@triangle already   defined.   This is an example of that:  \documentclass{beamer}  \defbeamertemplate{itemize item}{triangle}     {\scriptsize\raise1.25pt\hbox{\donotcoloroutermaths$\blacktriangleleft$}}  \begin{document}  \begin{frame} \setbeamertemplate{itemize item}[ball]  \begin{itemize} \item  text  \item  text \end{itemize}  \setbeamertemplate{itemize item}[tiangle]  \begin{itemize} \item  text  \item  text \end{itemize}  \end{frame}  \end{document}
77711
Typically, to box in some text, I use the following:  \fbox {     \parbox{\linewidth}{     This is some text! Blah blah blah...     } }   However, say I have a verbatim block within that. It will never compile. Anyone know how I could draw a box around text which contains a verbatim block? I should note that I want to be able to draw a box around not just a verbatim block. For example, I would want to draw a box around something like:  This is text. \begin{verbatim} This is some more text. \end{verbatim} And this is even more text.
59057
I want to define a command \filepath so that I can use \filepath{foo_bar.cpp} and it is printed in monospaced font.  Also, why does this not work? I get strange errors:  \newcommand{\filepath}[1]{\verb!#1!}
83232
Is it possible to tell the LaTeX command not to use line breaks in its console / log output?  This would make it easier to automate the processing of the log file, e.g. extracting the names of missing graphics files like in this output  ! LaTeX Error: File `figures/triggers/muontriggers/notmu18_medium_mu10_loose/2d map_abs_eta_phi.pdf' not found.   which are otherwise cut into pieces and unnecessarily difficult to grep etc.
94612
I'm having a problem that I've had before and I'm tired of hacking my way through it and hope that there is some supported solution.  I'll go ahead and create a document for example:  \documentclass {article} \begin{document} \section {Introduction} In the introduction of the document, you will find plenty of verbatim \verb|texts that| have an hard time wrapping. \end{document}   So, the problem here is that the \verb environment doesn't wrap well (unlike the example I posted above where I put in the return to aid in viewing).  There is an overfull hbox error.  How can I make the \verb command wrap and justify with its surroundings better?  I would expect LaTeX to just increase or decrease the spacing around the \verb command.  Is it just too much smooshing or stretching for LaTeX to agree to do it?  Thanks in advance for any help.  [EDIT] After reading  I think that \texttt may be the right way to go here.  This considerably covers the question above, but the question still stands: What about \verb?  [EDIT] Also see the related question about \texttt{}
112224
Do you know how LaTeX implements environments? To be more precise, what does  \newenvironment{&lt;env-name&gt;}[&lt;n-args&gt;][&lt;default&gt;]{&lt;begin-code&gt;}{&lt;end-code&gt;}   in terms of TeX commands (i.e., how is the LaTeX command \newenvironment defined in TeX)?
40765
In LaTeX, if I use \verb, how can I escape |? For example, I want to display ab|bc: \verb|ab[]bc|. What should replace []?