Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Here is my latex code:

\documentclass{ctexart}
\begin{document}
中文宏包测试
\end{document}

I install the ctex and zhmetrics with Texlive, but I still get the error message:
dvips: ! Bad PK file /home/jerry/texmf/fonts/pk/modeless/zhmetrics/gbksong/gbksong51.9640pk: unexpected eof
I cannot find the where it goes wrong. Thanks for your time.

share|improve this question
4  
Which error message? Please provide the complete error message and some minimal, and complete example code producing this error. –  Gonzalo Medina Mar 13 '11 at 16:58
    
@Gonzalo: I think the one in the title: "! Bad PK file". It is better to repeat this information in the body. –  Martin Scharrer Mar 13 '11 at 17:42
1  
While I have no knowledge of Chinese, you might find a google search of the font and error helpful. It seems others have had this problem before. –  Matthew Leingang Mar 14 '11 at 12:22
    
Which engine are you using, xelatex or pdftex? For xelatex, ctex uses xeCJK; while for others ctex uses CJK. –  Ma Ming Mar 31 '11 at 11:13
add comment

2 Answers

up vote 2 down vote accepted

As a developer of ctex package, I'd say: ctex does NOT support latex+dvips approach by default. And zhmetrics does not provide mapping files for ttf2pk to create PK fonts on the fly.

When compiling with latex command, ctex package uses zhmetrics with default zhmap option. Then zhwinfonts.tex is used and TrueType font mappings are configured for dvipdfmx only. And when compiling with pdflatex command, TureType font mappings are configured for pdfTeX. Dvips do not support this, and we do not support dvips.

You can only use one of these to compile your documents:

  • latex + dvipdfmx
  • pdflatex
  • xelatex

If you insist on dvips, you must use ttf2pt1 or fontforge to convert the TrueType fonts to type 1 format. Then write a font mapping file and use updmap utility to install them.

Or, you can write proper ttfonts.map to get bitmap fonts on the fly.

After that, you can use ctexart with nozhmap option to use type 1 or PK fonts. (It is illegal as I know.)

Type 1 Chinese fonts are only useful for MetaPost. It is not recommended to use type 1 fonts.

share|improve this answer
    
Thanks, I solve the problem with xelatex and emacs. –  jerry_sjtu Dec 8 '11 at 12:15
add comment

The error message:

dvips: ! Bad PK file /home/jerry/texmf/fonts/pk/modeless/zhmetrics/gbksong/gbksong51.9640pk: unexpected eof

indicates that the mentioned file is not complete, i.e. some part is missing at the end of the file (eof). This could easily happened when the copy process of the file was interrupted during installation. Simply reinstall the file and it should work.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.