We often encounter problems of showing Chinese bookmarks during using Latex, take the following MWE, i.e. main.tex
as an example:
1 | \documentclass{article} |
When using pdflatex
to compile, the Chinese bookmarks will not show correctly, though there will be no problem showing Chinese in the body text.
Correct way to handle is:
- Download and extract
gbk2uni.exe
to the Latex source folder. - Before final run of
pdflatex
command, dos rungdk2uni.exe main.out
- Run
pdflatex
again. Done!
It’s possible to simplify the 2nd step by adding a one-click button to the Latex editor, i.e. WinEdt’s toobar. The steps are:
- Copy
gbk2uni.exe
toC:\CTEX\MiKTeX\miktex\bin
. - Create file
gbk2uni.bat
with the following content:1
2gbk2uni %1.out
pause - Put this file to
..\Ctex\WinEdt\Bin\
(createBin
folder if not existing). - In WinEdt:
Options –> Option Interface… –> Menu and Toolbar… –> MainMenu –>
double click to openMainMenu.ini
file–>
add the following content beforeEND="&Accessories" –>
right clickMainMenu –> load script (F9)
.1
2
3
4
5
6ITEM="GBK to Unicode"
CAPTION="gbk2uni"
IMAGE="Notepad"
SAVE_INPUT=1
MACRO=:Run('%B\Bin\gbk2uni.bat %N');
REQ_FILTER="%P\%N.out" - In WinEdt:
Options –> Option Interface… –> Menu and Toolbar… – > Toolbar –>
double click to opentoolbar.ini
file –> addBUTTON="GBK to Unicode"
, e.g. beforeBUTTON="MetaFont" –>
right clickToolbar –> load script (F9)
. - Done! There will be a
gbk2uni
button (with a Notepad icon, change in step-4 if you want to use other icons) beforeMetaFont
button.
Up to now, the way to generate the PDF with correct Chinese bookmarks can be, i.e all by simply clicking the coresponding buttons: pdflatex -> pdflatex –> gdk2uni -> pdflatex
.
References:
- Example from: http://bbs.ctex.org/forum.php?mod=viewthread&tid=64270
- Adding
gbk2uni
button to WinEdt is based on: http://blog.sina.com.cn/s/blog_48f3a1cd0101mon3.html