Use doxygen to generate Chinese PDF documents

Source: Internet
Author: User
Tags doxygen

Author: zyl910

As we all know, we can use doxygen to generate PDF documents -- however, if it contains Chinese characters, we will encounter a lot of problems that cannot be output smoothly. I spent a long time exploring and finally found a way for doxygen to generate a Chinese PDF.

System Environment --
1) Mac OS X lion 10.7.5 + MacTeX-2012.
2) Windows XP SP3 + ctex 2.9.20.4.

I. Principles

Instead of outputting PDF files directly, doxygen generates the latex Directory, which contains a MAKEFILE file. If pdflatex is installed in the system, run the "make" command in the latex directory to generate a PDF file.
How can we install pdflatex? Mactex can be installed on Mac and ctex can be installed on Windows.

After the environment is installed, when you run the "make" command in the latex directory to generate a PDF file, you will find that the PDF file can be generated in English only, but cannot be generated in Chinese.

For latex formatting, doxygen has actually made a lot of preparation, for example -- the source file is UTF-8 encoding, and utf8 package is used by default. In theory, it supports multiple languages.
For Chinese, you also need to load the cjkutf8 package and configure the CJK environment. In this way, Chinese characters can be used smoothly.

Ii. Solutions

Specific steps --
1) Use docxygen to generate documents. Check generate_latex, latex_output, and use_pdflatex (preferably pdf_hyperlinks );

2) Open refman. Tex In the latex directory generated by docxygen in the text editor. Find the line "\ begin {document}" and change it --

\usepackage{CJKutf8} \begin{document}\begin{CJK}{UTF8}{gbsn} 

 

 

Then find the line "\ end {document}" and change it --

\end{CJK} \end{document}

 

Save and close.

3) Open the terminal, run the CD command to enter the latex directory, and then run the "make" command. After the execution is complete, refman.pdf will appear in the directory "--

When I make in Mac + mactex environment, I can generate a PDF file with bookmarks perfectly.
In the win + ctex environment, a bunch of errors will pop up (enter R and press enter to ignore subsequent errors), but the Chinese PDF can still be generated, unfortunately, bookmarks cannot be constructed smoothly.

 

References --
Mac: http://www.tug.org/mactex/
C: http://www.ctex.org/
How to Use doxygen to generate PDF documentation. David (bichenggui), 2009-04-22. http://blog.csdn.net/bichenggui/article/details/4101294
How to configure latex and CJK Suite (Tex live 2007) on Mac OS X. physical and physical component rooms of yuanzhi optical power station, 2009-03-06. http://exciton.eo.yzu.edu.tw /~ Lab/latex/install_cjk.html
Linux latex Chinese solution (cjkutf8) -- super simple. learningloong, 2011-08-31. http://learningloong.blog.163.com/blog/static/16230812420117318720817/
Simple Method of Using CJK Chinese fonts under Kile. Wind near the coast, 2011-10-10. http://my.opera.com/adoskk/blog/2011/10/10/kile

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.