Tikz-Bild inline

Tikz-Bild inline

Gibt es eine Möglichkeit, einen Tikzpicture-Code inline einzufügen? Folgendes möchte ich eigentlich erreichen:

Eine konvexe Funktion wird durch „Tikz-Code für Konvexität"

Jemand hat mir gesagt, dass das möglich ist. Außerdem habe ich im Tikz-PGF-Tutorial viele Tikz-Codes inline gesehen. Beispielsweise platziert der Autor im Skalierungsabschnitt eine rotierende Ellipse inline (also neben dem Text).

Wie kann dies erreicht werden?

Antwort1

Entweder tikzpictureals Umgebung oder als \tikzInline-Makro verwenden.

Aber das Problem mit der Liniendehnung ist ziemlich offensichtlich!

\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}

Bildbeschreibung hier eingeben

Antwort2

Ein weiteres Beispiel aus einem realen Dokument, das ich habe:

\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}

Ausgabe des obigen Snippets

Antwort3

Hier ist ein Vorschlag, wie man den Tikz-Code inline platziert, wenn er nicht weit genug vom Text entfernt ist.

\raisebox{-2pt}{\tikz{\draw[line width=1pt, >->] (0, 0) arc (-180:0:8pt);}}

Ich habe das Folgende als Ausgabe erhalten, was, wie ich denke, ziemlich gut ist.

Bildbeschreibung hier eingeben

verwandte Informationen