doxygen 1.11.0 使用详解(九)——包含公式

目录

Doxygen allows you to put LATEX formulas in the output (this works only for the HTML, LATEX and RTF output. To be able to include formulas (as images) in the HTML and RTF documentation, you will also need to have the following tools installed

  • latex: the LATEX compiler, needed to parse the formulas. To test I have used the teTeX 1.0 distribution.
  • dvips: a tool to convert DVI files to PostScript files I have used version 5.92b from Radical Eye software for testing.
  • gs: the GhostScript interpreter for converting PostScript files to bitmaps. I have used Aladdin GhostScript 8.0 for testing.

For the HTML output there is also an alternative solution using MathJax which does not require the above tools. If you enable USE_MATHJAX in the configuration then the latex formulas will be copied to the HTML “as is” and a client side javascript will parse them and turn them into (interactive) images.

There are four ways to include formulas in the documentation.

  1. Using in-text formulas that appear in the running text. These formulas should be put between a pair of \f$ commands
  2. Using in-text formulas that appear in the running text, contrary to \f$ it will not explicitly open the math mode in LATEX. These formulas should be put between \f( and \f) commands
  3. Unnumbered displayed formulas that are centered on a separate line. These formulas should be put between \f[ and \f] commands.
  4. Formulas or other latex elements that are not in a math environment can be specified using \f{environment}, where environment is the name of the L A TEX environment, the corresponding end command is \f}.

For the first and third commands one should make sure formulas contain valid commands in L A TEX 's math-mode. The second command should valid text-mode commands that also work in math-mode when using USE_MATHJAX. For the fourth command the section should contain valid command for the specific environment.

Warning
Currently, doxygen is not very fault tolerant in recovering from typos in formulas. It may be necessary to remove the files formula.repository that are written to the html, rtf etc. directories to get rid of an incorrect formula as well as the form_∗ files.

To have the possibility to define your own L A TEX commands, for e.g. formula building blocks or consistent writing of certain words, the configuration option FORMULA_MACROFILE can be used. to supply a file with L A TEX commands. This file can contain L A TEX \newcommand and \renewcommand commands and they are included formulas (image version and MathJax version) as well as in the generated L A TEX output (for PDF generation).

The \newcommand (and \renewcommand ) are restricted to a version without optional parameters so only the following types are supported:

\newcommand{\cmd}{replacement}
\newcommand{\cmd}[nr]{replacement}

e.g.

\newcommand{\E}{\mathrm{E}}
\newcommand{\ccSum}[3]{\sum_{#1}^{#2}{#3}}
  • 19
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值