21 votes
Accepted

How do I make LaTeX understand Unicode characters ↔︎ and ↕︎

Actually, LaTeX has a pretty good Unicode support (better yet since the October 2019 update). You just need to define the character you want to type: \documentclass{article} \DeclareUnicodeCharacter{...
Phelype Oleinik's user avatar
19 votes

How do I make LaTeX understand Unicode characters ↔︎ and ↕︎

I would recommend the newunicodechar package for this: \usepackage{newunicodechar} \newunicodechar{↔}{\ensuremath{\leftrightarrow}} \newunicodechar{↕︎}{\ensuremath{\updownarrow}} You could also ...
Davislor's user avatar
  • 44.1k
8 votes
Accepted

lost my smilies: it is worth the effort to make Unicode work?

The first error message for the first document that you posted is, as you show, ! Package inputenc Error: Unicode character ☹ (U+2639) (inputenc) not set up for use with LaTeX. See the ...
David Carlisle's user avatar
8 votes
Accepted

\usepackage{newunicodechar} loads but commands have no effect

The error message is ! Package inputenc Error: Unicode char   (U+202F) (inputenc) not set up for use with LaTeX. and U+202F NARROW NO-BREAK SPACE is nowhere defined. If I add a ...
egreg's user avatar
  • 1.1m
8 votes

Defining a fallback font for all missing characters

A solution for Xelatex and Lualatex, using expl3. The method defines "default" fonts: it stores codepoint block information as a set of records in an expl3 sequence-variable, aggregates ...
Cicada's user avatar
  • 10.1k
7 votes
Accepted

How to print Unicode characters in LaTeX by its code? (For example \U0001316E)

The font 'Noto Sans Egyptian Hieroglyphs - Regular' has placed its 1,071 glyphs in slots 77824 thru 78894 or, equivalently, slots U13000 thru U1342E. (To typeset all glyphs in a table, one needs 66 ...
Mico's user avatar
  • 508k
6 votes
Accepted

Add unicode character to document

\documentclass{article} \usepackage{newunicodechar} \newunicodechar{「}{\ensuremath\lceil} \newunicodechar{」}{\ensuremath\rfloor} \title{Unicode char test} \author{Skip} \date{} \usepackage{fontspec}...
David Carlisle's user avatar
6 votes

U+21B3 UTF8 character failure with \newunicodechar

You also get Package newunicodechar Warning: This package only works if the document (newunicodechar) encoding is `utf8'. Remove \usepackage[utf8x]{inputenc} and \usepackage{ucs}. ...
egreg's user avatar
  • 1.1m
6 votes
Accepted

Caron Accent \v{a} doesn't render without \usepackage{xeCJK}

The default setup doesn't use unicode U+02C7, but the combining accent U+030C which is missing in your font. xecjk contains some code to use U+02C7 instead, but seems to use this code only if ...
Ulrike Fischer's user avatar
5 votes

How to print Unicode characters in LaTeX by its code? (For example \U0001316E)

Just use the character, specifying a font that contains it, and compile with xelatex or lualatex: \documentclass{article} \usepackage{fontspec} \newfontfamily{\hifont}{NotoSansEgyptianHieroglyphs-...
ShreevatsaR's user avatar
  • 45.4k
5 votes
Accepted

Country flags unicode char

You can emulate what basically utf8 does: \documentclass{article} \usepackage{newunicodechar} \usepackage{xparse} \ExplSyntaxOn \newunicodechar{🇩}{\flags_D:n} \newunicodechar{🇺}{\flags_U:n} \...
egreg's user avatar
  • 1.1m
5 votes

Replace brackets by Chinese brackets

\newunicodechar refuses to modify characters in the range 0–127, because they're used in TeX's syntax. If you're brave, you can do the same by yourself: \catcode`(=\active \catcode`)=\active \...
egreg's user avatar
  • 1.1m
4 votes
Accepted

Generating underaccents for Romanized Tamil

Minion Pro has a very short supply of accents and combining characters. Here's a workaround for the macron below. \documentclass{article} \usepackage{fontspec} \usepackage{newunicodechar} \...
egreg's user avatar
  • 1.1m
3 votes

Caron Accent \v{a} doesn't render without \usepackage{xeCJK}

Based on a trick by Egreg, this uses the \accent primitive. I chose to simply redefine \v. \documentclass{standalone} \usepackage{fontspec, newunicodechar} \usepackage[british]{babel} \setmainfont[...
Davislor's user avatar
  • 44.1k
3 votes
Accepted

Type ⟨ and ⟩ inside a \lstinline command

There are two different brackets in unicode and the typewriter font has only glyphs for one pair (U+2329, U+232A) (yes there are different even if they look quite similar depending on the font). You ...
Ulrike Fischer's user avatar
3 votes
Accepted

Combining \newunicodechar with delimiter sizes \big, \left, \right, etc

Using \ensuremath makes no sense. You can make it work with pdflatex, but you have to use braces with \big or similar commands. Not with \left and \right. \documentclass{article} \usepackage{amsmath} \...
egreg's user avatar
  • 1.1m
3 votes

Redefine a symbol with \newunicodechar and pdflatex

You can't redefine a Unicode character in terms of itself, but you can always use its LICR; for § it is S. \documentclass{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[...
egreg's user avatar
  • 1.1m
3 votes
Accepted

Unicode character error (inputenc package)

U+00B3 is superscript 3 so if you want to keep that you can define \DeclareUnicodeCharacter{00B3}{\textsuperscript{3}}
David Carlisle's user avatar
3 votes
Accepted

{newunicodechar} + \chapter{} produces two font-related warnings

With \newfontface you don't define a command that changes fonts respecting the current conditions. You may want that the \titik symbol doesn't respect a bold face condition, but the main problem is ...
egreg's user avatar
  • 1.1m
2 votes

Unicode character error (inputenc package)

If you are free to switch to either LuaLaTeX or XeLaTeX, you needn't worry anymore about utf8-encoded characters; just load the fontspec package and load a suitable text font via a \setmainfont ...
Mico's user avatar
  • 508k
2 votes
Accepted

Package newunicodechar Error: ASCII character requested

The file as posted in the question is in UTF-8, matching the encoding declared to LaTeX. If you save it as 8bit Greek (ISO-2022 for example) then you get ! Package newunicodechar Error: ASCII ...
David Carlisle's user avatar
2 votes
Accepted

Fallback for mathcal unicode characters in lualatex with proper height

I'm not seeing any OpenType font with the Computer Modern calligraphic letters. With Latin Modern Math you get a similar glyph. Anyway, I'm afraid you need to compute the scale factor yourself. \...
egreg's user avatar
  • 1.1m
2 votes
Accepted

\newunicodechar fails for PRIME only

Judging from the error message you're using unicode-math. The problem is that this package assigns a value to the “active ′” at begin document, thus overriding what your \newunicodechar does. ...
egreg's user avatar
  • 1.1m
2 votes

Use \DeclareUnicodeCharacter with combined Unicode characters

It is hard, bordering impossible, to support unicode combining characters with pdftex. This is not much of a problem in practice as (if using luatex is not an option) you can usually pre-process to ...
David Carlisle's user avatar
2 votes

Increase size of superscript letter diacritics

This substitutes dotless i for the base, and small ascii for the diacritic,and wraps the construct with ActualText with the original so it should cut and paste as Unicode diacritics \documentclass[...
David Carlisle's user avatar
2 votes
Accepted

Define "Macron below" / combining low line (U+0332) as a unicode character to underline text

U+035F isn't widely supported, U+0332 is better supported, including by the default latin modern, although the result is not that pretty. Note you want support for combining characters in the font ...
David Carlisle's user avatar
1 vote

Automatically combine unicode double subscripts aᵢⱼ = a_{i}_{j} as a_{ij}

Below is a method that answers your original question: to combine the scripts together. Take superscript as an example, we have \@unisupA, which inserts \sp\bgroup at the beginning; \@unisupB, which ...
Jinwen's user avatar
  • 8,538
1 vote

Combining \newunicodechar with delimiter sizes \big, \left, \right, etc

For "academical" purpose, this is a macro that automatically braces the next Unicode character. It does requires patching \big however. Unavoidably. How TeX input stream works is a bit ...
user202729's user avatar
  • 7,183
1 vote

How to forbid a certain character from starting a line of output text? Specifically concerning Tibetan text

You can set things up so that the shad removes a blank space preceding it and substitutes it with a nonbreaking space. This won't work if you want to color it; in that case, remember to have ~ in ...
egreg's user avatar
  • 1.1m

Only top scored, non community-wiki answers of a minimum length are eligible