3

I use the command \MakeOuterQuote{"} in my preamble, which seems to raise an error when using quotation marks inside a tikzpicture. How can I solve this problem?

Zarko's solution is over here: Drawing the following diagram?

His code:

\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}

Note that he uses quotation marks just before \begin{gathered}. I use the command \MakeOuterQuote{"} in my preamble because I use it for rhetorical questions, so this is where the error is occurring, how do I fix this?

Display Name
  • 46,933
Math
  • 765
  • 1
    Sorry for my radical edit. I think with this title, this question will be more helpful to others. – Jasper Habicht Dec 07 '21 at 17:27
  • The irrelevant packages loaded in the preamble are not needed in MWE and must be removed. Backticks will not work in the title, it just adds distractions. – Display Name Dec 07 '21 at 17:32
  • There is a very long preamble, quite likely full of things you don't use. Get the habit of starting with a short preamble, with the packages and commands you certainly need and add what you find necessary along the way. You'll get documents that are more easily maintained. For the present question, please trim off what's irrelevant for the issue and add code that shows the problem. – egreg Dec 07 '21 at 17:46

1 Answers1

4

You should place \DisableQuotes before and \EnableQuotes after the tikzpicture environment. This way, the quotation settings are temporarily disabled for the diagram.

\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}

enter image description here