# How to get accented letters (ogonek) in a specific font?

I need to use a specific font (New Aster LT Standard), and I am running into issues with 2 characters in my text. One is the polish ogonek on the name "Dąbrówka", the other is an accented c in the name "Matanić". Oddly, the font seems to have the ogonek diacritic (see line 2 of the PDF image), but it does not show correctly when combined, only as a standalone. I have \usepackage[utf8]{inputenc} and \usepackage[T1]{fontenc} in my preamble. I must compile with XeLaTeX. My .tex document is in UTF8. I tried various ways (see example), but none is working (see screen capture).

Help?

\documentclass{article}
\usepackage{fontspec}
\usepackage{polyglossia}

\setmainfont{New Aster LT Std}

\setmainlanguage{french}
\setotherlanguage{polish}

\begin{document}

Johannes Dąbrówka.  A. Matanić.
\par

‬Johannes Da˛brówka.  A. Matani\'c.
\par

Johannes D\k{a}brówka.  A. Matani\'{c}.
\par

\end{document}


• don't use the packages fontenc, xunicode and inputenc with xelatex. May 6 at 16:07
• @UlrikeFischer thanks, I tried without fontenc, and only xunicode and inputenc, and it gives the same result. Or do you mean I should us neither of those three packages?? May 6 at 16:23
• do not use xunicode or inputenc (although fontenc was doing the most damage) May 6 at 16:37
• If you try it then without the setmainfont command you find two missing characters in latin modern the log will show Missing character: There is no ̨ (U+0328) in font [lmroman10-regular]:mapping=t Missing character: There is no ‬ (U+202C) in font [lmroman10-regular]:mapping=t I don't have your font so I can't say whether that has all the characters. May 6 at 16:41
• but U+202C is "pop directional formatting" did you intend that to be in the file? 0328 is a combining Ogonek (lines 1 and 3 look OK in latin modern as far as I can tell) May 6 at 16:43

You can try any of the following:

Load your modern font through fontspec and type in the character ą (U+0105). In XeLaTeX or LuaLaTeX, you can also write ^^^^0105.

A font might also support the combining accent ą (a + U+0328). You can also type this as a^^^^0328. Latin Modern Roman does not have this accent, but New Computer Modern does.

The LaTeX command is \k{a}. If this doesn’t work for your font but ^^^^0105 does, you can try loading uninormalize to convert to NFC form.

If your font contains the non-combining ogonek ˛ (U+02DB), you might be able to overlay it with the TeX primitive \accent"02DB a. With Latin Modern Roman, the ogonek below is positioned wrong, but accents above should be better.

\documentclass{article}
\tracinglostchars=2 % Warn if a font does not contain a character!
\usepackage{newcomputermodern}

\newcommand\aogonek{\accent a ^^^^02db}

\begin{document}
^^^^0105
a^^^^0328
\accent"02DB a
\k{a}
\end{document}


In PDFTeX, a-with-ogonek is in the T1 encoding. The precomposed character should work, as well as \k{a}, but combining accents generally don’t in PDFTeX.

All of the same methods should also work for, in the order you should try them, ć (U+0107), ć (c + U+0301), \'{c}, \accent"02CA c, or \accent"00B4 c.

• With TeX Live 2021 you can set \tracinglostchars=3 and you'll get an error for nonexisting characters. This is backwards compatible, in the sense that with previous versions you'll get a warning as before. May 6 at 22:02
• @egreg That’s a great feature! Thanks. May 7 at 4:14
• @egreg In this case, I think I’ll leave it as-is, because the test document is supposed to display whatever the font gives you. May 7 at 4:24
• Thanks, it worked! I had tried something similar but I probably did not have the right syntax May 7 at 16:00

Use font that has the letters you need, in example TexGyre. (with TexGyre)

But If you really need to use that font you can define new letters with newunicodechar4.

% !TeX program = xelatex
\documentclass[xetex,twoside]{article}
\tracinglostchars=3 % Warn if a font does not contain a character
\usepackage{fontspec}
%\setmainfont[Ligatures=TeX]{TeX Gyre Pagella}
\setmainfont[Ligatures=TeX]{New Aster LT Std}
\usepackage{polyglossia}

\setmainlanguage{french}
\setotherlanguage{polish}

\usepackage{newunicodechar}
\makeatletter
\newunicodechar{ć}{\add@accent{^^^^00b4}{c}}
\newunicodechar{á}{\add@accent{^^^^00b4}{a}}
\makeatother

\begin{document}

Johannes Dąbrówka.  A. Matanić.\par

\end{document}


(with (Old) New Aster LT Std) (with newunicodechar)

• Unfortunately, the position of the ogonek is incorrect; it should be very close to the right edge. (See the example with the TeX Gyre font.) May 7 at 22:37
• Easies way to solve this is use font with right signs in it, or try if ^^^^0328 works any better.
– Oni
May 14 at 1:10