Wie zeichne und markiere ich Text wie im Bild?

Wie zeichne und markiere ich Text wie im Bild?

Wie zeichnet man so per tikzPaket?

Bild

Antwort1

Hier ist ein Beispiel für Ihren Regenbogen:

\documentclass{article}
\usepackage{mathtools}
\usepackage{array}
\setlength{\extrarowheight}{4pt}
\newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}}

\usepackage{tikz}
\tikzset{every picture/.style={remember picture}}
\newcommand{\fromhere}[3]{\tikz[baseline]{\node[rounded corners, fill=#3, anchor=base, text height=1.45ex,text depth=.1ex] (#1) {#2};}}
\newcommand{\tohere}[2]{\tikz[baseline]{\node[anchor=base, inner xsep=-1pt,inner ysep=0pt] (#1) {$#2$};}}

\begin{document}
    \begin{center}
        \begin{tabular}{|M{7em}|M{25em}|}
            \hline
            \TeX.SE problem & 
            Why do so \fromhere{dn1}{many users}{red} not post an MWE (minimal working example)? Because they don't know \fromhere{du11}{what}{green} it is, they don't know \fromhere{du21}{how}{cyan} to build it or sometimes because they are loo \fromhere{du31}{lazy}{pink}\dots 

            On the contrary, which are the \fromhere{dn2}{smart users'}{yellow} golden rules of problem-solving? Read the \fromhere{du12}{manual}{orange}, search on \fromhere{du22}{TeX.SE}{lime} or, in general, on the Internet, and always post an \fromhere{du32}{MWE}{brown}!\\
            \hline
            van Duck's equations & 
            $\tohere{u11}{u_{1}^{1}} +
            \tohere{u21}{u_{2}^{1}} + 
            \tohere{u31}{u_{3}^{1}} -
            \tohere{n1}{n^{1}} = 0 \qquad 
            \tohere{u12}{u_{1}^{2}} +
            \tohere{u22}{u_{2}^{2}} +
            \tohere{u32}{u_{3}^{2}} -
            \tohere{n2}{n^{2}}  = 0$ \\
            \hline
        \end{tabular}
    \end{center}
    \begin{tikzpicture}[overlay]
        \draw[red,thick] ([xshift=2em]dn1.south) -- (n1.north);
        \draw[green,thick] ([xshift=-4pt]du11.south) -- (u11.north);
        \draw[cyan,thick] (du21.south) -- (u21.north);
        \draw[pink,thick] ([xshift=-9pt]du31.south) -- (u31.north);
        \draw[yellow,thick] ([xshift=2.3em]dn2.south) -- (n2.north);
        \draw[orange,thick] (du12.south) -- (u12.north);
        \draw[lime,thick] (du22.south) -- (u22.north);
        \draw[brown,thick] ([xshift=8pt]du32.south) -- (u32.north);
    \end{tikzpicture}
\end{document}

Bildbeschreibung hier eingeben

verwandte Informationen