Okina

35 views
Skip to first unread message

Rob Beezer

unread,
Oct 29, 2022, 8:19:23 PM10/29/22
to pretext...@googlegroups.com
There was a request at Drop-In for a Hawaiian character, `okina. Which maybe is
spelled with an `okina? (Not a backtick!)

Unicode is U+02BB. Available in the "cm-unicode" fonts (Computer Modern Unicode).

Quick and dirty into the abstract of the sample article. Attached.

To prepare, see:

Section 39.2: Processing with xelatex
https://pretextbook.org/doc/guide/html/section-184.html#section-184

okina.png

Kamuela Yong

unread,
Oct 31, 2022, 8:29:47 AM10/31/22
to PreTeXt support
Thanks Rob. Here are the Unicode for all of the Hawaiian diacritical markers:

Ā    Ā    U+0100

ā    ā    U+0101

Ē    Ē    U+0112

ē    ē    U+0113

Ī    Ī    U+012A

ī    ī    U+012B

Ō    Ō    U+014C

ō    ō    U+014D

Ū    Ū    U+016A

ū    ū    U+016B

ʻ    ʻ    U+02BB

Rob Beezer

unread,
Oct 31, 2022, 5:08:21 PM10/31/22
to pretext...@googlegroups.com
Dear Kamuela,

Thanks for all the extra info.

Everything in the U+01xx block (Latin Extended-A) is well-supported, including
our default Latin Modern font (when using xelatex for LaTeX compilation). The
`okina will mean using a different font, since it is in U+02xx (Spacing Modifier
Letters). I'm going to suggest "Computer Modern Unicode" for now, which will
look much like "regular" TeX. You can find font coverage at:

https://mirror2.sandyriver.net/pub/ctan/fonts/cm-unicode/doc/cmunrm.pdf

Suggestions for now.

1. Use xelatex, that is a must.

2. If your keyboard produces the U+01xx characters easily and they render
nicely in your editor, just go ahead and enter them that way. We assume Unicode
text. (In other words, don't use the XML versions: &#....; )

3. Since `okina is (a) not always available in some fonts, and (b) may be
confused with a backtick in an editor (the case for me!). Perhaps the XML
equivalent is a good idea: ʻ May depend on how frequent it is, and if
you anticipate co-authors or contributors.

4. Use hexadecimal (not decimal) versions of these characters, all the
reference material is this way.

I'm going to do some general work to make font changes like this easier for
authors. Perhaps that will be ready by Friday and we can work on it then?
Until then, go ahead and author with `okinas and know that they will eventually
show up in your PDF. They should be apparent in HTML now.

Rob
> <https://pretextbook.org/doc/guide/html/section-184.html#section-184>
>
> --
> You received this message because you are subscribed to the Google Groups
> "PreTeXt support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to pretext-suppo...@googlegroups.com
> <mailto:pretext-suppo...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pretext-support/52c9779f-1942-4a07-b618-d58363e54678n%40googlegroups.com <https://groups.google.com/d/msgid/pretext-support/52c9779f-1942-4a07-b618-d58363e54678n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Thomas Shemanske

unread,
Nov 1, 2022, 12:27:22 PM11/1/22
to PreTeXt support
Hello all,

I thought I would add the following to this thread as I have not found
other places in the support list which answered my questions on
inserting unicode.

My goal was to do something very simple like include a locked padlock
symbol in a URL to indicate it was password restricted.  Now this
starts out very easily.

In the .ptx document, simply add the hex version of the unicode:
&#x1F512;

This renders correctly in the web version, and it renders correctly in
the print-latex version, but since the character is not in the default
font, it does not render in the print version.

As a workaround, I was going to put an inline image in the ptx file,
but pretext does not seem to want to do that right now.

Instead, I modified some advice I found on the web in
https://github.com/mreq/xelatex-emoji/blob/master/README.md

Extracting from that site, we first install a utility:
# For Mac OS X:
$ brew install librsvg

# For Linux:
$ sudo apt-get install librsvg2-bin

Then run the command
$ rsvg-convert -f pdf -o <emoji-UTF-code>.pdf <emoji-UTF-code>.svg

Now for this to work, you must start with the svg code for the unicode
character; say from
https://commons.wikimedia.org/wiki/File:Emoji_u1f512.svg

Once you have created a file called emoji-1f512.pdf, place it in the
assets folder at the top level of your project.

The author of the previous site points to
https://github.com/mreq/xelatex-emoji/blob/master/xelatexemoji.sty,
but for just a couple of characters, less is needed.  Based upon it, I
did the following:

In meta_docinfo.ptx, just before the </latex-image-preamble>, I added

\usepackage{newunicodechar}
\newcommand{\xelatexemoji}[1]{%
  \raisebox{-0.15em}{%
    \includegraphics[height=1em]{external/#1}%
  }%
}
\newunicodechar{🔒}{\xelatexemoji{emoji-1f512.pdf}}

Note that the "external" directory referenced is the one in
output/web/ which gets created with the first 'pretext build -g web'.

Now when you try 'pretext build print', it pulls in the pdf as an
inline graphic.

It's not particularly elegant, but I find fonts a bit challenging in TeX.

There probably is a fontspec solution as well, but I have not looked
into it.

Rob Beezer

unread,
Nov 1, 2022, 12:46:32 PM11/1/22
to pretext...@googlegroups.com
Dear Tom,

That is very impressive. But reminds me why fonts are "a bit challenging in
TeX." :-( And why it is sometimes lonely being the lead on the LaTeX
conversion. :-( :-(

As you began, inserting a Unicode character into your source, is the strategy I
would like to pursue. Just like the `okina, web works as well as the fonts in
your browser, and just the same for LaTeX - though where are those fonts we
need? Getting those fonts in place is the trick. Fortunately xelatex is way
more accomodating than pdflatex.

