简体   繁体   English

将自动生成的 UML 图嵌入到 LaTeX output

[英]Embedding auto-generated UML diagrams to LaTeX output

Is it possible to embed the UML diagrams generated with UML_LOOK = YES in the LaTeX output?是否可以在 LaTeX output 中嵌入使用UML_LOOK = YES生成的 UML 图?

Edit:编辑:

I am using Doxygen 1.9.1.我正在使用 Doxygen 1.9.1。 The output of doxygen -x Doxyfile looks like this: doxygen -x Doxyfile的 output 看起来像这样:

# Difference with default Doxyfile 1.9.1
PROJECT_NAME           = ...
JAVADOC_AUTOBRIEF      = YES
TOC_INCLUDE_HEADINGS   = 0
EXTRACT_ALL            = YES
EXTRACT_PRIVATE        = YES
INPUT                  = ...
FILE_PATTERNS          = *.cpp \
                         *.h
RECURSIVE              = YES
EXAMPLE_PATH           = .../examples
USE_MDFILE_AS_MAINPAGE = README.md
HTML_FORMULA_FORMAT    = svg
MATHJAX_RELPATH        = https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/
LATEX_CMD_NAME         = pdflatex
HAVE_DOT               = YES
COLLABORATION_GRAPH    = NO
UML_LOOK               = YES
TEMPLATE_RELATIONS     = YES
DOT_IMAGE_FORMAT       = svg
INTERACTIVE_SVG        = YES
DOT_TRANSPARENT        = YES

For a minimal source file like对于像这样的最小源文件

class Lol {
    void foo(){}
};

class Bar : public Lol {
};

int main(int argc, char *argv[])
{
    
    return 0;
}

The HTML output contains this kind of diagram: HTML output 包含这种图:

在此处输入图像描述

but the LaTeX PDF contains no graphs.但 LaTeX PDF 不包含图表。

Edit 2编辑 2

There seems to be a problem with dot ? dot似乎有问题?

Executing external command `dot ".../html/classBar__inherit__graph.dot" -Tsvg -o ".../html/classBar__inherit__graph.svg"`
Executing external command `dot ".../latex/classLol__inherit__graph.dot" -Tpdf -o ".../latex/classLol__inherit__graph.pdf"`
Executing external command `dot ".../html/classLol__inherit__graph.dot" -Tsvg -o ".../html/classLol__inherit__graph.svg"`
Executing external command `dot ".../html/graph_legend.dot" -Tsvg -o ".../html/graph_legend.svg"`
Executing external commanerror: Failed to extract bounding box from generated diagram file .../latex/classLol__inherit__graph.pdf
error: Problems running dot: exit code=0, command='dot', arguments='".../latex/classLol__inherit__graph.dot" -Tpdf -o ".../latex/classLol__inherit__graph.pdf"'
error: Failed to extract bounding box from generated diagram file .../latex/classBar__inherit__graph.pdf
error: Problems running dot: exit code=0, command='dot', arguments='".../latex/classBar__inherit__graph.dot" -Tpdf -o ".../latex/classBar__inherit__graph.pdf"'
error: Failed to extract bounding box from generated diagram file .../latex/classBar__inherit__graph.pdf
error: problem writing FIG 0 figure!

A comment does not accept images, but when I run your example with doxygen 1.9.1 I do see the UML diagram in the LaTeX output:评论不接受图像,但是当我使用 doxygen 1.9.1 运行您的示例时,我确实在 LaTeX output 中看到了 UML 图:

在此处输入图像描述

and

在此处输入图像描述

I ran the given example with the extra option -d extcmd (so doxygen -d extmd ) which also showed me that the uml diagram was created.我使用额外的选项-d extcmd (所以doxygen -d extmd )运行给定的示例,这也向我展示了 uml 图已创建。

Executing external command `dot ".../html/graph_legend.dot" -Tsvg -o ".../html/graph_legend.svg"`
Executing external command `dot ".../html/class_bar__inherit__graph.dot" -Tsvg -o ".../html/class_bar__inherit__graph.svg"`
Executing external command `dot ".../html/class_lol__inherit__graph.dot" -Tsvg -o ".../html/class_lol__inherit__graph.svg"`
Executing external command `dot ".../latex/class_bar__inherit__graph.dot" -Tpdf -o ".../latex/class_bar__inherit__graph.pdf"`
Executing external command `dot ".../html/inherit_graph_0.dot" -Tsvg -o ".../html/inherit_graph_0.svg"`
Executing external command `dot ".../latex/class_lol__inherit__graph.dot" -Tpdf -o ".../latex/class_lol__inherit__graph.pdf"`
Executing external command `dot ".../html/class_lol__inherit__graph.dot" -Tcmapx -o ".../html/class_lol__inherit__graph.map"`
Executing external command `dot ".../html/class_bar__inherit__graph.dot" -Tcmapx -o ".../html/class_bar__inherit__graph.map"`
Executing external command `dot ".../html/inherit_graph_0.dot" -Tcmapx -o ".../html/inherit_graph_0.map"`

So as far as I can see the UML diagrams are created.据我所知,创建了 UML 图。

Note: the current doxygen version is 1.9.5注意:当前的 doxygen 版本是 1.9.5

Yes, it is possible, but Cairo 1.17.6 changes the way that the PDFs are encoded, and doxygen fails to process the PDFs generated by dot .是的,这是可能的,但是 Cairo 1.17.6 改变了 PDF 的编码方式,并且 doxygen 无法处理dot生成的 PDF。

See https://github.com/doxygen/doxygen/issues/9319 , and albert's comment below (who figured this out, I am just summarizing the answer).请参阅https://github.com/doxygen/doxygen/issues/9319和下面的 albert 评论(谁知道这一点,我只是在总结答案)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM