How can I use unicode in this condition?

Here’s a simplified MWE:

\usepackage{polyglossia} % Includes fontspec


% \setmainfont, \newfontfamily\devanagarifontsf, \setCJKfont, etc.
% Alternatively, you could use babel.

\newfontfamily\symbolfont{DejaVu Sans Mono}

\newunicodechar{^^^^25bc}{{\symbolfont\symbol{"25BC}}} % ▼


Black wedge font sample

This uses fontspec (which gets loaded by polyglossia) to set up a symbol font containing the glyph and newunicodechar to switch to that font for that symbol. (If you also wanted to use it in math mode, you would need a more complex command with \ifmmode, but you don’t appear to.)

One problem is, you seem to be pasting code in from a couple of examples that aren’t compatible with each other. For example, you would only use inputenc, \DeclareUnicodeCharacter and textcomp with legacy 7- and 8-bit fonts, not with modern Unicode fonts. I recommend you take out any packages from your preamble that you’re not sure you need.

Another is that \char or \symbol selects the glyph at the given position in the current font. That’s what you want when defining the command in your preamble, but not when using it in your document. You set the character active, so it gets replaced by a command, and want some code that the TeX engine treats as if you had typed the character itself. That’s ^^^^xxxx.

You’re also combining different packages for internationalization, which might or might not work for you. You might try babel with \babelfont to support all four of those languages with a consistent interface.

Multilingual Template

There are two possible answers to the follow-up question in the comments, depending on what you want.

If you’re making something like a symbol dictionary and only need stand-alone glyphs, you probably want the ucharclasses package. That lets you designate a font for your obscure Chinese characters, such as Babelstone Han, another for your astrological symbols, and so on. Then you type a glyph in and XeTeX displays each glyph from the right font automatically.

If you genuinely need to typeset entire words and passages in all four languages, the following preamble lets you do it in babel. It requires XeLaTeX. (The experimental HarfTeX might also work.) I also set up commands and environments named like polyglossia.

\documentclass{article} % Or whatever is appropriate.
% The next line is only to make the output narrower, to fit into an image
% on TeX.SX:  Remove geometry from your document and just give the paper
% size as an option to the document class.
\usepackage{babel} % You would need the bidi option if using RTL.
\usepackage{newunicodechar} % For \newunicodechar
\usepackage{fontspec} % For \defaultfontfeature

% This allows you to typeset passages in these langauges.  If you only need
% to display individual, stand-alone glyphs, `ucharclasses` is simpler and
% allows you to just type the leeters in as UTF-8.
\babelprovide[import, main, language=Default]{english}

% Set these to your fonts of choice:
          [Scale=1.0, Ligatures=Common]{Linux Libertine O}
          [Ligatures=Common]{Linux Biolinum O}
          [Ligatures={Common, Discretionary}]{Noto Serif CJK TC}
          {Noto Sans CJK TC}
          [Language=Default]{Noto Serif Devanagari}
          [Language=Default]{Noto Sans Devanagari}
          [Language=Default]{Noto Sans Tibetan}
          [Language=Default]{Noto Sans Tibetan}

\newfontfamily\symbolfont{Linux Libertine}

% You might or might not need to set up these symbols specifically.  They
% might just work.
\newunicodechar{^^^^2100}{{\symbolfont\symbol{"2100}}} % ℀
\newunicodechar{^^^^2103}{{\symbolfont\symbol{"2103}}} % ℃
\newunicodechar{^^^^25bc}{{\symbolfont\symbol{"25BC}}} % ▼


% Enables \begin{chinese}, etc., for full paragraphs in another language.




This document is in English, \textsanskrit{संस्कृतम्},
\textchinese{繁體字} and \texttibetan{བོད་སྐད་}, brought to you by the symbols
{^^^^2100}, {^^^^2103} and {^^^^25bc}.

Noto fonts sample

The sample used Google’s Noto fonts, which you might need to download.

You might not want to define symbols such as degrees Celsius this way: you probably want it to match the currently-selected font. However, if you do need to patch in a couple of glyphs that your main font doesn’t have, the examples show you how.

I set a few options on the fonts because of their quirks. For example, all the Language=Default options are there to suppress warning messages that the font doesn’t support that specific language. Things like Noto’s Tibetan fonts not supporting the Tibetan language tag and using DFLT instead are harmless and you could just ignore them. If you feel like bothering with stuff like Numbers=OldStyle, the otfinfo command is a good way to check what features a font supports.

Minimizing the MWE

You ask which of those packages you don’t need. You definitely don’t need inputenc or textcomp. Those packages are for legacy 8-bit fonts. You only need polyglossia or xeCJK if not using babel, but you might find xeCJK convenient if you only need one ideographic script. You don’t need to load fontspec in addition to polyglossia, which loads it automatically, and loading it twice runs the risk of an option clash. (If you really want to, load fontspec before, not after.) You probably don’t want ucs or xunicode.

The bbding and wasysym packages both load a symbol font, so you don’t need them if the symbols you use are in Unicode. For example, the comment suggests that wasysym is being loaded for the astrological sun symbol, which is ☉ (U+2609). You could still make the character an alias for the \astrosun symbol from wasysym, but I’d recommend you stick to Unicode if you can. You’ll get correct scaling and be able to copy from your PDF file.

The other packages look more important, but you could try removing one and seeing if anything breaks. If not, it’s probably not actually being used.

First off, avoid xunicode, ucs, inputenc and \DeclareUnicodeCharacter when you use XeLaTeX.

It's quite strange to map U+2100 ACCOUNT OF or U+25BC BLACK DOWN-POINTING TRIANGLE to \textcelsius.

The font Noto Serif CJK includes the glyphs for U+2100 and U+25BC, but these characters do not trigger switching to the CJK font, so such font should be chosen explicitly.

As others mentioned, newunicodechar can do the job:

\usepackage{polyglossia, fontspec}


%%%%%Sigla and Symbols

\usepackage{wasysym} %This line is related to \astrosun ⊙



\newunicodechar{℀}{{\various ℀}}
\newunicodechar{▼}{{\various ▼}}






enter image description here

By the way, it's not possible to set the CJK sans font without setting the main font; also, Noto Serif CJK is not a sans serif font.

Of course, you can use different fonts for the symbols missing from the main font you're using.