Marco87″ post=82534Ciao 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:
- La sigma che viene scritta è quella che compare al termine delle parole greche (se non sbaglio);
- 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.
Lo spazio lo metti tu. 🙂
`\newcommand{\greco}[1]{%
\begin{otherlanguage*}{greek}
\ifincode\greekcodefont\fi#1% <--- Eccolo qui!
\end{otherlanguage*}}`
Per avere la sigma mediale, scrivi [tt]\gcode{s\noboundary}[/tt]
Ma ti consiglio una definizione diversa per usare lettere greche nel codice:
`\newcommand{\gcode}[1]{\foreignlanguage{greek}{\greekcodefont#1\noboundary}}`
e così risolvi il problema molto meglio, senza accrocchi nel comando [tt]\greco[/tt].
Ciao
Enrico