0

If a Chinese character does not exist in the font, the resulting pdf document will not display the Chinese character correctly and will be replaced with a large box. Just like this box down here: enter image description here

The Chinese characters in these boxes in the figure are rare characters, which are not included in regular fonts. Therefore, the generated pdf document cannot display the Chinese character. Instead, it is replaced by a box.

Now, I want to output these boxes manually in latex. How should I do that?

I tried some of the commands, like \textsquare or $\Box$ or $\square$ or $\Square$ or $\APLbox$ and so on.

yes,Each of these commands has some kind of box, but there are not the box I want.

enter image description here

The boxes typed by these commands do not exactly occupy the size of a Chinese character, and their lines are thicker, so the boxes typed by these commands are not the same as the previous "rare Chinese character replacement boxes". What I want is the first one.

My guess is that the first "rare chinese word replacement box" is probably a unicode code. I found some similar ones, such as:□_(WHITE SQUARE, U+25A1)、▯(WHITE VERTICAL RECTANGLE, U+25AF)、◻_(WHITE MEDIUM SQUARE, U+25FB)、☐_(BALLOT BOX, U+2610)……

I'm not sure if these boxes have the one I want, because I can't generate these unicode symbols in latex, whether I use the \char{"unicode} command or \symbol{"unicode} command.

Anyway, now I need the box for the "Rare Chinese Character Replacement box", which is the box in the first picture.

Because the box occupies the size of a Chinese character, it is perfect. Some classical Chinese books, there will be missing text, using this box to occupy the missing text, it is perfect. So, how do I implement manual output of this box? thank you!

Based on your suggestions, I have generated pdf documents of the boxes I need and shared them in the cloud. You can help me to have a look. Thanks again for your attention.

link:https://pan.baidu.com/s/1RwovC-y9lgoZrLS2uv20VA?pwd=i719

5
  • Can you generate a PDF that has the box you want using e.g. Microsoft Word or something similar? If you can, maybe you can post such a PDF so we can inspect it and see what was used? (e.g. How do I find out what fonts are used in a document/picture? - TeX - LaTeX Stack Exchange)
    – user202729
    Feb 13, 2023 at 15:35
  • Thank you very much for your attention to my problem. I have generated a pdf document with the boxes I need. Link below:pan.baidu.com/s/1RwovC-y9lgoZrLS2uv20VA?pwd=i719 you can download down the inspection, thanks again. Feb 16, 2023 at 12:14
  • I can't download it because I don't have a pan.baidu account...?
    – user202729
    Feb 16, 2023 at 12:42
  • 1
    oh,Thank you very much! I think I have found the solution. I learned a lot from this communication. I'll post my solution later, and yes, I'm sure I've solved the problem once and for all under your guidance. Thanks again. I'll post my solution later. Feb 16, 2023 at 13:19
  • @user202729 thank you. I've posted my solution.You can view in the following text. Feb 16, 2023 at 14:26

1 Answer 1

2

Thanks to this friend (user202729), I think I have solved the problem once and for all. And in the process of solving this problem, I have gained a deeper understanding of latex fonts. Thank you. Here is my solution:

1.First of all, I am pretty sure that this Box placeholder is not generated by mathematical formulas like $\Box$ or $\square$, because the box generated by these formulas is obviously different from the placeholder I want -- both in size and line thickness.

2.Then, the friend(user202729) prompted me to generate a pdf document, and from the pdf document, find the code for the box. I was more certain that the box should be generated by a unicode encoding. So I opened the windows "Character map table", in the software, select the font that can generate such a box, such as 楷体(KaiTi), 仿宋(FangSong). Further, I began to compare the box symbols under the font one by one. Sure enough, I found it! From the looks of it, this should be it. Its unicode encoding is U+25A1; Its name is Hollow Square:

enter image description here enter image description here

3.To confirm that the box is the one I'm looking for, I print it in unicode using the latex command \symbol{"25A1}. However, there is a slight problem, it does not appear in the text, I find the reason: I am using XeLaTeX + xeCJK to output Chinese, so U+25A1 is a special character, it is not considered CJK character by default, so it is still covered by the Western font, and usually Western fonts do not contain this character. So, in order to successfully print this character with unicode encoding, you need to declare the character as a CJK character and have it printed in a Chinese font. Add this line of code to the introduction area:

\xeCJKsetcharclass{"25A0}{"25A2}{1}%All characters between U+25A0 and U+25A2 are expressed in Chinese. I want the U+25A1 symbol, which is right there.

4.After this little incident, it is successful, \symbol{"25A1} command can print this character, I finished the box output. Of course, I also found that the interpretation of the box is different in different fonts. For example, in the 楷体(KaiTi), its size is perfect, but the lines are thicker; In the仿宋(FangSong), the lines are appropriate, but smaller. I tried several times and found that in SimSun-ExtB.ttc or KaiXinSongB.ttf (a big Chinese font library), the box appeared perfectly as the character I wanted. enter image description here

5.So, the answer is revealed! The Chinese box is, indeed, a unicode character. In addition, the corresponding size and shape of the character are slightly different in different Chinese fonts, but the shape of KaiXinSongB.ttf font is the most satisfying to me!

6.Of course, what's also odd is that Why does "Rare Chinese Character Replacement Box" automatically interpret the character as U+25A1 symbol under SimSun-ExtB or KaiXinSongB font? Even if I set the font to 楷体(KaiTi), 仿宋(FangSong), etc., under these common fonts, if I type \symbol{"25A1}, the box it gives is the corresponding U+25A1 symbol under that font. But typing in unusual rare chinese characters that it can't display produces the U+25A1 symbol in SimSun-ExtB. That's something I haven't figured out yet. But it doesn't matter, I just need to change the font to SimSun-ExtB where I want to use the box, and the output is perfect.

That's all. Thank you for your attention. Thanks to my friend (user202729) for the pointer!

You must log in to answer this question.

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