Re: Lettere greche in un codice – listings

#83183
Up
0
Down
::


Ciao Elrond,

non riesco a usare il codice che mi hai suggerito per far scrivere le lettere greche. Cercando in rete ho trovato questo codice di Enrico:
`\documentclass[a4paper,11pt,extrafontsizes,twoside,openright]{memoir}

\usepackage{etex}
\usepackage{etoolbox}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[greek,italian]{babel}
\usepackage{microtype}

\usepackage{listings}
\lstset{language=Mathematica,
basicstyle=\footnotesize\ttfamily,
keywordstyle=\footnotesize\bfseries,
identifierstyle=,
commentstyle=\color{grigioScuro},
stringstyle=\ttfamily,
showstringspaces=false,
numbers=left,
numberstyle=\tiny,
escapechar={|}}

\newcommand{\greco}[1]{%
\begin{otherlanguage*}{greek}
\ifincode\greekcodefont\fi#1
\end{otherlanguage*}}
\newcommand{\greekcodefont}{\fontfamily{neohellenic}\selectfont}
\newif\ifincode

\lstnewenvironment{codice}%
{\incodetrue\setkeys{lst}{columns=fullflexible,keepspaces=true}%
\lstset{basicstyle=\small\ttfamily,escapeinside={£*}{*£}}%
}%
{}

\begin{document}

\begin{codice}
£*\greco{s}*£ £*\greco{s}*£Table
\end{codice}

\end{document}`
ma sorgono due problemi:

  1. La sigma che viene scritta è quella che compare al termine delle parole greche (se non sbaglio);
  2. La scritta che segue la lettera sigma è staccata da essa di uno spazio, mentre mi piacerebbe poterle avere attaccate.

Ci sarà un modo per ovviare a questi problemi?

Grazie e ciao,
Marco.

Go to top