Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.
1) \begin{ttfamily}\verb 'OR'1'='1 \end{ttfamily} 

2) \begin{ttfamily}\verb SELECT userid FROM CMSUsers WHERE user = 'foo' AND password = 'bar'; \end{ttfamily}

I'd like to have the accents like the ones I get in 1) also in 2)

I'm wondering, the code is the same but the results are different.

Can someone tell me why?

share|improve this question
1  
1. There is no ttfamily environment. 2. Use delimiters for the \verb macro: \verb|'OR'1'='1| and \verb|SELECT userid FROM CMSUsers WHERE user = 'foo' AND password = 'bar';|. 3. In these cases you could just use \texttt. –  Qrrbrbirlbel Jan 5 '13 at 11:19
    
In its current shape, your question makes a little sense to me. Please, convert it to a Minimal (non)-Working Example (MWE), and eventually add image of the desired output (printscreen from another program, ...). –  tohecz Jan 5 '13 at 11:22
    
Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers. –  Jubobs Mar 2 at 14:03
add comment

1 Answer

Only for T1 encoding you'll get the same. Otherwise some symbols are taken from the symbol font instead of the typewriter font:

\documentclass[12pt]{article}
\begin{document}
\verb|foo "\bar" {baz} 'OR'1'='1'|

{\ttfamily foo "\textbackslash bar" \{baz\} 'OR'1'='1'}

\fontencoding{T1}\selectfont
\ttfamily foo "\textbackslash bar" \{baz\} 'OR'1'='1'

\fontfamily{fvm}\selectfont% Bera Mono, can be scaled \usepackage[scaled=0.84]{beramono}
foo "\textbackslash bar" \{baz\} 'OR'1'='1'
\end{document} 

enter image description here

share|improve this answer
    
Thanks everyone I found a solution by using \begin{ttfamily}\verb|...|\end{ttfamily} –  g9999 Jan 5 '13 at 16:03
3  
sorry, but that solution is nonsense. –  Herbert Jan 5 '13 at 16:18
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.