Skip to content

Commit

Permalink
Fix lozenge chars in code listings (fixes #4)
Browse files Browse the repository at this point in the history
  • Loading branch information
otherjoel committed Sep 20, 2020
1 parent 7208467 commit 94fb86a
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion template.pdf.p
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,10 @@

\usepackage{textcomp}
\usepackage{upquote}
\usepackage{listings}
\usepackage{listingsutf8}
\lstset{
inputencoding=utf8,
extendedchars=true,
basicstyle=\scriptsize\ttfamily,
columns=flexible,
breaklines=true,
Expand All @@ -88,6 +90,21 @@
% belowcaptionskip=0pt,
numberstyle=\scriptsize\color{mygray}\linenumberfont
}

% Add the lozenge to the list of extended characters in the `listings`
% environment. This is a limited workaround for a problem where Unicod
% characters appear out of order in code listings.
% See https://tex.stackexchange.com/q/81674
%
\begingroup
\catcode0=12 %
\makeatletter
\g@addto@macro\lst@DefEC{%
\lst@CCECUse\lst@ProcessLetter
""% *** add Unicode characters ***
^^00% end marker
}%
\endgroup

% see http://tex.stackexchange.com/questions/11263/how-can-i-remove-listing-from-listings-caption
% and http://tex.stackexchange.com/questions/209764/how-can-i-make-the-width-of-the-caption-match-that-of-the-listing
Expand Down

0 comments on commit 94fb86a

Please sign in to comment.