Problem with UTF-8 in Listings not beingsolved by standard answer
up vote
0
down vote
favorite
I'm using TeXstudio and pdfLaTeX. I'm trying to use the listings package to add some Matlab source code to my document. However, I'm having trouble with some portuguese letters used in the code (graphics captions, actually).
The common answer to this known encoding problem is shown here and here. However, even after adding the lstset{literate=}
with the correct list, the problem persists. I verified that the problematic letters and indeed in the list to be substituted, but no change.
The lstset
and the lstinputlisting[language=Matlab]{estrutura/dados/algoritmos/main.m}
I'm calling to add the code are in different files, but that was not a problem for any other package. I also verified that I can include code without any special characters.
What could be causing this problem and what would be a fix or an workaround?
Thanks for any help
EDIT for sample code:
This part is the one being used to substitute letters in the listings.
lstset{language=Matlab}
lstset{
inputencoding=utf8,
extendedchars=true,
literate=
{á}{{'a}}1 {é}{{'e}}1 {í}{{'i}}1
{ó}{{'o}}1 {ú}{{'u}}1 {Á}{{'A}}1
{É}{{'E}}1 {Í}{{'I}}1 {Ó}{{'O}}1
{Ú}{{'U}}1 {à}{{`a}}1 {è}{{`e}}1
{ì}{{`i}}1 {ò}{{`o}}1 {ù}{{`u}}1
{À}{{`A}}1 {È}{{'E}}1 {Ì}{{`I}}1
{Ò}{{`O}}1 {Ù}{{`U}}1 {ä}{{"a}}1
{ë}{{"e}}1 {ï}{{"i}}1 {ö}{{"o}}1
{ü}{{"u}}1 {Ä}{{"A}}1 {Ë}{{"E}}1
{Ï}{{"I}}1 {Ö}{{"O}}1 {Ü}{{"U}}1
{â}{{^a}}1 {ê}{{^e}}1 {î}{{^i}}1
{ô}{{^o}}1 {û}{{^u}}1 {Â}{{^A}}1
{Ê}{{^E}}1 {Î}{{^I}}1 {Ô}{{^O}}1
{Û}{{^U}}1 {œ}{{oe}}1 {Œ}{{OE}}1
{æ}{{ae}}1 {Æ}{{AE}}1 {ű}{{H{u}}}1
{Ű}{{H{U}}}1 {ő}{{H{o}}}1 {Ő}{{H{O}}}1
{ç}{{c c}}1 {Ç}{{c C}}1 {ø}{{o}}1
{å}{{r a}}1 {Å}{{r A}}1 {£}{{pounds}}1
{«}{{guillemotleft}}1 {»}{{guillemotright}}1
{ñ}{{~n}}1 {Ñ}{{~N}}1 {¿}{{?`}}1
}
This is the line calling listing of the source code
lstinputlisting[language=Matlab]{estrutura/dados/algoritmos/plot_bf_compare_in_out.m}
Specifically, the section of Matlab code throwing the error is
title("Comparação entre áudio antes e depois do beamformer");
EDIT 2: Since the complete text I am working is spread across multriple files and folders, I recreated the minimum document with everything that seems relevant to this problem and throws the same error. OneDrive download link here with the files.
EDIT 3:
Compilable LaTeX code
documentclass[%twoside, % Impressão em frente e verso
oneside, % Impressão apenas frente
]{utfpr-abntex2}
usepackage{nicefrac}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage{nicefrac}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage{booktabs}
usepackage{color, colortbl}
usepackage{float}
usepackage{graphicx}
usepackage{icomma}
usepackage{indentfirst}
usepackage{microtype}
usepackage{multirow, array}
usepackage{subeqnarray}
usepackage{lastpage}
usepackage{pdfpages}
usepackage{verbatim}
usepackage{amsfonts, amssymb, amsmath}
usepackage[algoruled, portuguese]{algorithm2e}
usepackage{times}
usepackage[bottom]{footmisc}
usepackage{ae, aecompl}
usepackage{latexsym}
usepackage{lscape}
usepackage{picinpar}
usepackage{scalefnt}
usepackage{upgreek}
usepackage{listings}
% Parte utilizada para que códigos fonte possam conter caracteres em português
lstset{language=Matlab}
lstset{
inputencoding=utf8,
extendedchars=true,
literate=
{á}{{'a}}1 {é}{{'e}}1 {í}{{'i}}1
{ó}{{'o}}1 {ú}{{'u}}1 {Á}{{'A}}1
{É}{{'E}}1 {Í}{{'I}}1 {Ó}{{'O}}1
{Ú}{{'U}}1 {à}{{`a}}1 {è}{{`e}}1
{ì}{{`i}}1 {ò}{{`o}}1 {ù}{{`u}}1
{À}{{`A}}1 {È}{{'E}}1 {Ì}{{`I}}1
{Ò}{{`O}}1 {Ù}{{`U}}1 {ä}{{"a}}1
{ë}{{"e}}1 {ï}{{"i}}1 {ö}{{"o}}1
{ü}{{"u}}1 {Ä}{{"A}}1 {Ë}{{"E}}1
{Ï}{{"I}}1 {Ö}{{"O}}1 {Ü}{{"U}}1
{â}{{^a}}1 {ê}{{^e}}1 {î}{{^i}}1
{ô}{{^o}}1 {û}{{^u}}1 {Â}{{^A}}1
{Ê}{{^E}}1 {Î}{{^I}}1 {Ô}{{^O}}1
{Û}{{^U}}1 {œ}{{oe}}1 {Œ}{{OE}}1
{æ}{{ae}}1 {Æ}{{AE}}1 {ű}{{H{u}}}1
{Ű}{{H{U}}}1 {ő}{{H{o}}}1 {Ő}{{H{O}}}1
{ç}{{c c}}1 {Ç}{{c C}}1 {ø}{{o}}1
{å}{{r a}}1 {Å}{{r A}}1 {£}{{pounds}}1
{ñ}{{~n}}1 {Ñ}{{~N}}1 {¿}{{?`}}1
}
begin{document}
lstinputlisting[language=Matlab]{plot_bf_compare_in_out.m}
end{document}
Sample of problematic source code file (.m):
figure;
title("Comparação entre áudio antes e depois do beamformer");
listings input-encodings
New contributor
|
show 7 more comments
up vote
0
down vote
favorite
I'm using TeXstudio and pdfLaTeX. I'm trying to use the listings package to add some Matlab source code to my document. However, I'm having trouble with some portuguese letters used in the code (graphics captions, actually).
The common answer to this known encoding problem is shown here and here. However, even after adding the lstset{literate=}
with the correct list, the problem persists. I verified that the problematic letters and indeed in the list to be substituted, but no change.
The lstset
and the lstinputlisting[language=Matlab]{estrutura/dados/algoritmos/main.m}
I'm calling to add the code are in different files, but that was not a problem for any other package. I also verified that I can include code without any special characters.
What could be causing this problem and what would be a fix or an workaround?
Thanks for any help
EDIT for sample code:
This part is the one being used to substitute letters in the listings.
lstset{language=Matlab}
lstset{
inputencoding=utf8,
extendedchars=true,
literate=
{á}{{'a}}1 {é}{{'e}}1 {í}{{'i}}1
{ó}{{'o}}1 {ú}{{'u}}1 {Á}{{'A}}1
{É}{{'E}}1 {Í}{{'I}}1 {Ó}{{'O}}1
{Ú}{{'U}}1 {à}{{`a}}1 {è}{{`e}}1
{ì}{{`i}}1 {ò}{{`o}}1 {ù}{{`u}}1
{À}{{`A}}1 {È}{{'E}}1 {Ì}{{`I}}1
{Ò}{{`O}}1 {Ù}{{`U}}1 {ä}{{"a}}1
{ë}{{"e}}1 {ï}{{"i}}1 {ö}{{"o}}1
{ü}{{"u}}1 {Ä}{{"A}}1 {Ë}{{"E}}1
{Ï}{{"I}}1 {Ö}{{"O}}1 {Ü}{{"U}}1
{â}{{^a}}1 {ê}{{^e}}1 {î}{{^i}}1
{ô}{{^o}}1 {û}{{^u}}1 {Â}{{^A}}1
{Ê}{{^E}}1 {Î}{{^I}}1 {Ô}{{^O}}1
{Û}{{^U}}1 {œ}{{oe}}1 {Œ}{{OE}}1
{æ}{{ae}}1 {Æ}{{AE}}1 {ű}{{H{u}}}1
{Ű}{{H{U}}}1 {ő}{{H{o}}}1 {Ő}{{H{O}}}1
{ç}{{c c}}1 {Ç}{{c C}}1 {ø}{{o}}1
{å}{{r a}}1 {Å}{{r A}}1 {£}{{pounds}}1
{«}{{guillemotleft}}1 {»}{{guillemotright}}1
{ñ}{{~n}}1 {Ñ}{{~N}}1 {¿}{{?`}}1
}
This is the line calling listing of the source code
lstinputlisting[language=Matlab]{estrutura/dados/algoritmos/plot_bf_compare_in_out.m}
Specifically, the section of Matlab code throwing the error is
title("Comparação entre áudio antes e depois do beamformer");
EDIT 2: Since the complete text I am working is spread across multriple files and folders, I recreated the minimum document with everything that seems relevant to this problem and throws the same error. OneDrive download link here with the files.
EDIT 3:
Compilable LaTeX code
documentclass[%twoside, % Impressão em frente e verso
oneside, % Impressão apenas frente
]{utfpr-abntex2}
usepackage{nicefrac}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage{nicefrac}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage{booktabs}
usepackage{color, colortbl}
usepackage{float}
usepackage{graphicx}
usepackage{icomma}
usepackage{indentfirst}
usepackage{microtype}
usepackage{multirow, array}
usepackage{subeqnarray}
usepackage{lastpage}
usepackage{pdfpages}
usepackage{verbatim}
usepackage{amsfonts, amssymb, amsmath}
usepackage[algoruled, portuguese]{algorithm2e}
usepackage{times}
usepackage[bottom]{footmisc}
usepackage{ae, aecompl}
usepackage{latexsym}
usepackage{lscape}
usepackage{picinpar}
usepackage{scalefnt}
usepackage{upgreek}
usepackage{listings}
% Parte utilizada para que códigos fonte possam conter caracteres em português
lstset{language=Matlab}
lstset{
inputencoding=utf8,
extendedchars=true,
literate=
{á}{{'a}}1 {é}{{'e}}1 {í}{{'i}}1
{ó}{{'o}}1 {ú}{{'u}}1 {Á}{{'A}}1
{É}{{'E}}1 {Í}{{'I}}1 {Ó}{{'O}}1
{Ú}{{'U}}1 {à}{{`a}}1 {è}{{`e}}1
{ì}{{`i}}1 {ò}{{`o}}1 {ù}{{`u}}1
{À}{{`A}}1 {È}{{'E}}1 {Ì}{{`I}}1
{Ò}{{`O}}1 {Ù}{{`U}}1 {ä}{{"a}}1
{ë}{{"e}}1 {ï}{{"i}}1 {ö}{{"o}}1
{ü}{{"u}}1 {Ä}{{"A}}1 {Ë}{{"E}}1
{Ï}{{"I}}1 {Ö}{{"O}}1 {Ü}{{"U}}1
{â}{{^a}}1 {ê}{{^e}}1 {î}{{^i}}1
{ô}{{^o}}1 {û}{{^u}}1 {Â}{{^A}}1
{Ê}{{^E}}1 {Î}{{^I}}1 {Ô}{{^O}}1
{Û}{{^U}}1 {œ}{{oe}}1 {Œ}{{OE}}1
{æ}{{ae}}1 {Æ}{{AE}}1 {ű}{{H{u}}}1
{Ű}{{H{U}}}1 {ő}{{H{o}}}1 {Ő}{{H{O}}}1
{ç}{{c c}}1 {Ç}{{c C}}1 {ø}{{o}}1
{å}{{r a}}1 {Å}{{r A}}1 {£}{{pounds}}1
{ñ}{{~n}}1 {Ñ}{{~N}}1 {¿}{{?`}}1
}
begin{document}
lstinputlisting[language=Matlab]{plot_bf_compare_in_out.m}
end{document}
Sample of problematic source code file (.m):
figure;
title("Comparação entre áudio antes e depois do beamformer");
listings input-encodings
New contributor
1
Welcome to TeX.se. It will be quite hard to help you without seeing some example code. Can you please edit your question to include a minimal compilable document that reproduces the problem you're having. (Also, the easiest way to deal with UTF-8 listings is to use LuaLaTeX or XeLaTeX instead of pdfLaTeX.)
– Alan Munn
Nov 24 at 3:28
As Alan said, is there any reason not to switch to XeLaTeX or LuaLaTeX?
– Joseph
Nov 24 at 17:02
XeLaTeX doesn't throw errors, but just ignores any letter it doesn't know. LuaLaTeX gives the same error.
– L. Farinha
Nov 24 at 19:02
1
Thanks for the edit, but this isn't compilable code. Can you put it into a document that begins withdocumentclass{...}
and ends withend{document}
. And we can't see your actuallstinputlisting
file, so please include some of it directly in the document or add a small sample file to the question too.
– Alan Munn
Nov 24 at 19:19
1
No, we don't need your exact files. You need to show us a small file in your question (not a link) that reproduces the problem.
– Alan Munn
Nov 24 at 20:53
|
show 7 more comments
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm using TeXstudio and pdfLaTeX. I'm trying to use the listings package to add some Matlab source code to my document. However, I'm having trouble with some portuguese letters used in the code (graphics captions, actually).
The common answer to this known encoding problem is shown here and here. However, even after adding the lstset{literate=}
with the correct list, the problem persists. I verified that the problematic letters and indeed in the list to be substituted, but no change.
The lstset
and the lstinputlisting[language=Matlab]{estrutura/dados/algoritmos/main.m}
I'm calling to add the code are in different files, but that was not a problem for any other package. I also verified that I can include code without any special characters.
What could be causing this problem and what would be a fix or an workaround?
Thanks for any help
EDIT for sample code:
This part is the one being used to substitute letters in the listings.
lstset{language=Matlab}
lstset{
inputencoding=utf8,
extendedchars=true,
literate=
{á}{{'a}}1 {é}{{'e}}1 {í}{{'i}}1
{ó}{{'o}}1 {ú}{{'u}}1 {Á}{{'A}}1
{É}{{'E}}1 {Í}{{'I}}1 {Ó}{{'O}}1
{Ú}{{'U}}1 {à}{{`a}}1 {è}{{`e}}1
{ì}{{`i}}1 {ò}{{`o}}1 {ù}{{`u}}1
{À}{{`A}}1 {È}{{'E}}1 {Ì}{{`I}}1
{Ò}{{`O}}1 {Ù}{{`U}}1 {ä}{{"a}}1
{ë}{{"e}}1 {ï}{{"i}}1 {ö}{{"o}}1
{ü}{{"u}}1 {Ä}{{"A}}1 {Ë}{{"E}}1
{Ï}{{"I}}1 {Ö}{{"O}}1 {Ü}{{"U}}1
{â}{{^a}}1 {ê}{{^e}}1 {î}{{^i}}1
{ô}{{^o}}1 {û}{{^u}}1 {Â}{{^A}}1
{Ê}{{^E}}1 {Î}{{^I}}1 {Ô}{{^O}}1
{Û}{{^U}}1 {œ}{{oe}}1 {Œ}{{OE}}1
{æ}{{ae}}1 {Æ}{{AE}}1 {ű}{{H{u}}}1
{Ű}{{H{U}}}1 {ő}{{H{o}}}1 {Ő}{{H{O}}}1
{ç}{{c c}}1 {Ç}{{c C}}1 {ø}{{o}}1
{å}{{r a}}1 {Å}{{r A}}1 {£}{{pounds}}1
{«}{{guillemotleft}}1 {»}{{guillemotright}}1
{ñ}{{~n}}1 {Ñ}{{~N}}1 {¿}{{?`}}1
}
This is the line calling listing of the source code
lstinputlisting[language=Matlab]{estrutura/dados/algoritmos/plot_bf_compare_in_out.m}
Specifically, the section of Matlab code throwing the error is
title("Comparação entre áudio antes e depois do beamformer");
EDIT 2: Since the complete text I am working is spread across multriple files and folders, I recreated the minimum document with everything that seems relevant to this problem and throws the same error. OneDrive download link here with the files.
EDIT 3:
Compilable LaTeX code
documentclass[%twoside, % Impressão em frente e verso
oneside, % Impressão apenas frente
]{utfpr-abntex2}
usepackage{nicefrac}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage{nicefrac}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage{booktabs}
usepackage{color, colortbl}
usepackage{float}
usepackage{graphicx}
usepackage{icomma}
usepackage{indentfirst}
usepackage{microtype}
usepackage{multirow, array}
usepackage{subeqnarray}
usepackage{lastpage}
usepackage{pdfpages}
usepackage{verbatim}
usepackage{amsfonts, amssymb, amsmath}
usepackage[algoruled, portuguese]{algorithm2e}
usepackage{times}
usepackage[bottom]{footmisc}
usepackage{ae, aecompl}
usepackage{latexsym}
usepackage{lscape}
usepackage{picinpar}
usepackage{scalefnt}
usepackage{upgreek}
usepackage{listings}
% Parte utilizada para que códigos fonte possam conter caracteres em português
lstset{language=Matlab}
lstset{
inputencoding=utf8,
extendedchars=true,
literate=
{á}{{'a}}1 {é}{{'e}}1 {í}{{'i}}1
{ó}{{'o}}1 {ú}{{'u}}1 {Á}{{'A}}1
{É}{{'E}}1 {Í}{{'I}}1 {Ó}{{'O}}1
{Ú}{{'U}}1 {à}{{`a}}1 {è}{{`e}}1
{ì}{{`i}}1 {ò}{{`o}}1 {ù}{{`u}}1
{À}{{`A}}1 {È}{{'E}}1 {Ì}{{`I}}1
{Ò}{{`O}}1 {Ù}{{`U}}1 {ä}{{"a}}1
{ë}{{"e}}1 {ï}{{"i}}1 {ö}{{"o}}1
{ü}{{"u}}1 {Ä}{{"A}}1 {Ë}{{"E}}1
{Ï}{{"I}}1 {Ö}{{"O}}1 {Ü}{{"U}}1
{â}{{^a}}1 {ê}{{^e}}1 {î}{{^i}}1
{ô}{{^o}}1 {û}{{^u}}1 {Â}{{^A}}1
{Ê}{{^E}}1 {Î}{{^I}}1 {Ô}{{^O}}1
{Û}{{^U}}1 {œ}{{oe}}1 {Œ}{{OE}}1
{æ}{{ae}}1 {Æ}{{AE}}1 {ű}{{H{u}}}1
{Ű}{{H{U}}}1 {ő}{{H{o}}}1 {Ő}{{H{O}}}1
{ç}{{c c}}1 {Ç}{{c C}}1 {ø}{{o}}1
{å}{{r a}}1 {Å}{{r A}}1 {£}{{pounds}}1
{ñ}{{~n}}1 {Ñ}{{~N}}1 {¿}{{?`}}1
}
begin{document}
lstinputlisting[language=Matlab]{plot_bf_compare_in_out.m}
end{document}
Sample of problematic source code file (.m):
figure;
title("Comparação entre áudio antes e depois do beamformer");
listings input-encodings
New contributor
I'm using TeXstudio and pdfLaTeX. I'm trying to use the listings package to add some Matlab source code to my document. However, I'm having trouble with some portuguese letters used in the code (graphics captions, actually).
The common answer to this known encoding problem is shown here and here. However, even after adding the lstset{literate=}
with the correct list, the problem persists. I verified that the problematic letters and indeed in the list to be substituted, but no change.
The lstset
and the lstinputlisting[language=Matlab]{estrutura/dados/algoritmos/main.m}
I'm calling to add the code are in different files, but that was not a problem for any other package. I also verified that I can include code without any special characters.
What could be causing this problem and what would be a fix or an workaround?
Thanks for any help
EDIT for sample code:
This part is the one being used to substitute letters in the listings.
lstset{language=Matlab}
lstset{
inputencoding=utf8,
extendedchars=true,
literate=
{á}{{'a}}1 {é}{{'e}}1 {í}{{'i}}1
{ó}{{'o}}1 {ú}{{'u}}1 {Á}{{'A}}1
{É}{{'E}}1 {Í}{{'I}}1 {Ó}{{'O}}1
{Ú}{{'U}}1 {à}{{`a}}1 {è}{{`e}}1
{ì}{{`i}}1 {ò}{{`o}}1 {ù}{{`u}}1
{À}{{`A}}1 {È}{{'E}}1 {Ì}{{`I}}1
{Ò}{{`O}}1 {Ù}{{`U}}1 {ä}{{"a}}1
{ë}{{"e}}1 {ï}{{"i}}1 {ö}{{"o}}1
{ü}{{"u}}1 {Ä}{{"A}}1 {Ë}{{"E}}1
{Ï}{{"I}}1 {Ö}{{"O}}1 {Ü}{{"U}}1
{â}{{^a}}1 {ê}{{^e}}1 {î}{{^i}}1
{ô}{{^o}}1 {û}{{^u}}1 {Â}{{^A}}1
{Ê}{{^E}}1 {Î}{{^I}}1 {Ô}{{^O}}1
{Û}{{^U}}1 {œ}{{oe}}1 {Œ}{{OE}}1
{æ}{{ae}}1 {Æ}{{AE}}1 {ű}{{H{u}}}1
{Ű}{{H{U}}}1 {ő}{{H{o}}}1 {Ő}{{H{O}}}1
{ç}{{c c}}1 {Ç}{{c C}}1 {ø}{{o}}1
{å}{{r a}}1 {Å}{{r A}}1 {£}{{pounds}}1
{«}{{guillemotleft}}1 {»}{{guillemotright}}1
{ñ}{{~n}}1 {Ñ}{{~N}}1 {¿}{{?`}}1
}
This is the line calling listing of the source code
lstinputlisting[language=Matlab]{estrutura/dados/algoritmos/plot_bf_compare_in_out.m}
Specifically, the section of Matlab code throwing the error is
title("Comparação entre áudio antes e depois do beamformer");
EDIT 2: Since the complete text I am working is spread across multriple files and folders, I recreated the minimum document with everything that seems relevant to this problem and throws the same error. OneDrive download link here with the files.
EDIT 3:
Compilable LaTeX code
documentclass[%twoside, % Impressão em frente e verso
oneside, % Impressão apenas frente
]{utfpr-abntex2}
usepackage{nicefrac}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage{nicefrac}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage{booktabs}
usepackage{color, colortbl}
usepackage{float}
usepackage{graphicx}
usepackage{icomma}
usepackage{indentfirst}
usepackage{microtype}
usepackage{multirow, array}
usepackage{subeqnarray}
usepackage{lastpage}
usepackage{pdfpages}
usepackage{verbatim}
usepackage{amsfonts, amssymb, amsmath}
usepackage[algoruled, portuguese]{algorithm2e}
usepackage{times}
usepackage[bottom]{footmisc}
usepackage{ae, aecompl}
usepackage{latexsym}
usepackage{lscape}
usepackage{picinpar}
usepackage{scalefnt}
usepackage{upgreek}
usepackage{listings}
% Parte utilizada para que códigos fonte possam conter caracteres em português
lstset{language=Matlab}
lstset{
inputencoding=utf8,
extendedchars=true,
literate=
{á}{{'a}}1 {é}{{'e}}1 {í}{{'i}}1
{ó}{{'o}}1 {ú}{{'u}}1 {Á}{{'A}}1
{É}{{'E}}1 {Í}{{'I}}1 {Ó}{{'O}}1
{Ú}{{'U}}1 {à}{{`a}}1 {è}{{`e}}1
{ì}{{`i}}1 {ò}{{`o}}1 {ù}{{`u}}1
{À}{{`A}}1 {È}{{'E}}1 {Ì}{{`I}}1
{Ò}{{`O}}1 {Ù}{{`U}}1 {ä}{{"a}}1
{ë}{{"e}}1 {ï}{{"i}}1 {ö}{{"o}}1
{ü}{{"u}}1 {Ä}{{"A}}1 {Ë}{{"E}}1
{Ï}{{"I}}1 {Ö}{{"O}}1 {Ü}{{"U}}1
{â}{{^a}}1 {ê}{{^e}}1 {î}{{^i}}1
{ô}{{^o}}1 {û}{{^u}}1 {Â}{{^A}}1
{Ê}{{^E}}1 {Î}{{^I}}1 {Ô}{{^O}}1
{Û}{{^U}}1 {œ}{{oe}}1 {Œ}{{OE}}1
{æ}{{ae}}1 {Æ}{{AE}}1 {ű}{{H{u}}}1
{Ű}{{H{U}}}1 {ő}{{H{o}}}1 {Ő}{{H{O}}}1
{ç}{{c c}}1 {Ç}{{c C}}1 {ø}{{o}}1
{å}{{r a}}1 {Å}{{r A}}1 {£}{{pounds}}1
{ñ}{{~n}}1 {Ñ}{{~N}}1 {¿}{{?`}}1
}
begin{document}
lstinputlisting[language=Matlab]{plot_bf_compare_in_out.m}
end{document}
Sample of problematic source code file (.m):
figure;
title("Comparação entre áudio antes e depois do beamformer");
listings input-encodings
listings input-encodings
New contributor
New contributor
edited Nov 24 at 21:38
New contributor
asked Nov 24 at 1:44
L. Farinha
13
13
New contributor
New contributor
1
Welcome to TeX.se. It will be quite hard to help you without seeing some example code. Can you please edit your question to include a minimal compilable document that reproduces the problem you're having. (Also, the easiest way to deal with UTF-8 listings is to use LuaLaTeX or XeLaTeX instead of pdfLaTeX.)
– Alan Munn
Nov 24 at 3:28
As Alan said, is there any reason not to switch to XeLaTeX or LuaLaTeX?
– Joseph
Nov 24 at 17:02
XeLaTeX doesn't throw errors, but just ignores any letter it doesn't know. LuaLaTeX gives the same error.
– L. Farinha
Nov 24 at 19:02
1
Thanks for the edit, but this isn't compilable code. Can you put it into a document that begins withdocumentclass{...}
and ends withend{document}
. And we can't see your actuallstinputlisting
file, so please include some of it directly in the document or add a small sample file to the question too.
– Alan Munn
Nov 24 at 19:19
1
No, we don't need your exact files. You need to show us a small file in your question (not a link) that reproduces the problem.
– Alan Munn
Nov 24 at 20:53
|
show 7 more comments
1
Welcome to TeX.se. It will be quite hard to help you without seeing some example code. Can you please edit your question to include a minimal compilable document that reproduces the problem you're having. (Also, the easiest way to deal with UTF-8 listings is to use LuaLaTeX or XeLaTeX instead of pdfLaTeX.)
– Alan Munn
Nov 24 at 3:28
As Alan said, is there any reason not to switch to XeLaTeX or LuaLaTeX?
– Joseph
Nov 24 at 17:02
XeLaTeX doesn't throw errors, but just ignores any letter it doesn't know. LuaLaTeX gives the same error.
– L. Farinha
Nov 24 at 19:02
1
Thanks for the edit, but this isn't compilable code. Can you put it into a document that begins withdocumentclass{...}
and ends withend{document}
. And we can't see your actuallstinputlisting
file, so please include some of it directly in the document or add a small sample file to the question too.
– Alan Munn
Nov 24 at 19:19
1
No, we don't need your exact files. You need to show us a small file in your question (not a link) that reproduces the problem.
– Alan Munn
Nov 24 at 20:53
1
1
Welcome to TeX.se. It will be quite hard to help you without seeing some example code. Can you please edit your question to include a minimal compilable document that reproduces the problem you're having. (Also, the easiest way to deal with UTF-8 listings is to use LuaLaTeX or XeLaTeX instead of pdfLaTeX.)
– Alan Munn
Nov 24 at 3:28
Welcome to TeX.se. It will be quite hard to help you without seeing some example code. Can you please edit your question to include a minimal compilable document that reproduces the problem you're having. (Also, the easiest way to deal with UTF-8 listings is to use LuaLaTeX or XeLaTeX instead of pdfLaTeX.)
– Alan Munn
Nov 24 at 3:28
As Alan said, is there any reason not to switch to XeLaTeX or LuaLaTeX?
– Joseph
Nov 24 at 17:02
As Alan said, is there any reason not to switch to XeLaTeX or LuaLaTeX?
– Joseph
Nov 24 at 17:02
XeLaTeX doesn't throw errors, but just ignores any letter it doesn't know. LuaLaTeX gives the same error.
– L. Farinha
Nov 24 at 19:02
XeLaTeX doesn't throw errors, but just ignores any letter it doesn't know. LuaLaTeX gives the same error.
– L. Farinha
Nov 24 at 19:02
1
1
Thanks for the edit, but this isn't compilable code. Can you put it into a document that begins with
documentclass{...}
and ends with end{document}
. And we can't see your actual lstinputlisting
file, so please include some of it directly in the document or add a small sample file to the question too.– Alan Munn
Nov 24 at 19:19
Thanks for the edit, but this isn't compilable code. Can you put it into a document that begins with
documentclass{...}
and ends with end{document}
. And we can't see your actual lstinputlisting
file, so please include some of it directly in the document or add a small sample file to the question too.– Alan Munn
Nov 24 at 19:19
1
1
No, we don't need your exact files. You need to show us a small file in your question (not a link) that reproduces the problem.
– Alan Munn
Nov 24 at 20:53
No, we don't need your exact files. You need to show us a small file in your question (not a link) that reproduces the problem.
– Alan Munn
Nov 24 at 20:53
|
show 7 more comments
1 Answer
1
active
oldest
votes
up vote
-1
down vote
accepted
I solved this problem by changing the input encoding from utf8 to latin1 only in the listings. In the end, I got this as the settings for the listings and it worked.
lstset{
language=Matlab,
inputencoding=latin1,
extendedchars=true,
literate=
{é}{{'{e}}}1
{è}{{`{e}}}1
{ê}{{^{e}}}1
{ë}{{¨{e}}}1
{É}{{'{E}}}1
{Ê}{{^{E}}}1
{û}{{^{u}}}1
{ù}{{`{u}}}1
{ú}{{'{u}}}1
{â}{{^{a}}}1
{à}{{`{a}}}1
{á}{{'{a}}}1
{ã}{{~{a}}}1
{Á}{{'{A}}}1
{Â}{{^{A}}}1
{Ã}{{~{A}}}1
{ç}{{c{c}}}1
{Ç}{{c{C}}}1
{õ}{{~{o}}}1
{ó}{{'{o}}}1
{ô}{{^{o}}}1
{Õ}{{~{O}}}1
{Ó}{{'{O}}}1
{Ô}{{^{O}}}1
{î}{{^{i}}}1
{Î}{{^{I}}}1
{í}{{'{i}}}1
{Í}{{~{Í}}}1
}
New contributor
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
-1
down vote
accepted
I solved this problem by changing the input encoding from utf8 to latin1 only in the listings. In the end, I got this as the settings for the listings and it worked.
lstset{
language=Matlab,
inputencoding=latin1,
extendedchars=true,
literate=
{é}{{'{e}}}1
{è}{{`{e}}}1
{ê}{{^{e}}}1
{ë}{{¨{e}}}1
{É}{{'{E}}}1
{Ê}{{^{E}}}1
{û}{{^{u}}}1
{ù}{{`{u}}}1
{ú}{{'{u}}}1
{â}{{^{a}}}1
{à}{{`{a}}}1
{á}{{'{a}}}1
{ã}{{~{a}}}1
{Á}{{'{A}}}1
{Â}{{^{A}}}1
{Ã}{{~{A}}}1
{ç}{{c{c}}}1
{Ç}{{c{C}}}1
{õ}{{~{o}}}1
{ó}{{'{o}}}1
{ô}{{^{o}}}1
{Õ}{{~{O}}}1
{Ó}{{'{O}}}1
{Ô}{{^{O}}}1
{î}{{^{i}}}1
{Î}{{^{I}}}1
{í}{{'{i}}}1
{Í}{{~{Í}}}1
}
New contributor
add a comment |
up vote
-1
down vote
accepted
I solved this problem by changing the input encoding from utf8 to latin1 only in the listings. In the end, I got this as the settings for the listings and it worked.
lstset{
language=Matlab,
inputencoding=latin1,
extendedchars=true,
literate=
{é}{{'{e}}}1
{è}{{`{e}}}1
{ê}{{^{e}}}1
{ë}{{¨{e}}}1
{É}{{'{E}}}1
{Ê}{{^{E}}}1
{û}{{^{u}}}1
{ù}{{`{u}}}1
{ú}{{'{u}}}1
{â}{{^{a}}}1
{à}{{`{a}}}1
{á}{{'{a}}}1
{ã}{{~{a}}}1
{Á}{{'{A}}}1
{Â}{{^{A}}}1
{Ã}{{~{A}}}1
{ç}{{c{c}}}1
{Ç}{{c{C}}}1
{õ}{{~{o}}}1
{ó}{{'{o}}}1
{ô}{{^{o}}}1
{Õ}{{~{O}}}1
{Ó}{{'{O}}}1
{Ô}{{^{O}}}1
{î}{{^{i}}}1
{Î}{{^{I}}}1
{í}{{'{i}}}1
{Í}{{~{Í}}}1
}
New contributor
add a comment |
up vote
-1
down vote
accepted
up vote
-1
down vote
accepted
I solved this problem by changing the input encoding from utf8 to latin1 only in the listings. In the end, I got this as the settings for the listings and it worked.
lstset{
language=Matlab,
inputencoding=latin1,
extendedchars=true,
literate=
{é}{{'{e}}}1
{è}{{`{e}}}1
{ê}{{^{e}}}1
{ë}{{¨{e}}}1
{É}{{'{E}}}1
{Ê}{{^{E}}}1
{û}{{^{u}}}1
{ù}{{`{u}}}1
{ú}{{'{u}}}1
{â}{{^{a}}}1
{à}{{`{a}}}1
{á}{{'{a}}}1
{ã}{{~{a}}}1
{Á}{{'{A}}}1
{Â}{{^{A}}}1
{Ã}{{~{A}}}1
{ç}{{c{c}}}1
{Ç}{{c{C}}}1
{õ}{{~{o}}}1
{ó}{{'{o}}}1
{ô}{{^{o}}}1
{Õ}{{~{O}}}1
{Ó}{{'{O}}}1
{Ô}{{^{O}}}1
{î}{{^{i}}}1
{Î}{{^{I}}}1
{í}{{'{i}}}1
{Í}{{~{Í}}}1
}
New contributor
I solved this problem by changing the input encoding from utf8 to latin1 only in the listings. In the end, I got this as the settings for the listings and it worked.
lstset{
language=Matlab,
inputencoding=latin1,
extendedchars=true,
literate=
{é}{{'{e}}}1
{è}{{`{e}}}1
{ê}{{^{e}}}1
{ë}{{¨{e}}}1
{É}{{'{E}}}1
{Ê}{{^{E}}}1
{û}{{^{u}}}1
{ù}{{`{u}}}1
{ú}{{'{u}}}1
{â}{{^{a}}}1
{à}{{`{a}}}1
{á}{{'{a}}}1
{ã}{{~{a}}}1
{Á}{{'{A}}}1
{Â}{{^{A}}}1
{Ã}{{~{A}}}1
{ç}{{c{c}}}1
{Ç}{{c{C}}}1
{õ}{{~{o}}}1
{ó}{{'{o}}}1
{ô}{{^{o}}}1
{Õ}{{~{O}}}1
{Ó}{{'{O}}}1
{Ô}{{^{O}}}1
{î}{{^{i}}}1
{Î}{{^{I}}}1
{í}{{'{i}}}1
{Í}{{~{Í}}}1
}
New contributor
New contributor
answered Nov 25 at 13:27
L. Farinha
13
13
New contributor
New contributor
add a comment |
add a comment |
L. Farinha is a new contributor. Be nice, and check out our Code of Conduct.
L. Farinha is a new contributor. Be nice, and check out our Code of Conduct.
L. Farinha is a new contributor. Be nice, and check out our Code of Conduct.
L. Farinha is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f461507%2fproblem-with-utf-8-in-listings-not-beingsolved-by-standard-answer%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Welcome to TeX.se. It will be quite hard to help you without seeing some example code. Can you please edit your question to include a minimal compilable document that reproduces the problem you're having. (Also, the easiest way to deal with UTF-8 listings is to use LuaLaTeX or XeLaTeX instead of pdfLaTeX.)
– Alan Munn
Nov 24 at 3:28
As Alan said, is there any reason not to switch to XeLaTeX or LuaLaTeX?
– Joseph
Nov 24 at 17:02
XeLaTeX doesn't throw errors, but just ignores any letter it doesn't know. LuaLaTeX gives the same error.
– L. Farinha
Nov 24 at 19:02
1
Thanks for the edit, but this isn't compilable code. Can you put it into a document that begins with
documentclass{...}
and ends withend{document}
. And we can't see your actuallstinputlisting
file, so please include some of it directly in the document or add a small sample file to the question too.– Alan Munn
Nov 24 at 19:19
1
No, we don't need your exact files. You need to show us a small file in your question (not a link) that reproduces the problem.
– Alan Munn
Nov 24 at 20:53