0

I want to align the node text vertically centered. Wondering how to accomplish this?

\documentclass{standalone}
\usepackage[utf8]{inputenc}
\usepackage{fourier, tikz}
\usetikzlibrary{arrows, fit, calc}

\begin{document}

\begin{tikzpicture}[font = \normalsize] \begin{scope}[every node/.style={% text width = 3.0cm, text depth = 2.0cm, inner sep = 2.0mm, minimum height = 2.0cm, minimum width = 1.5cm, align = left }]

\nodefill = blue!20{\textbf{F}};

\nodefill = red!20, anchor = north west at (T1.north east){\textbf{Co}};

\nodefill = green!20, anchor = north west at (T1.south west){\textbf{Cu}};

\nodefill = yellow!20, anchor = north west at (T1.south east){\textbf{O}}; \end{scope}

\begin{scope}[align = center] \node [text width = 6cm, above = 0.0ex, anchor = south] (T5) at (T1.north east) {\textbf{I}};

\node [text width = 6cm, below = 0.0ex, anchor = north] (T6) at (T3.south east) {\textbf{U}};

\node text width = 1.5cm, left = 0.0ex, anchor = east at (T1.south west) {\textbf{C}};

\node text width = 0.75cm, right = 0.0ex, anchor = west at (T2.south east) {\textbf{S}};

\end{scope}

\draw[thick] (T5) -- (T6) (T7) -- (T8) ;
\end{tikzpicture}

\end{document}

enter image description here

Solution Just removing text width = 3.0cm, text depth = 2.0cm from my working example gives the required solution.

\documentclass{standalone}
\usepackage[utf8]{inputenc}
\usepackage{fourier, tikz}
\usetikzlibrary{arrows, fit, calc}

\begin{document}

\begin{tikzpicture}[font = \normalsize] \begin{scope}[every node/.style={% % text width = 3.0cm, % text depth = 2.0cm, inner sep = 2.0mm, minimum height = 2.0cm, minimum width = 1.5cm, align = left }]

\nodefill = blue!20{\textbf{F}};

\nodefill = red!20, anchor = north west at (T1.north east){\textbf{Co}};

\nodefill = green!20, anchor = north west at (T1.south west){\textbf{Cu}};

\nodefill = yellow!20, anchor = north west at (T1.south east){\textbf{O}}; \end{scope}

\begin{scope}[align = center] \node [text width = 6cm, above = 0.0ex, anchor = south] (T5) at (T1.north east) {\textbf{I}};

\node [text width = 6cm, below = 0.0ex, anchor = north] (T6) at (T3.south east) {\textbf{U}};

\node text width = 1.5cm, left = 0.0ex, anchor = east at (T1.south west) {\textbf{C}};

\node text width = 0.75cm, right = 0.0ex, anchor = west at (T2.south east) {\textbf{S}};

\end{scope}

\draw[thick] (T5) -- (T6) (T7) -- (T8) ;
\end{tikzpicture}

\end{document}

enter image description here

MYaseen208
  • 8,587

0 Answers0