Posição do texto e setas na matriz TikZ

Posição do texto e setas na matriz TikZ

Quero colocar um texto dentro de um TikZ matrix, mas ele sempre começa de baixo!. Então, minha pergunta é como posso forçá-lo a começar de cima?

Meu MWE:

\documentclass{article}    
\usepackage[svgnames]{xcolor}
\usepackage{tikz}

        \usetikzlibrary{
                arrows, chains, matrix, 
                positioning, 
                shadows,
                shapes, shapes.callouts,graphs, calc,
                shapes.geometric,
                shapes.misc,
                intersections,
               matrix, % to draw a table
              fit                  
                }

 %\newcommand{\vlab}[2]{%
        %           \tikz[baseline,inner sep=0] \node[anchor=base] (#1){#2};
            %       }

\begin{document}


 \begin{tikzpicture}[every node/.style={anchor=base,text depth=.5ex},baseline]
  \matrix %[draw=red]
   {
     \node[text height=2ex,fill=Orange!30,text width=6cm] {Local case}; & \node[text height=2ex,fill=Green!30,text width=7cm]{Global case}; \\
     \node[text height=6cm,fill=Yellow!30,align=left,text width=6cm] (noda) {
        \begin{itemize}
           \item We have \[\left[\bar \theta\right]=\left[\bar\partial (h^{-1}\partial h)\right]=c_1(\mathcal L)\,
                  =\left[K\right]\]  \\
           \item Since  $h=\exp(\mathcal K)$ we have:
                \[
                    \theta = \exp(-\mathcal K)\partial (\exp(\mathcal K))= \tikz[baseline,inner sep=0] 
                    \node[anchor=base](Kpot){$\partial\mathcal K$};
                    \tikz[baseline,inner sep=0] \node[below= of Kpot](Kpot2){\scriptsize So a K\"ahler transf. corresponds to a gauge 
                          transformation };
                     \tikz[overlay]\draw[->,red] (Kpot) to (Kpot2);
                \]
        \end{itemize}        
          }; 
     & \node[fill=Cyan!30,text height=6cm,,text width=7cm] {
      \begin{itemize}
        \item $\mathcal L$ is a flat bundle i.e $h=cst$\\
        \item Since $\theta \sim \partial h$, we can choose a vanishing connection:
            \[
                \theta=\bar \theta=0
             \]
      \end{itemize}       
               };\\
        %\node[fill=Purple] {a}; & \node[fill=LightBlue] {X}; & \node[fill=Aquamarine] {g}; \\
    };
\end{tikzpicture}

Responder1

Em relação ao seu exemplo, existem alguns problemas:

  • A \matrixjá cria nós, então não acho que aninhar nós seja aconselhável.
  • Você precisa colocar cada um \itementre chaves quando estiver dentro de um \matrix, como:\item{<content goes here>}
  • Para colorir uma célula, use|[fill=<color>]|

Saída

insira a descrição da imagem aqui

Código

\documentclass{article}    
\usepackage[svgnames]{xcolor}
\usepackage[margin=2cm]{geometry}
\usepackage{tikz}
\usepackage{amsmath,amssymb}

\usetikzlibrary{
    arrows, chains, matrix, 
    positioning, 
    shadows,
    shapes, shapes.callouts,
    graphs, calc,
    shapes.geometric,
    shapes.misc,
    intersections,
    matrix,fit,           
}

\newcommand{\tikzmark}[2]{\tikz[overlay,remember picture, anchor=base west] \node[text depth=, text width=] (#1) {#2};}

\begin{document}
\begin{tikzpicture}
\matrix [
matrix of nodes,
nodes in empty cells,
every node/.style={align=left},
row 1/.style={text width=.45\linewidth,text depth=2ex},
row 2/.style={nodes={font=\footnotesize, text width=.45\linewidth,text depth=6cm}}
] 
{
|[fill=Orange!30]| Local Case & |[fill=Green!30]| Global case \\
|[fill=Yellow!30]|
\begin{itemize}
   \item{We have \[\left[\bar \theta\right]=\left[\bar\partial (h^{-1}\partial h)\right]=c_1(\mathcal L)\,
            =\left[K\right]\]}
   \item{Since  $h=\exp(\mathcal K)$ we have:
        \[\theta = \exp(-\mathcal K)\partial (\exp(\mathcal K))\,
            =\tikzmark{Kpot}{$\partial\mathcal K$}\]}            
\end{itemize}
\tikzmark{Kpot2}{\scriptsize So a K\"ahler transf. corresponds to a gauge transformation}
& 
|[fill=Cyan!30]|
\begin{itemize}
    \item{$\mathcal L$ is a flat bundle i.e $h=cst$}
    \item{Since $\theta \sim \partial h$, we can choose a vanishing connection:
        \[
            \theta=\bar \theta=0
        \]}
\end{itemize}\\
};
\end{tikzpicture}
\tikz[overlay, remember picture]{%
    \draw[->,red] (Kpot.south) -- (Kpot2.north);
}
\end{document}

Responder2

Em vez de TiKZ-matrixvocê preferir usar tcolorboxes. O texto é facilmente composto dentro de a tcolorboxdo que dentro de a node. Com a tcbrastersuas caixas podem ser distribuídas como uma matriz. E, claro, tikzmarké compatível com eles.

\documentclass{article}    
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage[svgnames]{xcolor}
\usepackage[margin=2cm]{geometry}
\usepackage{tikz}
\usepackage{amsmath,amssymb}
\usepackage[most]{tcolorbox}
\usepackage{lipsum}
\usetikzlibrary{tikzmark}

\begin{document}
\lipsum[1]

\begin{tcbitemize}[raster columns=2, 
    raster column skip=0pt, 
    raster row skip=0pt,
    raster equal height=rows,
    arc=0mm,
    boxrule=0pt,
    coltitle=black,
    ]
\tcbitem[colbacktitle=Orange!30, colback=Yellow!20, adjusted title= Local Case]
\begin{itemize}
   \item We have \[\left[\bar \theta\right]=\left[\bar\partial (h^{-1}\partial h)\right]=c_1(\mathcal L)\,
            =\left[K\right]\] 
   \item Since  $h=\exp(\mathcal K)$ we have:
        \[\theta = \exp(-\mathcal K)\partial (\exp(\mathcal K))\,
            =\partial\mathcal K\tikzmark{Kpot}\]            
\end{itemize}
\tikzmark{Kpot2}So a Kähler transf. corresponds to a gauge transformation.
\begin{tikzpicture}[remember picture, overlay]
\draw[red, shorten >=1mm, shorten <=1mm, ->] ([yshift=1mm]pic cs:Kpot) -- ++(0:3mm) |- ([shift={(-3mm,5mm)}]pic cs:Kpot2)|-([shift={(0mm,1mm)}]pic cs:Kpot2);
\end{tikzpicture}
\tcbitem[colbacktitle=Green!30, colback=Cyan!30, adjusted title=Global Case]
\begin{itemize}
    \item $\mathcal L$ is a flat bundle i.e $h=cst$
    \item Since $\theta \sim \partial h$, we can choose a vanishing connection:
        \[
            \theta=\bar \theta=0
        \]
\end{itemize}
\tcbitem[colbacktitle=Red!30, colback=Orange!40, adjusted title= Local Case]
\begin{itemize}
   \item We have \[\left[\bar \theta\right]=\left[\bar\partial (h^{-1}\partial h)\right]=c_1(\mathcal L)\,
            =\left[K\right]\] 
   \item Since  $h=\exp(\mathcal K)$ we have:
        \[\theta = \exp(-\mathcal K)\partial (\exp(\mathcal K))\,
            =\partial\mathcal K\]            
\end{itemize}
So a Kähler transf. corresponds to a gauge transformation.
\begin{tikzpicture}[remember picture, overlay]
\draw[red, shorten >=1mm, shorten <=1mm, ->] ([yshift=1mm]pic cs:Kpot) -- ++(0:3mm) |- ([shift={(-3mm,5mm)}]pic cs:Kpot2)|-([shift={(0mm,1mm)}]pic cs:Kpot2);
\end{tikzpicture}
\tcbitem[colbacktitle=Purple!30, colback=Blue!30, adjusted title=Global Case]
\begin{itemize}
    \item $\mathcal L$ is a flat bundle i.e $h=cst$
    \item Since $\theta \sim \partial h$, we can choose a vanishing connection:
        \[
            \theta=\bar \theta=0
        \]
\end{itemize}
\end{tcbitemize}
\end{document}

insira a descrição da imagem aqui

Atualizar:

Considere isso como um longo comentário em vez de uma resposta. OP comenta sobre o uso de matrixtabelas coloridas de múltiplas linhas comoEste. Acho que isso é apenas uma tabela colorida e o pacote colortblpode ser usado para isso:

\documentclass{article}

\usepackage[table,svgnames]{xcolor}
%\usepackage{colortbl}
\usepackage{amsmath,amssymb}
\usepackage{tikz}
\usetikzlibrary{tikzmark}

\begin{document}

\def\arraystretch{2}
\setlength\arrayrulewidth{0.6pt} % see http://tex.stackexchange.com/a/53935/1952
\begin{tabular}{l|l}
\rowcolor{Orange!30}Local Case & Global Case \\ \hline
\rowcolor{Red!30}\ \textbullet\ \# $\text{vector multiplets}\equiv n = \dim \mathcal{M}$ 
&
\ \textbullet\ \# $\text{vector multiplets}\equiv n = \dim \mathcal{M}$ 
\\\hline
\rowcolor{Cyan!30}\ \textbullet\ \# $\text{vector fields}\equiv \overline{n} = n$ 
&
\ \textbullet\ \# $\text{vector fields}\equiv \overline{n} = n + \textcolor{red}{1}\tikzmark{a}$\tikz[remember picture, overlay]\draw[red] ([yshift=0.75ex]pic cs:a)--++(0.25,.25) node[right]{graviphoton}; 
\\\hline
\rowcolor{Blue!30}\ \textbullet\ \# $\text{Rank of SV} \equiv 2\overline{n} = 2n$ 
&
\ \textbullet\ \# $\text{Rank of SV} \equiv 2\overline{n} = 2n+2$ 
\\
\end{tabular}
\end{document}

insira a descrição da imagem aqui

informação relacionada