我在 tikz 中有文本。如何减少所有文本行之间的垂直间距?例如,以下示例中单词“Upstream”和“Bias”之间的间距。
\documentclass{beamer}
\usepackage{graphicx}
\usepackage{tikz}
\begin{document}
\begin{frame}
\begin{figure}[H]
\begin{center}
\usetikzlibrary{arrows}
\begin{tikzpicture}[scale=0.8]
\draw[<-] node[anchor=north] {$t$} (0,0) -- (10,0) ;
\draw[thick, blue] (0,2) parabola[bend at end] (7,0.5);
\draw[thick, blue] (7,0.5) parabola (9,2);
\draw[thick, blue] (0,3) parabola[bend at end] (3,4);
\draw[thick, blue] (3,4) parabola (9,3);
\draw[thick,dashed,red] (7,0) coordinate parabola (7,8) ;
\draw[thick,dashed,red] (3,0) coordinate parabola (3,8) ;
\draw[thick,dashed,black] (5,0) coordinate parabola (5,8) ;
\draw (8,8) node [draw, text width=1.1cm, align=center] {\tiny Upstream Bias};
\draw (6,8) node [text width=1.1cm, align=center] {\tiny Upstream Bias};
\draw (4,8) node [draw, text width=1.1cm, align=center] {\tiny Downstream Bias};
\draw (2,8) node [text width=1.1cm, align=center] {\tiny Downstream Bias};
\draw (10.2,3) node {Production};
\draw (10,2) node {Price};
\draw (5,0) node[anchor=north] {\tiny Switch of R\&D Bias};
\end{tikzpicture}
\end{center}
\end{figure}
\end{frame}
\end{document}
答案1
您需要使用font=\tiny
。
\documentclass{beamer}
\usepackage{graphicx}
\usepackage{tikz}
\begin{document}
\begin{frame}
\begin{figure}[H]
\begin{center}
\usetikzlibrary{arrows}
\begin{tikzpicture}[scale=0.8]
\draw[<-] node[anchor=north] {$t$} (0,0) -- (10,0) ;
\draw[thick, blue] (0,2) parabola[bend at end] (7,0.5);
\draw[thick, blue] (7,0.5) parabola (9,2);
\draw[thick, blue] (0,3) parabola[bend at end] (3,4);
\draw[thick, blue] (3,4) parabola (9,3);
\draw[thick,dashed,red] (7,0) coordinate parabola (7,8) ;
\draw[thick,dashed,red] (3,0) coordinate parabola (3,8) ;
\draw[thick,dashed,black] (5,0) coordinate parabola (5,8) ;
\draw (8,8) node [draw, text width=1.1cm, align=center,font=\tiny] {Upstream Bias};
\draw (6,8) node [text width=1.1cm, align=center,font=\tiny] {Upstream Bias};
\draw (4,8) node [draw, text width=1.1cm, align=center,font=\tiny] {Downstream Bias};
\draw (2,8) node [text width=1.1cm, align=center,font=\tiny] {Downstream Bias};
\draw (10.2,3) node {Production};
\draw (10,2) node {Price};
\draw (5,0) node[anchor=north,font=\tiny] {Switch of R\&D Bias};
\end{tikzpicture}
\end{center}
\end{figure}
\end{frame}
在您的图片中,除了两个文本之外,其他文本都很小,将字体全局设置为小字体并放置在\normalsize
需要的位置可能会更容易。
\documentclass{beamer}
\usepackage{graphicx}
\usepackage{tikz}
\begin{document}
\begin{frame}
\begin{figure}[H]
\begin{center}
\usetikzlibrary{arrows}
\begin{tikzpicture}[scale=0.8,font=\tiny]
\draw[<-] node[anchor=north] {$t$} (0,0) -- (10,0) ;
\draw[thick, blue] (0,2) parabola[bend at end] (7,0.5);
\draw[thick, blue] (7,0.5) parabola (9,2);
\draw[thick, blue] (0,3) parabola[bend at end] (3,4);
\draw[thick, blue] (3,4) parabola (9,3);
\draw[thick,dashed,red] (7,0) coordinate parabola (7,8) ;
\draw[thick,dashed,red] (3,0) coordinate parabola (3,8) ;
\draw[thick,dashed,black] (5,0) coordinate parabola (5,8) ;
\draw (8,8) node [draw, text width=1.1cm, align=center] {Upstream Bias};
\draw (6,8) node [text width=1.1cm, align=center] {Upstream Bias};
\draw (4,8) node [draw, text width=1.1cm, align=center] {Downstream Bias};
\draw (2,8) node [text width=1.1cm, align=center] {Downstream Bias};
\draw (10.2,3) node[font=\normalsize] {Production};
\draw (10,2) node[font=\normalsize] {Price};
\draw (5,0) node[anchor=north] {Switch of R\&D Bias};
\end{tikzpicture}
\end{center}
\end{figure}
\end{frame}