有没有办法自动设置标记间隔处的节点\foreach
,以便可以参考它们来绘制括号;而不是手动定义它们的位置。
\documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\usepackage{verbatim}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{frame}[t]
\frametitle{ci}
\begin{tikzpicture}[scale=.9, transform shape]
\pgfmathsetmacro{\incx}{.88}
\draw [thick,-] (0,0) -- +(0:8.8) node [pos=.146](a){a} node [ pos=.296](b){b} node [pos=.44](c){c} node [pos=.586](d){d} node [pos=.876](e){e} node [pos=.73](f){f};
\foreach \x [evaluate=\x as \aff using int(\x*1)]in {1,...,6}{\draw [black, very thick] (\incx*1.46*\x,.2) -- +(-90:.4);}
\draw [blue, thick, decorate, decoration={brace,amplitude=.16cm,mirror}] (b.center|-0,-.4) -- (d.center|-0,-.4) node [blue!80!black, midway, xshift=0cm, yshift=-.5cm] {middle};
\draw [blue, thick, decorate, decoration={brace,amplitude=.16cm}] (a.center|-0,.4) -- (b.center|-0,.4) node [blue!80!black, midway, xshift=0cm, yshift=.5cm] {series};
\draw [blue, thick, decorate, decoration={brace,amplitude=.16cm,mirror}] (e.center|-0,.4) -- (f.center|-0,.4) node [blue!80!black, midway, xshift=0cm, yshift=.5cm] {draw};
\end{tikzpicture}
\end{frame}
\end{document}
答案1
您可以尝试这样的操作:
\foreach[count=\j] \i in {a,b,...,f}
\draw[-|] (\j,0) -- ++(1,0)node[below]{\i}coordinate(\i);
绘制线条并使用 命名节点\foreach
。
平均能量损失
\documentclass[border=3mm]{standalone}
\usepackage{pgfplots}
\tikzset{brce/.style={blue, thick, decorate, decoration={brace,amplitude=.16cm},}}
\tikzset{brcetxt/.style={blue!80!black, midway, xshift=0cm,}}
\begin{document}
\begin{tikzpicture}
\foreach[count=\j] \i in {a,b,...,f}
\draw[-|] (\j,0) -- ++(1,0)node[below]{\i}coordinate(\i);
\draw (f)--++(1,0);
\draw [brce,decoration=mirror] (b|-0,-.4) -- (d|-0,-.4) node [brcetxt,yshift=-.5cm] {middle};
\draw [brce] (a|-0,.2) -- (b|-0,.2) node [brcetxt, yshift=.5cm] {series};
\draw [brce] (e|-0,.2) -- (f|-0,.2) node [brcetxt, yshift=.5cm] {draw};
\end{tikzpicture}
\end{document}