dot2texi:在标签内使用宏会影响大小

dot2texi:在标签内使用宏会影响大小

在此处输入图片描述

这里的两张图片基本上是由相同的代码生成的,但左侧的图片使用了更多的宏——例如,左侧的图片有

\newcommand\fouriertransform[1]{\hat{#1}}
\newcommand\applyfn[2]{{#1}(#2)}
\newcommand\sumover[2]{\sum_{#1}#2}
\newcommand\conjugate[1]{\overline{#1}}

1 [label="\sumover{r}{\product{\conjugate{\applyfn{\fouriertransform{g}}{r}}}{\applyfn{\fouriertransform{f}}{r}}}"];

其中 RHS 有

1 [label="\sum_{r}{\overline{\hat{g}(r)}\hat{f}(r)}"];

由于某些奇怪的原因,这影响了图表的大小...我在 dot2tex/dot2texi 手册中找不到任何内容。如果能提供修复/解释,我将不胜感激。

代码:

\documentclass[a4paper, landscape]{article}
\usepackage[autosize]{dot2texi}
\usepackage{tikz}
\usepackage{amsmath, amsfonts}
\usepackage{adjustbox}
\usetikzlibrary{shapes,arrows}

\newenvironment{fit}{\begin{adjustbox}{max width=\textwidth,max totalheight=\textheight,keepaspectratio}}{\end{adjustbox}}

\newcommand\expectation[2]{\mathbb{E}_{#1}#2}
\newcommand\power[2]{{#1}^{#2}}
\newcommand\add[2]{{#1}+{#2}}
\newcommand\addthree[3]{{#1}+{#2}+{#3}}
\newcommand\subtract[2]{{#1}-{#2}}
\newcommand\negative[1]{-{#1}}
\newcommand\product[2]{{#1}{#2}}
\newcommand\productthree[3]{{#1}{#2}{#3}}
\newcommand\deltafn[1]{\delta({#1})}
\newcommand\fouriertransform[1]{\hat{#1}}
\newcommand\applyfn[2]{{#1}(#2)}
\newcommand\sumover[2]{\sum_{#1}#2}
\newcommand\conjugate[1]{\overline{#1}}
\newcommand\two{2}

\begin{document}
\begin{fit}
\begin{dot2tex}[twopi,mathmode]
digraph G {
root=0;
overlap=prism;
node [shape="box"];
0 [label="\sumover{r}{\product{\applyfn{\fouriertransform{f}}{r}}{\conjugate{\applyfn{\fouriertransform{g}}{r}}}}"];
1 [label="\sumover{r}{\product{\conjugate{\applyfn{\fouriertransform{g}}{r}}}{\applyfn{\fouriertransform{f}}{r}}}"];
2 [label="\sumover{r}{\product{\expectation{x}{\product{\applyfn{f}{x}}{\power{\omega}{\negative{\product{r}{x}}}}}}{\conjugate{\applyfn{\fouriertransform{g}}{r}}}}"];
3 [label="\sumover{r}{\product{\expectation{x}{\product{\applyfn{\fouriertransform{f}}{x}}{\deltafn{\subtract{x}{r}}}}}{\conjugate{\applyfn{\fouriertransform{g}}{r}}}}"];
4 [label="\sumover{r}{\product{\applyfn{\fouriertransform{f}}{r}}{\conjugate{\expectation{x}{\product{\applyfn{g}{x}}{\power{\omega}{\negative{\product{r}{x}}}}}}}}"];
5 [label="\sumover{r}{\product{\applyfn{\fouriertransform{f}}{r}}{\conjugate{\expectation{x}{\product{\applyfn{\fouriertransform{g}}{x}}{\deltafn{\subtract{x}{r}}}}}}}"];
0 -> 1;
0 -> 2;
0 -> 3;
0 -> 4;
0 -> 5;
}
\end{dot2tex}
\end{fit}
\begin{fit}
\begin{dot2tex}[twopi,mathmode]
digraph G {
root=0;
overlap=prism;
node [shape="box"];
0 [label="\sum_{r}{\overline{\hat{f}(r)}\hat{g}(r)}"];
1 [label="\sum_{r}{\overline{\hat{g}(r)}\hat{f}(r)}"];
2 [label="\sum_{r}{\mathbb{E}_{x}{f(x){\omega}^{{-rx}}}\overline{\hat{g}(r)}}"];
3 [label="\sum_{r}{\mathbb{E}_{x}{\hat{f}(x)\delta(x-r)}\overline{\hat{g}(r)}}"];
4 [label="\sum_{r}{\hat{f}(r)\overline{\mathbb{E}_{x}{g(x){\omega}^{{-rx}}}}}"];
5 [label="\sum_{r}{\hat{f}(r)\overline{\mathbb{E}_{x}{\hat{g}(x)\delta(x-r)}}}"];
0 -> 1;
0 -> 2;
0 -> 3;
0 -> 4;
0 -> 5;
}
\end{dot2tex}
\end{fit}
\end{document}

[注意:调整框只是为了让所有内容适合一页——将其注释掉并不能解决问题。]

相关内容