6

This MWE works correctly with pdflatex but fails to produce an o-cedilla (o̧) with xelatex even if you uncomment the fontspec.

\documentclass{article}
%\usepackage{fontspec}
\begin{document}
Here is a c-cedilla: \c{c} and an o-cedilla: \c{o}
\end{document}

I'm missing something, but what?

Peter Flynn
  • 2,870

3 Answers3

5

This is a problem with the font, compounded by a bad design decision forty years ago.

By default, when the document tries to use a character that the current font does not have, TeX replaces it with a blank space. You’re supposed to carefully proofread every line and catch this.

If you add the command \tracinglostchars=3, this will become an error, and the TeX engine will crash with the message:

! Missing character: There is no ̧ (U+0327) in font [lmroman10-regular]:mapping =tex-text;.

I suggest you add \tracinglostchars=3 to all your documents. (I see that the default behavior is now to at least print a warning message to the console instead of failing silently, which used to require a different command.)

That tells us what the problem is: the default font that fontspec loads doesn’t have a combining cedilla accent. To fix this, load a font that does, such as New Computer Modern. The fontsetup package is the easiest way:

\documentclass{article}
\tracinglostchars=3
\usepackage[default]{fontsetup}

\begin{document} Here is a c-cedilla: \c{c} and an o-cedilla: \c{o} \end{document}

New Computer Modern sample

There is no precomposed o̧ in Unicode, although there is a ǫ (U+01EB), and Latin Modern has it. There is a good chance that you really want an ogonek, not a cedilla.

\documentclass{article}
\usepackage{fontspec}

\DeclareRobustCommand\oogonek{\symbol{"01EB}}

\begin{document} Here is a c-cedilla: \c{c} and an o-ogonek: \oogonek \end{document}

This was meant more as an example, but: David Carlisle points out that \k{o} works for ǫ. So would entering the precomposed UTF-8 character into your source file directly.

Davislor
  • 44,045
2

You coud make a cedilla, but \textcommabelow is available out of the box, and may (or may not) be suitable

\documentclass{article}
%\usepackage{fontspec}
\DeclareTextCompositeCommand{\c}{TU}{o}{\textcommabelow{o}}
\begin{document}
Here is a c-cedilla: \c{c} and an o-cedilla: \c{o}
\end{document}

enter image description here

David Carlisle
  • 757,742
1

Undeclare the text composite and redeclare it; however it's likely that you want “o with ogonek” rather than with a cedilla.

The problem is that Latin Modern has no “combining cedilla” character U+0327.

\documentclass{article}
\usepackage{fontspec}

% https://tex.stackexchange.com/a/58115/4427 \providecommand*\UndeclareTextComposite[3]{% \expandafter\let\csname\expandafter\string\csname #2\endcsname\string#1-#3\endcsname\relax}

\UndeclareTextComposite{\c}{TU}{o} \DeclareTextCompositeCommand{\c}{TU}{o}{\accent"B8 o}

\begin{document}

Here is a c-cedilla: \c{c} and an o-cedilla: \c{o}

Probably you want \k{o} (o with ogonek)

\end{document}

enter image description here

egreg
  • 1,121,712
  • There are some languages with an o-cedilla, though. – Davislor Aug 19 '23 at 21:52
  • There definitely are. For example, Marshallese modern orthography uses o̧ to denote an open back rounded vowel. In fact, Adobe-Latin-5 character set requires supporting the combination of o with cedilla. – Alexander Z. Aug 20 '23 at 06:51
  • This was why I wanted an o-cedilla (Marshallese) as an example to a user. Embarrassing when pdflatex does it and xelatex doesn't, when you're trying to extol the Unicode capabilities of the latter over the former :-) – Peter Flynn Aug 25 '23 at 14:05
  • @PeterFlynn Complain with the developers of Latin Modern or use a different font. – egreg Aug 25 '23 at 14:20