I have the following piece of code:
\newenvironment{mylisting}
{\begin{list}{}{\setlength{\leftmargin}{1em}}\item\scriptsize\bfseries}
{\end{list}}
\newenvironment{mytinylisting}
{\begin{list}{}{\setlength{\leftmargin}{1em}}\item\tiny\bfseries}
{\end{list}}
\begin{mylisting}
\begin{verbatim}
I want to display an accent in this text (i.e. más)
\end{verbatim}
\end{mylisting}
The word "más" should be displayed with accent but I got:
m'as
The verbatim
environment is ignoring the accent.
BTW According to my config, the accent is displayed just using ' before the letter.
Anyone knows how to solve this issue?
Best Answer
The semantics of the
verbatim
environment is that it displays your input verbatim (i.e., without any processing). So even if you have a setup, for example babel, where it is possible to enter accents using abbreviations such as'a
such shortcuts are disabled withinverbatim
.Thus, if you do require input processing and you only selected
verbatim
to get a typewriter font, then the obvious solution is to simply choose such a font directly in your definition, e.g., via{\ttfamily ...}
or\texttt{...}
. If on the other hand you are looking for some environment that obeys spacingalltt
may help. It might be that shortcuts do not work but normal commands are executed so\'a
will generate the correct glyph.