路径上的 Tikz 倾斜标签

路径上的 Tikz 倾斜标签

关于如何使标签“Diapason”、“Diapente”和“Diatessaron”的文本倾斜,您有什么建议吗?

(Linux Lubuntu 上带有 texlive 2014 的 PDFLATEX)

谢谢你,A

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}

\begin{tikzpicture}[scale=5]


\coordinate [label=above:ut] (ut) at (2,0);
\coordinate [label=above:fa'] (fa') at (4,0);


\coordinate [label=above:C] (C) at (2, 2.4);
\coordinate [label=above:c] (c) at (4, 1.2);

\draw (ut) -- (fa');
\draw (ut) -- (C);
\draw (C) -- (c);
\draw (fa') -- (c);

\coordinate [label=above:sol] (sol) at ($ (ut)!2.0/3!(fa') $);
\coordinate [label=above:G] (G) at ($ (C)!2.0/3!(c) $);
\draw (sol) --(G);

\node [fill=black, inner sep=1pt] (c') at ($ (ut)!1.0/6!(C) $) {};
\node [fill=black, inner sep=1pt] (c') at ($ (ut)!2.0/6!(C) $) {};
\node [fill=black, inner sep=1pt] (c') at ($ (ut)!3.0/6!(C) $) {};
\node [fill=black, inner sep=1pt] (c') at ($ (ut)!4.0/6!(C) $) {};
\node [fill=black, inner sep=1pt] (c') at ($ (ut)!5.0/6!(C) $) {};

\node [fill=black, inner sep=1pt] (c') at ($ (fa')!1.0/3!(c) $) {};
\node [fill=black, inner sep=1pt] (c') at ($ (fa')!2.0/3!(c) $) {};
\draw (fa') -- (c);

\node [fill=black, inner sep=1pt] (c') at ($ (sol)!1.0/4!(G) $) {};
\node [fill=black, inner sep=1pt] (c') at ($ (sol)!2.0/4!(G) $) {};
\node [fill=black, inner sep=1pt] (c') at ($ (sol)!3.0/4!(G) $) {};


\draw [bend right=800]  (ut) to node [sloped, above] {Diapason} (fa');
\draw [bend right=800]  (ut) to node [sloped, above] {Diapente} (sol);
\draw [bend right=800]  (sol) to node [sloped, above] {Diatessaron} (fa');


\end{tikzpicture}
\end{document}

在此处输入图片描述

答案1

您可以使用decorations.text库:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{decorations.text}
\begin{document}

\begin{tikzpicture}[scale=5]


\coordinate [label=above right:ut] (ut) at (2,0);
\coordinate [label=above right:fa'] (fa') at (4,0);


\coordinate [label=above:C] (C) at (2, 2.4);
\coordinate [label=above:c] (c) at (4, 1.2);

\draw (ut) -- (fa');
\draw (ut) -- (C);
\draw (C) -- (c);
\draw (fa') -- (c);

\coordinate [label=above right:sol] (sol) at ($ (ut)!2.0/3!(fa') $);
\coordinate [label=above:G] (G) at ($ (C)!2.0/3!(c) $);
\draw (sol) --(G);

\node [fill=black, inner sep=1pt] (c') at ($ (ut)!1.0/6!(C) $) {};
\node [fill=black, inner sep=1pt] (c') at ($ (ut)!2.0/6!(C) $) {};
\node [fill=black, inner sep=1pt] (c') at ($ (ut)!3.0/6!(C) $) {};
\node [fill=black, inner sep=1pt] (c') at ($ (ut)!4.0/6!(C) $) {};
\node [fill=black, inner sep=1pt] (c') at ($ (ut)!5.0/6!(C) $) {};

\node [fill=black, inner sep=1pt] (c') at ($ (fa')!1.0/3!(c) $) {};
\node [fill=black, inner sep=1pt] (c') at ($ (fa')!2.0/3!(c) $) {};
\draw (fa') -- (c);

\node [fill=black, inner sep=1pt] (c') at ($ (sol)!1.0/4!(G) $) {};
\node [fill=black, inner sep=1pt] (c') at ($ (sol)!2.0/4!(G) $) {};
\node [fill=black, inner sep=1pt] (c') at ($ (sol)!3.0/4!(G) $) {};

\draw[postaction={decorate,decoration={text along path,text align=center,text={Diapason},raise=5pt}}](ut)to[bend right=800] (fa'){};
\draw[postaction={decorate,decoration={text along path,text align=center,text={Diapente},raise=5pt}}](ut)to[bend right=800] (sol){};
\draw[postaction={decorate,decoration={text along path,text align=center,text={Diatessaron},raise=5pt}}](sol)to[bend right=800] (fa'){};

%\draw [bend right=800]  (ut) to node [sloped, above] {Diapason} (fa');
%\draw [bend right=800]  (ut) to node [sloped, above] {Diapente} (sol);
%\draw [bend right=800]  (sol) to node [sloped, above] {Diatessaron} (fa');


\end{tikzpicture}
\end{document}

我还将标签更改为above rightlabel=above right:ut提高可读性。

在此处输入图片描述

您可以使用类似这样的循环进一步减少输入

\foreach \x in {0.16,0.32,...,0.8}{
\node [fill=black, inner sep=1pt]  at ($ (ut)!\x!(C) $) {};
}
\foreach \x in {0.333,0.666}{
\node [fill=black, inner sep=1pt]  at ($ (fa')!\x!(c) $) {};
}
\foreach \x in {0.25,0.5,0.75}{
\node [fill=black, inner sep=1pt]  at ($ (sol)!\x!(G) $) {};
}

相关内容