6

I am having problems with the "č" character in the word "Koláč" when typesetting cooking recipes. I am using XeTeX right now. Here is my MWE:

\documentclass[]{article}
\usepackage[T1]{fontenc}
\usepackage{a4wide}
\usepackage[czech]{babel}
\usepackage{ifxetex,ifluatex}
\usepackage{xcookybooky}

\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
  \usepackage[utf8]{inputenc}
\else % if luatex or xelatex
  \usepackage{fontspec}
  \ifxetex
    \usepackage{xltxtra,xunicode}
  \fi
  \defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
\fi

\title{Recepty}
\author{Václav Zeman a Ludmila Zemanová}
\date{\today}

\setHeadlines{
  inghead = Ingredience,
  prephead = Příprava,
  hinthead = Tip,
  calory = energetický obsah,
  continuationhead = Pokračování,
  continuationfoot = Pokračování na další stránce
}

\begin{document}
\begin{recipe}[
  ]{Koláč bramborový}
  \ingredients{
    \unit[30]{dkg} & vařených brambor \\
  }
\end{recipe}
\end{document}

The "č" character does not get output, while many other Czech national characters do. What can I do about it?

3
  • What input encoding are you currently using? XeTeX and LuaTeX can handle UTF-8 only.
    – Mico
    Jun 3, 2013 at 20:55
  • @Mico: I am using UTF-8 for the document.
    – wilx
    Jun 3, 2013 at 21:11
  • In my case it was enough to use xltxtra package. But the font's are a bit different, I like more the ones which are without xltxtra :-(.
    – pevik
    Nov 17, 2015 at 10:59

1 Answer 1

6

The xcookybooky package makes wrong assumptions about fonts. But you're doing wrong too:

  1. Don't use fontenc with XeLaTeX or LuaLaTeX (it can be used, but not in general cases)

  2. Don't use the obsolete a4wide package. Use geometry if you want to modify the page parameters.

  3. Don't load xltxtra and xunicode.

The fix is simple: use the default font and encoding for the recipe title:

\documentclass[a4paper]{article}
\usepackage{ifxetex,ifluatex}
\usepackage{xcookybooky}

\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
  \usepackage[T1]{fontenc}
  \usepackage[utf8]{inputenc}
  \usepackage[czech]{babel}
\else % if luatex or xelatex
  \usepackage{fontspec}
  \defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}
  \ifluatex
    \usepackage[czech]{babel}
  \fi
  \ifxetex
    \usepackage{polyglossia}
    \setmainlanguage{czech}
  \fi
\fi

%%% Fix the setting by xcookybooky
\AtBeginDocument{
  \setRecipenameFont{\familydefault}{\encodingdefault}{b}{n}
}

\title{Recepty}
\author{Václav Zeman a Ludmila Zemanová}
\date{\today}

\setHeadlines{
  inghead = Ingredience,
  prephead = Příprava,
  hinthead = Tip,
  calory = energetický obsah,
  continuationhead = Pokračování,
  continuationfoot = Pokračování na další stránce
}

\begin{document}
\begin{recipe}[
  ]{Koláč bramborový}
  \ingredients{
    \unit[30]{dkg} & vařených brambor \\
  }
\end{recipe}
\end{document}

I've used polyglossia for XeLaTeX, but babel would work too.

“Potato cake”? Should be good. ;-)

enter image description here

2
  • BTW, in TeXLive 2013 one should be able to use Polyglossia with LuaTeX too, though I didn’t test it myself. Jun 3, 2013 at 22:32
  • @KhaledHosny I know Élie Roux is doing work on it; I didn't test it myself. I will try.
    – egreg
    Jun 3, 2013 at 22:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.