0

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.

1
  • 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
    Commented Jan 8, 2012 at 11:43

2 Answers 2

1
<!– 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.

0

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}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .