5

Im running into a problem with text and math font encoding.

First off, the goal at the end of the day is to have a .pdf and .tex which can be searched and copied. The document is compiled in XeTex, and written (the .tex) entirely with unicode characters. So ω instead of \omega.

The most significant issue I am running into is fonts. After some searching, I found that the Latin Modern Roman typeset doesnt actually have very many characters in it. I cannot find a more extensive version other than latinmodern-math.otf, which has its own problems. It is important to be able to type every character outside of a math environment.

After exploring with the unicode-math package (which uses latinmodern-math.otf) I found that it destroys the output .pdf because of the math font indexes it uses. For example, all italic characters have a unique hex value instead of the same as their upright character (the later being the standard). This makes searching the .pdf for all bold, italic, and Fraktur impossible.

Similarly, without the unicode-math package, (because typing ω in a math setting does nothing) using \omega creates a ! character, which also makes the document unsearchable. (I have yet to figure out why it doesn't show up as an ! in the .pdf).

Example, without the unicode-math package: $H_{2}(j Ω \Omega ω \omega)$ will produce H2(jΩ!). Both the Ω and ω were omitted from the end result.

Example, with the unicode-math package: $H_{2}(jΩω)$ will produce 𝐻􀏵(𝑗Ω𝜔)

What I am looking for, is to be able to type, for example:

Here is some text, Ω, ω, $H_{2}(jΩω)$

And have that output the characters:

Here is some text, Ω, ω, H2(jΩω)

Then of course format the math section like normal. (not shown)

Does anyone know how to solve this problem, and create both text and math that turn standard unicode input into standard unicode output? One that can be properly searched and copied?

1
  • 2
    As far as I know unicode-math does use the standard unicode slots for math alphabets (the U+1Dxxx block) You might try xits-math which I think is possibly more complete in its symbol coverage see unicode.org/charts/PDF/U1D400.pdf Sep 4, 2013 at 19:58

1 Answer 1

3

Here's my experiment:

\documentclass{article}
\usepackage{unicode-math}
\setmainfont{XITS}
\setmathfont{XITS Math}
\begin{document}
Here is some text, Ω, ω, $H_{2}(jΩω)$
\end{document}

Here's the output:

enter image description here

And here's what I get after copying from the PDF, pasting into http://rishida.net/tools/conversion/ and use the “Unicode U+hex notation”

Here is some text, U+03A9, U+03C9, U+1D43B2(U+1D457U+03A9 U+1D714)

So the math H (U+1D43B), the math j (U+1D457), Omega (U+03A9) and math omega (U+1D714) are correctly recognized.

If I use the math-style=ISO option to unicode-math, the uppercase Omega in math mode is printed as U+1D6FA.

If \omega or \Omega are used for the input, the result doesn't change.

7
  • Yeh that is what I got as well. Do you know how to configure it to produce text values instead of math values? I think that would solve the problem.
    – Bob
    Sep 4, 2013 at 20:25
  • 1
    @Bob you need to use classic tex font setup rather than unicode math in that case, classic tex uses multiple fonts for italic bold etc and so a bold a and an italic a are both a in different fonts, but the main design aim of unicode-math is to use a single unicode font for everything so by default all characters have to go to different slots in the same font so differently styled letters need different slots (which is why Unicode added them) Sep 4, 2013 at 20:31
  • @DavidCarlisle, I thought the purpose of the unicode system was to allow an extremely high amount of characters to be represented by the same system. If you take for example, Latin Modern, it has a font for italic, bold, upright. When I make a document it creates an output with all similar characters having the same hex value, despite which font I had selected. The problem I am having is that I want all characters to be managed with multiple fonts, but I want access to all the "advance" characters that you can find in the math font.
    – Bob
    Sep 4, 2013 at 20:40
  • 1
    @Bob yes for text where styling isn't considered to be part of the character but encodings in math were always completely arbitrary capital gamma is position 0 for example in classic cm fonts, that said xetex can of course use a classic math font setup and does so by default, you don't have to use unicode-math but by design that is aimed at the unicode math encoding. If you cut and paste the text you should see the characters in standard tools and web browsers so long as you have the fonts set up, I see 𝑨𝑩𝑪 as bold italic ABC in this firefox text box for example Sep 4, 2013 at 20:45
  • @DavidCarlisle, I have the same result when I am cutting and pasting. My issue is searching. When using adobe acrobat, and I search "H2(jΩω)" it will not find those characters if I used unicode-math, or if I dont. That is because the hex values used in the .pdf are different. If I used unicode-math they will be 𝐻􀏵(𝑗𝜔). and if I did not use it, and instead used \Omega and \omega to create the advanced characters, then I will get H2(jΩ!). Either way leaves the document unsearchable. What I need is a way to combine the two. Defaulting to text UC for all text and having access to UC symbols.
    – Bob
    Sep 4, 2013 at 21:27

You must log in to answer this question.

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