
Есть ли способ вставить код tikzpicture в строку? Вот чего я хочу добиться:
Выпуклая функция обозначается как "tikz код для выпуклости"
Кто-то сказал мне, что это возможно. Также в учебнике tikz-pgf я видел много встроенных кодов tikz. Например, в разделе масштабирования автор помещает вращающийся эллипс встроенным (то есть рядом с текстом)
Как этого можно добиться?
решение1
Использовать либо tikzpicture
как среду, либо как \tikz
встроенный макрос.
Но проблема с растяжением линии совершенно очевидна!
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shadings}
\begin{document}
A stupid text followed by \begin{tikzpicture}\draw[fill=red,line width=1pt] circle(1ex);\end{tikzpicture}
A stupid text followed by \tikz{\draw[fill=red,line width=1pt] circle(1ex);}
A stupid text followed by another stupid text followed
A stupid text followed by some dots \tikz{%
\foreach \x /\cola in {1/blue,2/yellow,3/red,4/green,5/orange} {%
\shade[ball color=\cola] (\x,0) circle(0.5ex*\x);
}%
}
\end{document}
решение2
Еще один пример из реального документа, который у меня есть:
\documentclass{article}
\usepackage{tikz}
\newcommand{\ground}{%
\begin{tikzpicture}[scale=0.5, baseline=-3mm, thick]
\draw (0,0) -- +(0mm,-4.0mm) {
[yshift=-4mm]
+(-2mm,0mm) -- +(2mm,0mm)
+(-1mm,-1mm) -- +(1mm,-1mm)
+(-0.3mm,-2mm) -- +(0.3mm,-2mm)
};
\end{tikzpicture}%
}
\begin{document}
We have a text here, and then I refer to the ground (\ground) connection point in the instrument. Clearly, the \ground{} symbol will change the spacing...
you can play with the \texttt{scale} and \texttt{baseline=-3mm} parameters in the definition\dots
\end{document}