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.

I have witten html/jsf code and some comments in Latex verbatim environment:

\begin{verbatim}
Predloga dokumenta:
<f:view>
<!– korenski element-->   
  <%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%> 
  <%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%> 
<!– deklaracija knjižnic--> 
<html> 
 <head> 
 ... 
 </head> 
<body> 
 <h:form> 
  <%-- (Form components) --%> 
  <!– JSF obrazec--> 
  </h:form> 
</body> 
</html> 
</f:view> 
\end{verbatim}

But in output(PDF and DVI files) I get:

Predloga dokumenta:
<f:view>
<!{ korenski element-->   
  <%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%> 
  <%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%> 
<!{ deklaracija knjižnic--> 
<html> 
 <head> 
 ... 
 </head> 
<body> 
 <h:form> 
  <%-- (Form components) --%> 
  <!{ JSF obrazec--> 
  </h:form> 
</body> 
</html> 
</f:view> 

What have I messed up? I thought that everything in verbatim environment should stay same also in output file.

share|improve this question
    
Welcome to TeX.SX. You should add a minimal working example, since the normal behavior of LaTeX is to write -- separated in a verbatim environment. –  egreg Jan 8 '12 at 11:43

2 Answers 2

<!– korenski element-->   

the – is the unicode character for an en-dash and not the hypen sign. However, it should also be <!--. Listings cannot handle unicode characters so you get something different.

share|improve this answer

If you add this to your preamble

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

it works as expected

MWE:

\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\begin{document}
    \begin{verbatim}
    Predloga dokumenta:
    <f:view>
    <!– korenski element-->   
      <%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%> 
      <%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%> 
    <!– deklaracija knjižnic--> 
    <html> 
     <head> 
     ... 
     </head> 
    <body> 
     <h:form> 
      <%-- (Form components) --%> 
      <!– JSF obrazec--> 
      </h:form> 
    </body> 
    </html> 
    </f:view> 
    \end{verbatim}
\end{document}
share|improve this answer

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.