I am new to using LaTeX, I haven't used it so far due to font issues - I adopted Unicode when it first came out and I have never like Knuth's original fonts (great work that he did, his font perceptions and mine are not always the same). My problem is that I have a font with around 2,000 characters in the private use area and in the ASCII region. XeLaTeX and LuaLaTeX gives me hope that I can finally use LaTeX now.

I do not want to replace the main fonts, I simply want to use characters out of my private font, embedding them in my document, preferably a .pdf. I can do this in Word and in HTML. When doing so, I may use mathematical expressions containing those symbols, but they would just be treated as a block. Using the default fonts for normal mathematical expressions (or Cambria Math) is fine. So, how do I use a private unicode font in that manner? Currently it is .ttf, but I could probably build the font as .ps, although all of the font outlines are ttf.

Just embedding the unicode value won't work because that doesn't include the fontname or font file (the font is not normally installed in the OS, I use the font file directly). That would just take the symbol from the current font which is not what I want to do. I also don't want to break the font into 10 or more separate fonts. There are no variants of the font, it contains mathematical letters of various natures, but the classification does not match the expected classification. Those classifications are sans-serif, sans-serif bold, sans-serif bold slanted, slab-serif, slab-serif slanted, serif, serif italic, serif bold italic, script, hollow, Greek. All of these contain the lower and upper case letters and digits (except for Greek which doesn't have digits). They are all compatible in terms of design and with respect to the non-letter symbols. There is some symbol overlap with defined Unicode positions, but most symbols are not available in Unicode.

  • 5
    with lualatex or xelatex (and the fontspec package) you can use your truetype font directly (neither care or know which points are private use area, if your input uses those slots the relevant characters will be used) Feb 28, 2018 at 22:18
  • How would that be done without replacing the main font. I don't want to do "\setmainfont". Ideally I would define a \xxxx symbol for each special character (tedious, but one time only). Feb 28, 2018 at 22:21
  • 1
    Use e.g. \newfontface, see the fontspec documentation. Feb 28, 2018 at 22:46
  • 3
    or newfontfamily as in tex.stackexchange.com/questions/199109/… Feb 28, 2018 at 22:48
  • Note that for correct spacing, you probably need to declare your symbols as the correct type of mathematical atom e.g. an operator, a binary relation .... Also, you can probably script creation of the macros if you've some means of exporting a meaningful list of character names from FontForge or whatever.
    – cfr
    Feb 28, 2018 at 23:22

1 Answer 1


This appears to work.

\newfontfamily \myFont {myFont.ttf}

\newcommand \mf[1] {{\text{\myFont{\char"#1}}}}
\newcommand \mfOp  {\mf{E8A8}}
\newcommand \mfp   {\mf{F470}}
\newcommand \mfq   {\mf{F471}}


These are three symbols in myFont's Private Use Area, where
two are letters and one is an operator: {\mfp\mfOp\mfq} used
in normal text.

It also now works in math mode: $ \sqrt{\mfp\mfOp\mfq} $

  • 1
    you probably want extra braces in \mfp and \mfq or your whole document will be in that font if the commands are used at the top level, Also it's simpler (and expandable, and more efficient) to use the character token directly so use ^^^^f471 rather than \symbol{"F471} for math it depends, the simplest thing to do is define (say) \mfp by \newcommand\mfp{\text{\myFont ^^^^f470}} then it will work in text and math (via the amsmath \text command) Mar 1, 2018 at 7:37
  • Thanks. The text command worked. I could not get the ^^^^f471 to work (I tried both lower and upper case for the hex). The previous braces solved that problem, but I added a couple of more anyway. I did find that if I do not include braces where the symbols are used that the following space(s) are eaten unless I add an explicit space character (using the backslash). Mar 2, 2018 at 0:34
  • ^^^^ with four lowercase hex digits has to work unless you have redefined ^ it is primitive luatex syntax so works even if none of latex is defined. the spaces going after a command name is a feature if tex and isn't affected by anything you put inside the definition. Mar 2, 2018 at 8:41
  • I am not using luatex, I am using xelatex. My test cases are very small and I am not redefining anything that is not in my answer above. As far as I can tell, I can't really define new math operators tied to a specific font and code point, so I have probably reached the limit of what I can (easily) do. Especially as a newbie. So far as I can tell, it is sufficient for my needs at this time. My font categories are more extensive that the math mode supports as well (where is slab-serif?). I use 10 different categories, not including Greek. Mar 2, 2018 at 9:35
  • 1
    The above solution doesn't always work when copy-pasted, since the fancyvrb package (which the minted package uses) has defined \myFont macro. Using another name for the macro will solve this problem. Somehow, the error didn't show up when compiled continuously and costed me hours to debug this.
    – Cow Frog
    Apr 5 at 16:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .