我可以将 \MakeOuterQuote{"} 与 tikzpicture 结合使用吗?

我可以将 \MakeOuterQuote{"} 与 tikzpicture 结合使用吗?

我在序言中使用了该命令\MakeOuterQuote{"},但在 中使用引号时似乎会引发错误tikzpicture。我该如何解决这个问题?

Zarko 的解决方案如下:绘制下面的图?

他的代码:

\documentclass[border=3mm]{standalone}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
                positioning,
                quotes}

\begin{document}
    \begin{tikzpicture}[
node distance = 11mm and 33mm,
     N/.style = {draw, minimum size=12mm, inner sep=0pt},
            > = {Stealth[scale=0.8]},
 every edge/.append style = {draw, ->},
every edge quotes/.append style = {font=\small\linespread{0.63}\selectfont,
                                   inner sep=5pt, sloped}
                        ]
\node [N] (A) {$S$};
\node [N,above right=of A] (B) {$I_1$};
\node [N,below right=of A] (C) {$I_2$};
\node [N,above right=of C] (D) {$J$};
\node [N,right=of D] (E)  {$A$};
%
\draw [<-] (A) -- ++(-1,0) node[left] {$\mu$};
\draw [->] (A) -- ++(0,-1) node[below] {$\mu_s$};
\draw [->] ([xshift=3mm] B.south) -- ++(0,-0.4) node[below] {$\mu I_1$};
\draw [->] (C) -- ++(0,-1) node[below] {$\mu I_2$};
\draw [->] (D) -- ++(0,-1) node[below] {$\mu I$};
\draw [->] ([xshift=-3mm] E.south) -- ++(0,-0.4) node[below] {$\mu I$};
\draw [->] ([xshift=+3mm] E.south) -- ++(0,-0.4) node[below] {$\mu I$};
%
\draw   ([yshift=+1mm] A.east)
            edge [ultra thick, draw=gray,"\slash\slash\slash" anchor=center,
                  "$\begin{gathered}
                        p\beta_1 I_1\\
                        q\beta_2 JS\\
                        r\beta_3 AS
                    \end{gathered}$"] (B.west)
        ([yshift=-1mm] A.east)
            edge [ultra thick, draw=gray,"\slash\slash\slash" anchor=center,
                  "$\begin{gathered}
                        (1-p)\beta_2 I_1\\
                        (1-q)\beta_2 JS\\
                        (1-r)\beta_3 AS
                    \end{gathered}$" '] (C.west)
        (B) edge ["$\sigma$"] (C)
        (B.east) edge ["$???$"  ] ([yshift=+1mm] D.west)
        ( C.east) edge ["$???$"  ] (D.west)
        ([yshift=-2mm] D.west) edge ["$???$" '] ([yshift=-2mm] C.east)
    (D) edge ["$???$"] (E);
\end{tikzpicture}
\end{document}

请注意,他在 之前使用了引号。我在序言中\begin{gathered}使用该命令,因为我将其用于反问句,所以这就是错误发生的地方,我该如何解决这个问题?\MakeOuterQuote{"}

答案1

您应该将其放置在环境\DisableQuotes之前和\EnableQuotes之后tikzpicture。这样,图表的引用设置将暂时被禁用。

\documentclass[border=3mm]{standalone}
\usepackage [autostyle, english = american]{csquotes}
\MakeOuterQuote{"}

\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
                positioning,
                quotes}

\begin{document}

\DisableQuotes
\begin{tikzpicture}[
node distance = 11mm and 33mm,
     N/.style = {draw, minimum size=12mm, inner sep=0pt},
            > = {Stealth[scale=0.8]},
 every edge/.append style = {draw, ->},
every edge quotes/.append style = {font=\small\linespread{0.63}\selectfont,
                                   inner sep=5pt, sloped}
                        ]
\node [N] (A) {$S$};
\node [N,above right=of A] (B) {$I_1$};
\node [N,below right=of A] (C) {$I_2$};
\node [N,above right=of C] (D) {$J$};
\node [N,right=of D] (E)  {$A$};
%
\draw [<-] (A) -- ++(-1,0) node[left] {$\mu$};
\draw [->] (A) -- ++(0,-1) node[below] {$\mu_s$};
\draw [->] ([xshift=3mm] B.south) -- ++(0,-0.4) node[below] {$\mu I_1$};
\draw [->] (C) -- ++(0,-1) node[below] {$\mu I_2$};
\draw [->] (D) -- ++(0,-1) node[below] {$\mu I$};
\draw [->] ([xshift=-3mm] E.south) -- ++(0,-0.4) node[below] {$\mu I$};
\draw [->] ([xshift=+3mm] E.south) -- ++(0,-0.4) node[below] {$\mu I$};
%
\draw   ([yshift=+1mm] A.east)
            edge [ultra thick, draw=gray,"\slash\slash\slash" anchor=center,
                  "$\begin{gathered}
                        p\beta_1 I_1\\
                        q\beta_2 JS\\
                        r\beta_3 AS
                    \end{gathered}$"] (B.west)
        ([yshift=-1mm] A.east)
            edge [ultra thick, draw=gray,"\slash\slash\slash" anchor=center,
                  "$\begin{gathered}
                        (1-p)\beta_2 I_1\\
                        (1-q)\beta_2 JS\\
                        (1-r)\beta_3 AS
                    \end{gathered}$" '] (C.west)
        (B) edge ["$\sigma$"] (C)
        (B.east) edge ["$???$"  ] ([yshift=+1mm] D.west)
        ( C.east) edge ["$???$"  ] (D.west)
        ([yshift=-2mm] D.west) edge ["$???$" '] ([yshift=-2mm] C.east)
    (D) edge ["$???$"] (E);
\end{tikzpicture}
\EnableQuotes

"Hello!"

\end{document}

在此处输入图片描述

相关内容