I have the following:
\documentclass[a4paper]{article}
%% Language and font encodings
\usepackage[greek, english]{babel}
\usepackage[iso-8859-7]{inputenc}
\usepackage{amsfonts}
\usepackage{amsmath}
\selectlanguage{english}
\title{Your Paper}
\author{You}
\begin{document}
\maketitle
\begin{abstract}
blah blah
\end{abstract}
\section{Introduction}
\begin{verbatim}
% Ελληνικά (Greek) <-----
Dt = 0.0001;
t = 2+Dt:Dt:100;
% Comment
x = (1/3)*exp(-2*(t-2));
% Comment
x_sq = x.^2;
% Comment
result = Dt * sum(x_sq)
\end{verbatim}
\selectlanguage{greek}
Ελληνικά - \textlatin{This works well, this should appear in the first comment line inside verbatim}.
\end{document}
First of all, I am using PDFLatex. The problem is when I compile this code, the first comment inside verbatim environment appears in latin characters, not in Greek. Is there any way to overcome this?
Thank you in advance.
pdftex,xetex,luatex). Please edit your question and add a MWE. – David Purton Jan 04 '19 at 13:43inputenc. – egreg Jan 04 '19 at 14:42