
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}