\Large 尺寸中的所有 TikZ 图形

\Large 尺寸中的所有 TikZ 图形

我有一份包含大量文本和图片的文档。您可以在以下 MWE 中看到:

\documentclass[a4paper,11pt,twoside]{memoir}

\usepackage{lipsum}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\usetikzlibrary{decorations.text,decorations.pathmorphing}
\usetikzlibrary{positioning,
                shadows,
                shapes.geometric}
\begin{document}

\lipsum[1]

\large 
\[
\tikzmarknode{A}{2} \tikzmarknode{B}{3} \times \tikzmarknode{C}{5}\tikzmarknode{D}{5}
\]
    
\begin{tikzpicture}[remember picture,overlay]
\tikzset{
    every node/.style={outer sep=2pt},
    lab/.style={font=\tiny,inner sep=0pt}}
    \draw[blue] (A) to[out=90,in=90,looseness=1.4] node[lab,midway,above]{multiply} (D) ;
    \draw[red] (B) to[out=90,in=90] node[lab,midway,above]{multiply} (C) ;  
    \draw[cyan] (A) to[out=-70,in=-110] node[lab,midway,below left]{multiply} (C) ;
    \draw[cyan] (B) to[out=-70,in=-110] node[lab,midway,below right]{multiply} (D) ;        
\end{tikzpicture}

\lipsum[1]

\begin{center}
\begin{tikzpicture}[every text node part/.style={align=center}]
    \node (a) [rectangle,draw=none,fill=blue!25,rounded corners=0.1cm] at (0,0) {\Large 5 \\ {} \\ 3};
    \node (b) [rectangle,draw=none,fill=blue!25] at (1,0) { \Large 7 \\ {} \\ 6};
    \node (c) [rectangle,draw=none,fill=blue!25] at (2,0) {\Large 8 \\ {} \\ 2};
    \node (d) [rectangle,draw=none,fill=blue!25] at (3,0) {\Large 9 \\ {} \\ 8};
    \node (fol1) [rectangle,draw=none,fill=blue!25] at (0,-1.5) {\Large 8};
    \node (fol2) [rectangle,draw=none,fill=blue!25] at (1,-1.5) {\Large 13};
    \node (fol3) [rectangle,draw=none,fill=blue!25] at (2,-1.5) {\Large 6};
    \node (fol4) [rectangle,draw=none,fill=blue!25] at (3,-1.5) {\Large 17};
    \node (fol) [rectangle,draw=none,fill=blue!25] at (2,-2.5) {\Large 9377};
\end{tikzpicture}
\end{center}

\lipsum[1]

\begin{center}
\begin{tikzpicture}[mycirc/.style={circle,fill=blue!20, minimum size=0.5cm}]
    \node[mycirc] (n1) at (-3,0) {116};
    \node[mycirc,label=above:{Middle number}] (n2) at (0,0) {120};
    \node[mycirc] (n3) at (3,0) {124};
    \node[rectangle,label=below:{Product},draw,minimum size=0.7cm] (n4) [below=0.7cm of n2] {\Large $120^2-2^2$};
    \draw[-to] (n1) -- node [midway,above] {less} (n2);
    \draw[-to] (n3) -- node [midway,above] {more} (n2);
    \draw[-to] (n2) -- (n4);
    \end{tikzpicture}
\end{center}  

\lipsum[1]

\end{document}

您可能会注意到里面的所有数字tikzpicture都是大字体。每次输入命令时,我都必须手动为每个数字执行此操作\Large\Large有没有办法可以全局设置所有字体的大小tikzpicture

有关的:

另外,如何将tikzpicture我使用的所有设置为居中\begin{center}...\end{center}

答案1

\tikzset{font=\Large}

tikzpicture例如在第一个之前

\documentclass{article}
\usepackage{tikz}
\tikzset{font=\Large}
\begin{document}
    \begin{tikzpicture}
        \node  {Test};
    \end{tikzpicture}
\end{document}

对于单个,tikzpicture您可以将其作为环境的可选参数:

\documentclass{article}
\usepackage{tikz}
\begin{document}
    \begin{tikzpicture}[font = \Large]
        \node  {Test};
    \end{tikzpicture}
\end{document}

集中所有tikzpicture使用

\documentclass{article}
\usepackage{etoolbox}
\usepackage{tikz}
\BeforeBeginEnvironment{tikzpicture}{\begin{center}}
\AfterEndEnvironment{tikzpicture}{\end{center}}
\begin{document}
    \begin{tikzpicture}[font = \Large]
        \node  {Test};
    \end{tikzpicture}
\end{document}

正如命令名称所示,它附加\begin{center}在启动tikzpicture环境之前和\end{center}结束tikzpicture环境之后。请参阅etoolbox 文档更多细节。

相关内容