derlin
9/24/2016 - 7:28 AM

Configure the latex lstlistings package for extended char support (as well as automatic wrapping and monofont)

Configure the latex lstlistings package for extended char support (as well as automatic wrapping and monofont)

%% Use this configuration of lstlistings to support extended characters (i.e. acctents) and automatic line wrapping.

\usepackage{listings}
\usepackage{listingsutf8}
\usepackage{inconsolata} % nicer font

\lstset{basicstyle=\footnotesize\ttfamily,breaklines=true} % set default font and line breaks

\lstset{%  support extended characters
	inputencoding=utf8,
	extendedchars=true,
	literate=%
	{é}{{\'{e}}}1
	{è}{{\`{e}}}1
	{ê}{{\^{e}}}1
	{ë}{{\¨{e}}}1
	{É}{{\'{E}}}1
	{Ê}{{\^{E}}}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
}