0

I have this document class in which I type both in English and Greek.

\documentclass[12pt, a4]{article}

\usepackage{microtype}
\usepackage{fontspec}
\usepackage{hyperref}
\usepackage{xltxtra} 
\usepackage{xgreek}
\setmainfont[Mapping=tex-text]{Liberation Sans} 

\usepackage{listings}
\input{listcode}

\begin{document}
    english text : hello

    greek text   : γεια σου

    \lstinputlisting{my_code.ino}
\end{document}

It works fine except from the fact that I am not permitted to type Greek characters in the remarks of the code. This is the listcode package:

\lstset{
language=C,
basicstyle=\ttfamily, 
breakatwhitespace=false,
breaklines=true,
captionpos=b, 
commentstyle=\usefont{T1}{pcr}{m}{sl}\color{red},
deletekeywords={}, 
firstnumber=1, 
frame=leftline,
framerule=2.0pt,
numbers=left, 
numbersep=10pt,
numberstyle=\tiny\color{red}, 
rulecolor=\color{green}, 
showstringspaces=false, 
showtabs=false,
stepnumber=1, 
stringstyle=\color{blue}, 
tabsize=2, 
}

and this is an example code:

void setup(){
}

void loop(){
    //english remarks
    //ελληνικά σχόλια
}

This is what happens, that is Greek characters inside the snippet do not show up at all.

enter image description here

I suspect that the problem has to do with this line :commentstyle=\usefont{T1},

Could someone suggest how to configure this line (or any other line)?

Joseph Wright
  • 259,911
  • 34
  • 706
  • 1,036
  • 1
    Welcome to the site. It would be helpful if you posted a small, but complete, document demonstrating the issue, rather than just code snippets. – Steven B. Segletes Jul 24 '16 at 11:00
  • Now you've got code, it would help to strip out everything not absolutely required to demonstarte the problem, and build it back up again. I'm trying to do this for you at the moment – Chris H Jul 27 '16 at 08:20

0 Answers0