Re: Problema comandi in listings

#61710
Up
0
Down
::

Ho un testo (ampio) e compilandolo mi sono accorto che
all’interno di un ambiente costruito con listing \dots non viene interpretato.
Cercando di preparare un esempio minimo compilabile,
stesso preambolo intero e porzione pertinente del codice,
il risultato era quello voluto: risultano i tre puntini.
A questo punto non capisco cosa può essere…
Cmq:
`\documentclass[a4paper,titlepage]{book}

% codifica ecc.
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage[latin1]{inputenc}
\usepackage[italian]{babel}

% font
\usepackage[textlf]{MinionPro}
\input glyphtounicode
\pdfgentounicode=1
\usepackage[scaled]{myriad}
\usepackage[scaled=.8]{beramono}
\usepackage{microtype}
\frenchspacing

% impaginazione ecc.
\usepackage{emptypage}
\usepackage[margin=3.5cm]{geometry}
\setlength{\parindent}{0pt}
\usepackage{enumitem}
\setitemize{itemsep=.01em}
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}

% intestazioni
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\chaptermark}[1]{\markboth{\textbf{\thechapter. #1}}{}}
\renewcommand{\sectionmark}[1]{\markright{\textbf{\thesection. #1}}}
\renewcommand{\headrulewidth}{0.5pt}
\fancyhead[LO]{\nouppercase{\rightmark}}
\fancyhead[RE]{\nouppercase{\leftmark}}
\fancyhead[LE,RO]{\thepage}

% grafica
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{tikz-qtree}
\definecolor{maroon}{cmyk}{0, 0.87, 0.68, 0.32}
\definecolor{cyan}{rgb}{0.95,1,1}
\usepackage{framed}

% titoli sezioni
\usepackage{quotchap}
\renewcommand\sectfont{\sffamily\bfseries\Huge}
\makeatletter
\newcommand{\capitolo}{\@ifstar{\@scapitolo}{\@capitolo}}
\newcommand{\do@sq}[1]{%
\begin{savequote}\huge\sffamily\bfseries\color{maroon}#1\end{savequote}}
\def\@capitolo#1{%
\renewcommand\chapterheadstartvskip{\vspace*{-5\baselineskip}}%
\do@sq{#1}\chapter}
\def\@scapitolo#1#2{%
\renewcommand\chapterheadstartvskip{\vspace*{3\baselineskip}}%
\do@sq{#1}\chapter*{#2}
\markboth{#2}{#2}
\addcontentsline{toc}{chapter}{#2}}
\makeatother

% codice
\usepackage{listings}
\lstnewenvironment{code}%
{\lstset{%
basicstyle=\color{black}\small\ttfamily,
keywordstyle=\color{black},
commentstyle=\color{black},
stringstyle=\color{black},
backgroundcolor=\color{cyan},
moredelim=[is][\color{black}\textrm]{|*}{*|},
escapeinside={£!}{!£},
frame=lines,
rulecolor=\color{black}}}{}
\usepackage{upquote}

% copertina
\usepackage{eso-pic}
\makeatletter
\newcommand{\Sfondo}{%
\@ifstar{\def\star@Sfondo{*}\@Sfondo}
{\def\star@Sfondo{}\@Sfondo}}
\def\@Sfondo#1{%
\ClearShipoutPicture
\expandafter\AddToShipoutPicture\star@Sfondo{\AtPageCenter{%
\makebox(0,0){\includegraphics[width=\paperwidth, height=\paperheight]{#1}}}}}
\makeatother

% titoli e indice
\usepackage{tocloft,interfaces}
\setcounter{tocdepth}{1}
\settowidth{\cftsecnumwidth}{00.00\enspace}
\renewcommand{\cftpartfont}{\bfseries\scshape\color{maroon}}
\cftpagenumbersoff{part}
\renewcommand{\cftchapleader}{}
\renewcommand{\cftchapafterpnum}{\cftparfillskip}
\renewcommand{\cftsecleader}{}
\renewcommand{\cftsecafterpnum}{\cftparfillskip}
\setcounter{tocdepth}{1}
\tocsetup{part/skip=1.5em}
\tocsetup{chapter/skip=5pt}

% link e indice pdf
\usepackage{url}
\urlstyle{sf}
\usepackage{hyperref}
\hypersetup{pdfborder=0,colorlinks,citecolor=black,filecolor=black,%
linkcolor=maroon,linktocpage,urlcolor=maroon,bookmarksopen,hyperindex}
\usepackage{bookmark}

% kerning dell'apostrofo in MinionPro
\makeatletter
\catcode`\'=12
\def\qu@te{'}
\catcode`'=\active
\begingroup
\obeylines\obeyspaces%
\gdef\@resetactivechars{%
\def^^M{\@activechar@info{EOL}\space}%
\def {\@activechar@info{space}\space}%
}%
\endgroup
\providecommand\texorpdfstring[2]{#1}
\protected\def'{\texorpdfstring{\texqu@te}{\string'}}
\def\texqu@te{\relax
\ifmmode
\expandafter^\expandafter\bgroup\expandafter\prim@s
\else
\expandafter\futurelet\expandafter\@let@token\expandafter\qu@t@
\fi}
\def\qu@t@{%
\ifx'\@let@token
\qu@te\qu@te\expandafter\@gobble
\else
{}\qu@te{}\penalty\@M\hskip\expandafter\z@skip
\fi}
\scantokens\expandafter{%
\expandafter\def\expandafter\pr@m@s\expandafter{\pr@m@s}}
\AtBeginDocument{%
\toks@=\expandafter{\tikzpicture}%
\edef\tikzpicture{\catcode`\noexpand\'=12 \the\toks@}}
\let\tikzquote\texqu@te
\makeatother

\begin{document}
\begin{code}
# GRUB
GRUB> device (hd0) /dev/hdb
GRUB> root (hd0,0)
Filesystem type is ext2fs, partition type 0xfd

GRUB> setup (hd0)
Checking if “/boot/GRUB/stage1” exists £!\dots!£ yes
Checking if “/boot/GRUB/stage2” exists £!\dots!£ yes
Checking if “/boot/GRUB/e2fs_stage1_5” exists £!\dots!£ yes
Running “embed /boot/GRUB/e2fs_stage1_5 (hd0)” £!\dots!£ 15 sectors are
embedded.
succeeded
Running “install /boot/GRUB/stage1 (hd0) (hd0)1+15 p (hd0,0)/boot/GRUB/stage2
/boot/GRUB/menu.lst” £!\dots!£ succeeded
Done.

GRUB> quit
\end{code}
\end{document}`
Qui tutto sembra andare, ma quando compilo il testo integrale
nella stringa incriminata invece dei tre puntini vedo £!\dots!£
Non so che informazioni aggiuntive fornire…

Hai il malocchio. 🙂 Sicuro che il file sia codificato latin1?

Ciao
Enrico

Go to top