I would like to use LaTeX package minted
to colorize my c and Cuda code. I need to write comments in the code in czech. I use package inputenc
with utf-8
and czech characters (ěščřžýáíé)
work good in whole paper but minted
block:
LaTeX source:
\begin{minted}{c}
double m[4]; // staticky alokované pole
\end{minted}
Output pdf:
double m[4]; // staticky alokovan\unhbox \voidb@x \bgroup \let \unhbox \voidb@x \
EDIT:
I have tried XeTeX. minted works fine with XeTeX and czech characters. But assymptote doesn't work for me with XeTeX. asy command used on .asy file from XeTeX utilize 100% of my cpu but not generate any output in casual time.
EDIT:
Example for pdflatex:
\documentclass[a4paper, pt11]{article}
\usepackage[utf8]{inputenc}
\usepackage{fullpage}
\usepackage[english, czech]{babel}
% More symbols
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{latexsym}
\usepackage{graphicx}
\usepackage{asymptote}
\usepackage{minted}
\begin{document}
\begin{figure}[h]
\begin{asy}
import unicode;
size(15cm);
fill((0, 0)--(0.5, 0)--(0.5, 1)--(0, 1)--cycle, red);
fill((0.5, 0)--(6, 0)--(6, 1)--(0.5, 1)--cycle, blue);
fill((6, 0)--(32, 0)--(32, 1)--(6, 1)--cycle, green);
draw((0.25, 1.1)--(0.25, 1.9));
label("znaménko", (0.25,2), N);
label("exponent", (3.25,1), N);
label("mantisa", (18,1), N);
for(int i=0; i < 64; ++i) {
draw((0.5i, 0)--(0.5i + 0.5, 0)--(0.5i + 0.5, 1)--(0.5i, 1)--cycle);
}
label("$63$",(0.25,0),S);
label("$52$",(5.75,0),S);
label("$0$",(31.75,0),S);
\end{asy}
\caption{Uspořádání \emph{double} v paměti}
\label{doublemem}
\end{figure}
\begin{minted}{c}
double m[4]; // staticky alokované pole
m[0] = 1; // přímé nastavení první složky
double *n = (double *) malloc(pocet_cisel * 4 * sizeof (double)); // dynamická alokace
n[4 + 0] = 1; // přímý přístup do první složky druhého čísla
free(n); // vyčištění paměti
\end{minted}
\end{document}
Best Answer
Here's a patch for
fancyvrb
andminted
. This should letminted
handle whatever Unicode pdfTeX can handle. @KonradRudolph All of this comes down to making sure everything is processed by\detokenize
before it is saved to file.Edit 2013/07/30
Equivalent code is now incorporated into the
minted
development version on GitHub.