Found this for the first time - fonts supporting your padlock character.

https://www.fileformat.info/info/unicode/char/1f512/fontsupport.htm

The Noto series is very mainstream (a Google project, iirc) and I think we used
Source Code Pro for a while as our monospace (code) font.

I think it is time to use the publisher file to specify fonts for xelatex
compilation. First experiment will be a "main" font for Kamuela's Hawaiian
project. But while I'm at it, maybe a "secondary" font can be available for
things like padlocks without a wholesale change of everything else to another font.

Rob
> https://groups.google.com/d/msgid/pretext-support/52c9779f-1942-4a07-b618-d58363e54678n%40googlegroups.com <https://groups.google.com/d/msgid/pretext-support/52c9779f-1942-4a07-b618-d58363e54678n%40googlegroups.com> <https://groups.google.com/d/msgid/pretext-support/52c9779f-1942-4a07-b618-d58363e54678n%40googlegroups.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/pretext-support/52c9779f-1942-4a07-b618-d58363e54678n%40googlegroups.com?utm_medium=email&utm_source=footer>>.
>
> --
> You received this message because you are subscribed to the Google Groups
> "PreTeXt support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to pretext-suppo...@googlegroups.com
> <mailto:pretext-suppo...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pretext-support/9cbae258-3cea-4219-a979-09aa4d1282c6n%40googlegroups.com <https://groups.google.com/d/msgid/pretext-support/9cbae258-3cea-4219-a979-09aa4d1282c6n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Rob Beezer

unread,
Nov 1, 2022, 7:29:12 PM11/1/22
to pretext...@googlegroups.com
Straight from the labs. An `okina, a smiley face, and a padlock, all in the
same sentence. From fonts I had just laying around on the workbench (its a mess).

For LaTeX, the `okina is from Computer Modern Unicode (as is most everything
else), the smiley face is from DejaVu Sans, and the padlock is from Source Code
Pro. For HTML, it is whatever fonts my browser happens to have (?).

The three "characters" in question are placed into source simply as Unicode
characters. No markup, no font-switching, no nothing. All LaTeX preamble
(based on knowing the Unicode blocks these characters reside in.)

That accomplished, perhaps I'll take the rest of the day off. No, seriously,
some more experimentation and thought are needed before designing an interface
via the publication file to make this easier for authors.

Rob
latex-fonts.png
web-fonts.png

Thomas R. Shemanske

unread,
Nov 1, 2022, 7:41:21 PM11/1/22
to pretext...@googlegroups.com
Whoa dude!  A good day, though it will be a week or two before i can test.

Look at all that breathing that provides...

T

Thomas R. Shemanske
Sent from a mobile device

You received this message because you are subscribed to a topic in the Google Groups "PreTeXt support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pretext-support/u4yFiaIWrhs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pretext-suppo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pretext-support/75fcc29b-448c-8d25-085c-246b3039c4ff%40ups.edu.

Rob Beezer

unread,
Nov 11, 2022, 11:28:01 AM11/11/22
to pretext...@googlegroups.com
Dear Kamuela,

Now that we have the Computer Modern Unicode font installed on your machine,
I've got a LaTeX font experiment we can run. So if you are free, we can try
that at Drop-In (this *morning* for you).

Rob

On 10/31/22 05:29, Kamuela Yong wrote:
> <https://pretextbook.org/doc/guide/html/section-184.html#section-184>
>
> --
> You received this message because you are subscribed to the Google Groups
> "PreTeXt support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to pretext-suppo...@googlegroups.com
> <mailto:pretext-suppo...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pretext-support/52c9779f-1942-4a07-b618-d58363e54678n%40googlegroups.com <https://groups.google.com/d/msgid/pretext-support/52c9779f-1942-4a07-b618-d58363e54678n%40googlegroups.com?utm_medium=email&utm_source=footer>.
Reply all
Reply to author
Forward
0 new messages