如何使用 doxygen 生成带有自定义乳胶样式表和命令的 pdf?
How to use doxygen to produce a pdf with custom latex stylesheet and commands?
如何使用 doxygen 生成带有自定义 Latex 样式表和命令的 pdf?
我需要记录这段代码:
~\doxygenLaTex> more main.cpp
#include <iostream>
//! \page MainPage Main program
//! This program is meant to say hello!
int main() {std::cout << "Hello World!"; return 0;}
我需要使用自定义样式 mystyle.sty
获取 pdf 文档,其中包括自定义 LaTex 命令,例如 \mytable
,我需要在文档中使用:
~\doxygenLaTex> more mystyle.sty
\NeedsTeXFormat{LaTeX2e}[1999/01/01]
\ProvidesPackage{mystyle}[2018/05/28]
\newcommand*{\mytable}{%
\begin{tabular}{ll}
1 & 2 \
3 & 4 \
\end{tabular}
}
\endinput
所以我寻找如何为此使用 doxygen :
~\doxygenLaTex> ls
Doxyfile main.cpp mainpage.dox mystyle.sty
~\doxygenLaTex> more .\mainpage.dox
//!
//! \mytable
//!
//! \page MainPage
//!
~\doxygenLaTex> grep LATEX_EXTRA_STYLE .\Doxyfile
# The LATEX_EXTRA_STYLESHEET tag can be used to specify additional user-defined
LATEX_EXTRA_STYLESHEET = mystyle.sty
~\doxygenLaTex> grep ALIASES .\Doxyfile
ALIASES = "mytable=\mytable"
尽管阅读了文档,但它没有用:我得到的是文本命令! 运行 doxygen; cd latex; make pdf; AcroRd32.exe refman.pdf
给出:
我用谷歌搜索并找到 Doxygen: include custom latex command or How to get Doxygen to recognize custom latex command 不幸的是,这对我没有帮助。
尝试了更多的东西,但也没有用:
~\doxygenLaTex> git diff
diff --git a/Doxyfile b/Doxyfile
-ALIASES = "mytable=\mytable"
+ALIASES = "mytable=\mytable"
~\doxygenLaTex> git diff
diff --git a/Doxyfile b/Doxyfile
-ALIASES = "mytable=\mytable"
+ALIASES = "mytable=@mytable"
问题似乎是我得到了这种东西:
~\doxygenLaTex\latex> more .\_main_page.tex
This program is meant to say hello!
\textbackslash{}mytable
但不是
~\doxygenLaTex\latex> more .\_main_page.tex
This program is meant to say hello!
\mytable
我错过了什么?
附加问题:有没有办法不使用doxygen.sty
但实际上只mystyle.sty
来避免有什么冲突吗?
~\doxygenLaTex\latex> grep usepackage refman.tex
\usepackage{doxygen}
\usepackage{mystyle}
弗兰克
注:Windows10、doxygen 1.9.1
编辑
发帖前谷歌搜索时,我测试了\latexonly
。这个
~\doxygenLaTex> git diff
diff --git a/Doxyfile b/Doxyfile
-ALIASES = "mytable=\mytable"
+ALIASES = "\latexonly mytable=\mytable \endlatexonly"
或者这个
~\doxygenLaTex> git diff
diff --git a/Doxyfile b/Doxyfile
-ALIASES = "mytable=\mytable"
+ALIASES = "\latexonly mytable=\mytable \endlatexonly"
不工作。但是,确实如此
~\doxygenLaTex> git diff
diff --git a/mainpage.dox b/mainpage.dox
-//! \mytable
+//! \latexonly \mytable \endlatexonly
确实有效并产生了几乎我预期的结果:
但现在我遇到了另一个问题:真正的\mytable
不是table,这里不需要设置:
~\doxygenLaTex\latex> more .\_main_page.tex
This program is meant to say hello!
\mytable
但实际上在这里
~\doxygenLaTex\latex> more .\refman.tex
\begin{document}
\mytable
有没有办法在此处找到 LaTex 命令?理想情况下 不 使用 doxygen.sty
但实际上 仅 mystyle.sty
以避免任何类型的冲突 ?
当我理解正确时,您想在 LaTeX 输出/生成的 pdf 中使用 LaTeX 命令\mytable
。
大多数步骤都是正确的认为问题是 \mytable
是一个 LaTeX 命令而不是一个 doxygen 命令,所以你必须在 doxygen 解析的注释中让它为人所知。
对此有几种可能性:
\latexonly ... \endlatexonly
即在评论中添加:
\latexonly
\mytable
\endlatexonly
- 将其用作公式
\f[ \mytable \f]
当然你可以把上面的代码片段打包到一个专用的ALIASES
.
总而言之,我使用了:
Doxy文件
LATEX_EXTRA_STYLESHEET = mystyle.sty
main.cpp
#include <iostream>
/** \page MainPage Main program
* This program is meant to say hello!
*
* \latexonly
* \mytable
* \endlatexonly
*
* \f[ \mytable \f]
*/
int main() {std::cout << "Hello World!"; return 0;}
mystyle.sty
\NeedsTeXFormat{LaTeX2e}[1999/01/01]
\ProvidesPackage{mystyle}[2018/05/28]
\newcommand*{\mytable}{%
\begin{tabular}{ll}
1 & 2 \
3 & 4 \
\end{tabular}
}
如何使用 doxygen 生成带有自定义 Latex 样式表和命令的 pdf?
我需要记录这段代码:
~\doxygenLaTex> more main.cpp
#include <iostream>
//! \page MainPage Main program
//! This program is meant to say hello!
int main() {std::cout << "Hello World!"; return 0;}
我需要使用自定义样式 mystyle.sty
获取 pdf 文档,其中包括自定义 LaTex 命令,例如 \mytable
,我需要在文档中使用:
~\doxygenLaTex> more mystyle.sty
\NeedsTeXFormat{LaTeX2e}[1999/01/01]
\ProvidesPackage{mystyle}[2018/05/28]
\newcommand*{\mytable}{%
\begin{tabular}{ll}
1 & 2 \
3 & 4 \
\end{tabular}
}
\endinput
所以我寻找如何为此使用 doxygen :
~\doxygenLaTex> ls
Doxyfile main.cpp mainpage.dox mystyle.sty
~\doxygenLaTex> more .\mainpage.dox
//!
//! \mytable
//!
//! \page MainPage
//!
~\doxygenLaTex> grep LATEX_EXTRA_STYLE .\Doxyfile
# The LATEX_EXTRA_STYLESHEET tag can be used to specify additional user-defined
LATEX_EXTRA_STYLESHEET = mystyle.sty
~\doxygenLaTex> grep ALIASES .\Doxyfile
ALIASES = "mytable=\mytable"
尽管阅读了文档,但它没有用:我得到的是文本命令! 运行 doxygen; cd latex; make pdf; AcroRd32.exe refman.pdf
给出:
我用谷歌搜索并找到 Doxygen: include custom latex command or How to get Doxygen to recognize custom latex command 不幸的是,这对我没有帮助。
尝试了更多的东西,但也没有用:
~\doxygenLaTex> git diff
diff --git a/Doxyfile b/Doxyfile
-ALIASES = "mytable=\mytable"
+ALIASES = "mytable=\mytable"
~\doxygenLaTex> git diff
diff --git a/Doxyfile b/Doxyfile
-ALIASES = "mytable=\mytable"
+ALIASES = "mytable=@mytable"
问题似乎是我得到了这种东西:
~\doxygenLaTex\latex> more .\_main_page.tex
This program is meant to say hello!
\textbackslash{}mytable
但不是
~\doxygenLaTex\latex> more .\_main_page.tex
This program is meant to say hello!
\mytable
我错过了什么?
附加问题:有没有办法不使用doxygen.sty
但实际上只mystyle.sty
来避免有什么冲突吗?
~\doxygenLaTex\latex> grep usepackage refman.tex
\usepackage{doxygen}
\usepackage{mystyle}
弗兰克
注:Windows10、doxygen 1.9.1
编辑
发帖前谷歌搜索时,我测试了\latexonly
。这个
~\doxygenLaTex> git diff
diff --git a/Doxyfile b/Doxyfile
-ALIASES = "mytable=\mytable"
+ALIASES = "\latexonly mytable=\mytable \endlatexonly"
或者这个
~\doxygenLaTex> git diff
diff --git a/Doxyfile b/Doxyfile
-ALIASES = "mytable=\mytable"
+ALIASES = "\latexonly mytable=\mytable \endlatexonly"
不工作。但是,确实如此
~\doxygenLaTex> git diff
diff --git a/mainpage.dox b/mainpage.dox
-//! \mytable
+//! \latexonly \mytable \endlatexonly
确实有效并产生了几乎我预期的结果:
但现在我遇到了另一个问题:真正的\mytable
不是table,这里不需要设置:
~\doxygenLaTex\latex> more .\_main_page.tex
This program is meant to say hello!
\mytable
但实际上在这里
~\doxygenLaTex\latex> more .\refman.tex
\begin{document}
\mytable
有没有办法在此处找到 LaTex 命令?理想情况下 不 使用 doxygen.sty
但实际上 仅 mystyle.sty
以避免任何类型的冲突 ?
当我理解正确时,您想在 LaTeX 输出/生成的 pdf 中使用 LaTeX 命令\mytable
。
大多数步骤都是正确的认为问题是 \mytable
是一个 LaTeX 命令而不是一个 doxygen 命令,所以你必须在 doxygen 解析的注释中让它为人所知。
对此有几种可能性:
\latexonly ... \endlatexonly
即在评论中添加:\latexonly \mytable \endlatexonly
- 将其用作公式
\f[ \mytable \f]
当然你可以把上面的代码片段打包到一个专用的ALIASES
.
总而言之,我使用了:
Doxy文件
LATEX_EXTRA_STYLESHEET = mystyle.sty
main.cpp
#include <iostream>
/** \page MainPage Main program
* This program is meant to say hello!
*
* \latexonly
* \mytable
* \endlatexonly
*
* \f[ \mytable \f]
*/
int main() {std::cout << "Hello World!"; return 0;}
mystyle.sty
\NeedsTeXFormat{LaTeX2e}[1999/01/01]
\ProvidesPackage{mystyle}[2018/05/28]
\newcommand*{\mytable}{%
\begin{tabular}{ll}
1 & 2 \
3 & 4 \
\end{tabular}
}