![无法更改 PGF 装饰文本](https://linux22.com/image/289292/%E6%97%A0%E6%B3%95%E6%9B%B4%E6%94%B9%20PGF%20%E8%A3%85%E9%A5%B0%E6%96%87%E6%9C%AC.png)
跟进@TomBombadil 的回答路径上的圆形箭头和文字。我试图调整文本的大小和/或颜色,但编译卡在了:
(/usr/local/texlive/2013/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg))
具体来说,我尝试将text={#8}
宏定义最后一行中的替换\arcarrow
为类似内容\text={\large #8}
,但没有成功。有什么想法吗?
为了完整起见,下面是我尝试编译的代码:
\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.text}
\newcommand{\arcarrow}[8]% inner radius, middle radius, outer radius, start angle, end angle, tip protusion angle, options, text
{ \pgfmathsetmacro{\rin}{#1}
\pgfmathsetmacro{\rmid}{#2}
\pgfmathsetmacro{\rout}{#3}
\pgfmathsetmacro{\astart}{#4}
\pgfmathsetmacro{\aend}{#5}
\pgfmathsetmacro{\atip}{#6}
\fill[#7] (\astart:\rin) arc (\astart:\aend:\rin) -- (\aend+\atip:\rmid) -- (\aend:\rout) arc (\aend:\astart:\rout) -- (\astart+\atip:\rmid) -- cycle;
\path[decoration={text along path, text={\large #8}, text align={align=center}, raise=-0.5ex},decorate] (\astart+\atip:\rmid) arc (\astart+\atip:\aend+\atip:\rmid);
}
\begin{document}
\begin{tikzpicture}
\arcarrow{3}{4}{5}{10}{110}{10}{red,draw=red!20!black,very thick}{Parameterization}
\arcarrow{3}{4}{5}{130}{230}{10}{red,draw=red!20!black,very thick}{Approximation}
\arcarrow{3}{4}{5}{250}{350}{10}{red,draw=red!20!black,very thick}{Implementation}
\end{tikzpicture}
\end{document}
答案1
我找到了这样的解决方案:使用|\large|
、|\Huge|
等进行字体声明:
\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.text}
\tikzstyle{line node} = [font=\large ]
\newcommand{\arcarrow}[8]% inner radius, middle radius, outer radius, start angle, end angle, tip protusion angle, options, text
{ \pgfmathsetmacro{\rin}{#1}
\pgfmathsetmacro{\rmid}{#2}
\pgfmathsetmacro{\rout}{#3}
\pgfmathsetmacro{\astart}{#4}
\pgfmathsetmacro{\aend}{#5}
\pgfmathsetmacro{\atip}{#6}
\fill[#7] (\astart:\rin) arc (\astart:\aend:\rin) -- (\aend+\atip:\rmid) -- (\aend:\rout) arc (\aend:\astart:\rout) -- (\astart+\atip:\rmid) -- cycle;
\path[decoration={text along path, text={|\Huge| #8}, text align={align=center}, raise=-0.5ex},decorate] (\astart+\atip:\rmid) arc (\astart+\atip:\aend+\atip:\rmid);
}
\begin{document}
\begin{tikzpicture}
\arcarrow{3}{4}{5}{10}{110}{10}{red,draw=red!20!black,very thick}{Parameterization}
\arcarrow{3}{4}{5}{130}{230}{10}{red,draw=red!20!black,very thick}{Approximation}
\arcarrow{3}{4}{5}{250}{350}{10}{red,draw=red!20!black,very thick}{Implementation}
\end{tikzpicture}
\end{document}